missing includes
authorJohn Tsiombikas <nuclear@mutantstargoat.com>
Mon, 29 Aug 2016 02:44:40 +0000 (05:44 +0300)
committerJohn Tsiombikas <nuclear@mutantstargoat.com>
Mon, 29 Aug 2016 02:44:40 +0000 (05:44 +0300)
src/dos/main.c

index 442f343..06fd0bb 100644 (file)
@@ -1,11 +1,15 @@
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <limits.h>
 #include "demo.h"
 #include "keyb.h"
+#include "mouse.h"
 #include "timer.h"
 #include "gfx.h"
 
 static int quit;
+static int use_mouse;
 
 int main(int argc, char **argv)
 {
@@ -15,6 +19,11 @@ int main(int argc, char **argv)
        init_timer(100);
        kb_init(32);
 
+       if((use_mouse = have_mouse())) {
+               set_mouse_limits(0, 0, fb_width, fb_height);
+               set_mouse(fb_width / 2, fb_height / 2);
+       }
+
        if(!(fb_pixels = malloc(fbsize))) {
                fprintf(stderr, "failed to allocate backbuffer\n");
                return 1;
@@ -37,7 +46,9 @@ int main(int argc, char **argv)
                }
                if(quit) goto break_evloop;
 
-               mouse_bmask = read_mouse(&mouse_x, &mouse_y);
+               if(use_mouse) {
+                       mouse_bmask = read_mouse(&mouse_x, &mouse_y);
+               }
 
                time_msec = get_msec();
                demo_draw();