Merge branch 'master' of goat:git/dosdemo
authorJohn Tsiombikas <nuclear@mutantstargoat.com>
Mon, 29 Aug 2016 02:14:53 +0000 (05:14 +0300)
committerJohn Tsiombikas <nuclear@mutantstargoat.com>
Mon, 29 Aug 2016 02:14:53 +0000 (05:14 +0300)
1  2 
src/demo.c

diff --combined src/demo.c
@@@ -3,6 -3,7 +3,7 @@@
  #include <string.h>
  #include <math.h>
  #include <errno.h>
+ #include <limits.h>
  #include "demo.h"
  #include "screen.h"
  
@@@ -11,26 -12,18 +12,28 @@@ int fb_height = 240
  int fb_bpp = 16;
  void *fb_pixels;
  unsigned long time_msec;
 +int mouse_x, mouse_y;
 +unsigned int mouse_bmask;
  
  static unsigned long nframes;
 +static const char *start_scr_name = "tunnel";
  
  int demo_init(int argc, char **argv)
  {
 +      if(argv[1]) {
 +              start_scr_name = argv[1];
 +      }
 +
        if(scr_init() == -1) {
                return -1;
        }
 -      scr_change(scr_lookup("tunnel"), 4000);
 +      if(scr_change(scr_lookup(start_scr_name), 4000) == -1) {
 +              fprintf(stderr, "screen %s not found\n", start_scr_name);
 +              return -1;
 +      }
  
+       /* clear the framebuffer at least once */
+       memset(fb_pixels, 0, fb_width * fb_height * fb_bpp / CHAR_BIT);
        return 0;
  }