3 static BITMAP
*tux
, *gnu
, *buffer
;
5 static inline void game_color_depth(void)
9 depth
= desktop_color_depth();
12 set_color_depth(depth
);
15 static void game_init(void)
22 ret
= set_gfx_mode(GFX_AUTODETECT_WINDOWED
, 640, 480, 0, 0);
24 allegro_message(allegro_error
);
32 /* add other initializations here */
33 tux
= load_bitmap("Tux.bmp", NULL
);
35 allegro_message(allegro_error
);
39 gnu
= load_bitmap("gnu.bmp", NULL
);
41 allegro_message(allegro_error
);
45 buffer
= create_bitmap(SCREEN_W
, SCREEN_H
);
47 allegro_message(allegro_error
);
52 static void game_deinit(void)
55 /* add other deinitializations here */
56 //FIXME: free tux, gnu and buffer
66 while (!key
[KEY_ESC
]) {
68 if (key
[KEY_LEFT
] && col
> 0)
70 if (key
[KEY_RIGHT
] && col
< (SCREEN_W
- tux
->w
))
72 if (key
[KEY_UP
] && lin
> 0)
74 if (key
[KEY_DOWN
] && lin
< (SCREEN_H
- tux
->h
))
78 draw_sprite(buffer
, tux
, col
, lin
);
79 draw_sprite(buffer
, gnu
, 100, 40);
80 draw_sprite(screen
, buffer
, 0, 0);