10 static void draw(void);
12 static struct video_mode *vmode;
15 int main(int argc, char **argv)
17 struct video_mode *vmodes;
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->xsz * vmode->bpp / 8) * vmode->ysz;
46 while((key = kb_getkey()) != -1) {
47 if(key == 27) goto break_evloop;
50 time_msec = get_msec();
60 static void draw(void)
63 uint16_t *pptr = vmem;
65 for(i=0; i<fb_height; i++) {
66 for(j=0; j<fb_width; j++) {
67 int chess = (i >> 2) == (j >> 2);
68 *pptr++ = chess ? 0xff00 : 0x00ff;
73 void swap_buffers(void *pixels)
76 memcpy(vmem, pixels, fb_size);