11 static struct video_mode *vmode;
15 int main(int argc, char **argv)
18 struct video_mode *vmodes;
19 int vmidx, status = 0;
21 init_logger("game.log");
26 if(init_video() == -1) {
29 vmodes = video_modes();
31 if((vmidx = match_video_mode(640, 480, 16)) == -1) {
34 if(!(vmem = set_video_mode(vmidx, 1))) {
37 vmode = vmodes + vmidx;
39 fb_width = vmode->xsz;
40 fb_height = vmode->ysz;
41 fb_size = vmode->pitch * vmode->ysz;
43 if(!(fb_buf = malloc(fb_size + vmode->pitch * 2))) {
44 fprintf(stderr, "failed to allocate framebuffer\n");
48 fb_pixels = (uint16_t*)((char*)fb_buf + vmode->pitch);
50 if(init(argc, argv) == -1) {
60 while((key = kb_getkey()) != -1) {
64 while((key = kb_getkey()) != -1) {
65 if(key == 27) goto break_evloop;
68 if(quit) goto break_evloop;
70 time_msec = get_msec();