foo
[eradicate] / src / menuscr.c
1 #include <stdio.h>
2 #include "menuscr.h"
3 #include "imago2.h"
4 #include "gfx.h"
5 #include "gfxutil.h"
6 #include "game.h"
7
8 static void *bgpix;
9 static int bgwidth, bgheight;
10
11 int menu_init(void)
12 {
13         if(!(bgpix = img_load_pixels("data/menbg640.png", &bgwidth, &bgheight, IMG_FMT_RGB24))) {
14                 fprintf(stderr, "failed to load menu bg image\n");
15                 return -1;
16         }
17         convimg_rgb24_rgb16(bgpix, bgpix, bgwidth, bgheight);
18         return 0;
19 }
20
21 void menu_cleanup(void)
22 {
23         img_free_pixels(bgpix);
24 }
25
26 void menu_start(void)
27 {
28 }
29
30 void menu_stop(void)
31 {
32 }
33
34 void menu_draw(void)
35 {
36         blit_frame(bgpix, 1);
37 }
38
39 void menu_keyb(int key, int pressed)
40 {
41         switch(key) {
42         case 27:
43                 game_quit();
44                 break;
45         }
46 }