11 static struct video_mode *vmode;
14 int main(int argc, char **argv)
17 struct video_mode *vmodes;
18 int vmidx, status = 0;
20 init_logger("game.log");
25 if(init_video() == -1) {
28 vmodes = video_modes();
30 if((vmidx = match_video_mode(640, 480, 16)) == -1) {
33 if(!(vmem = set_video_mode(vmidx, 1))) {
36 vmode = vmodes + vmidx;
38 fb_width = vmode->xsz;
39 fb_height = vmode->ysz;
40 fb_size = vmode->pitch * vmode->ysz;
42 if(!(fb_buf = malloc(fb_size + vmode->pitch * 2))) {
43 fprintf(stderr, "failed to allocate framebuffer\n");
47 fb_pixels = (uint16_t*)((char*)fb_buf + vmode->pitch);
49 if(init(argc, argv) == -1) {
59 while((key = kb_getkey()) != -1) {
63 while((key = kb_getkey()) != -1) {
64 if(key == 27) goto break_evloop;
67 if(quit) goto break_evloop;
69 time_msec = get_msec();