#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)
{
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;
}
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();