Project

General

Profile

Revision 166

encapsulated some functions

View differences:

proj/DR.mk
1 1
PROG=proj
2 2

  
3
SRCS= proj.c graphics.c sprite.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c proj_func.c
3
SRCS= proj.c graph.c sprite.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c proj_func.c
4 4

  
5
CPPFLAGS += -pedantic -I./bmp -I./xpm -D DIOGO # -D __LCOM_OPTIMIZED_ 
5
CPPFLAGS += -pedantic -I./bmp -I./xpm -D DIOGO # -D __LCOM_OPTIMIZED_
6 6

  
7 7
DPADD += ${LIBLCF}
8 8
LDADD += -llcf
proj/Makefile
1 1
PROG=proj
2 2

  
3
SRCS= proj.c graphics.c sprite.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c proj_func.c
3
SRCS= proj.c graph.c sprite.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c proj_func.c
4 4

  
5 5
CPPFLAGS += -pedantic -I./bmp -I./xpm -D __LCOM_OPTIMIZED_
6 6

  
proj/TB.mk
1 1
PROG=proj
2 2

  
3
SRCS= proj.c graphics.c sprite.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c proj_func.c
3
SRCS= proj.c graph.c sprite.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c proj_func.c
4 4

  
5 5
CPPFLAGS += -pedantic -I./bmp -I./xpm -D __LCOM_OPTIMIZED_ -D TELMO
6 6

  
proj/proj.c
7 7

  
8 8
#include "i8254.h"
9 9
#include "kbc_macros.h"
10
#include "graphics_macros.h"
10
#include "graph_macros.h"
11 11
#include "mouse_macros.h"
12 12
#include "proj_macros.h"
13 13
#include "errors.h"
14 14

  
15 15
#include "sprite.h"
16 16
#include "kbc.h"
17
#include "graphics.h"
17
#include "graph.h"
18 18
#include "timer.h"
19 19
#include "keyboard.h"
20 20
#include "mouse.h"
......
43 43
}
44 44

  
45 45
int(proj_main_loop)(int argc, char *argv[]) {
46

  
47
    if (vbe_get_mode_information(GRAPH_MODE)) {
48
        printf("%s: failed to get information for mode %x.\n", __func__, GRAPH_MODE);
49
        if (cleanup())
50
            printf("%s: failed to cleanup.\n", __func__);
46
    if(graph_init(GRAPH_MODE)){
47
        printf("%s: failed to initalize graphics.\n", __func__);
48
        if (cleanup()) printf("%s: failed to cleanup.\n", __func__);
51 49
        return 1;
52 50
    }
53 51

  
54
    graph_map_vram(); // if function fails it aborts program
55

  
56
    if (graph_set_mode(GRAPH_MODE)) {
57
        printf("%s: failed to set graphic mode %x.\n", __func__, GRAPH_MODE);
58
        if (cleanup())
59
            printf("%s: failed to cleanup.\n", __func__);
60
        return 1;
61
    };
62

  
63 52
    #ifdef DIOGO
64 53
        graph_paint_screen(0x777777);
65 54
        sprite_t *shooter1 = get_shooter(); sprite_set_pos(shooter1, 100, 100);
proj/proj_func.c
1 1
#include "proj_func.h"
2 2
#include "interrupts_func.h"
3
#include "graphics.h"
3
#include "graph.h"
4 4
#include "errors.h"
5 5

  
6 6
#include <lcom/lcf.h>
......
9 9
    int r = SUCCESS;
10 10
    if ((r = unsubscribe_all()))
11 11
        printf("%s: failed to unsubscribe drivers.\n", __func__);
12
    if ((r = graph_cleanup()))
13
        printf("%s: graph cleanup failed\n", __func__);
12 14

  
13
    if ((r = vg_exit()))
14
        printf("%s: vg_exit failed to exit to text mode.\n", __func__);
15
    if ((r = graph_free_memory_map()))
16
        printf("%s: lm_free failed\n", __func__);
17

  
18 15
    return r;
19 16
}
proj/sprite.c
2 2

  
3 3
#include "sprite.h"
4 4

  
5
#include "graphics.h"
5
#include "graph.h"
6 6
#include "utils.h"
7 7
#include <math.h>
8 8

  

Also available in: Unified diff