X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fm6502.c;h=4f90a6a10acf8b1f396556c372c6e3e4cd2ac005;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=11a787432921a25a4d139ad96334a1a61867f12f;hpb=6f5482d73adb0165c0130bb47d852644ab0c4869;p=xscreensaver diff --git a/hacks/m6502.c b/hacks/m6502.c index 11a78743..4f90a6a1 100644 --- a/hacks/m6502.c +++ b/hacks/m6502.c @@ -12,7 +12,7 @@ * Created: 07-May-2007 */ -#include +#include #include #include "screenhack.h" #include "analogtv.h" @@ -28,7 +28,7 @@ static const char * const demo_files[] = { }; -#ifndef USE_IPHONE +#ifndef HAVE_MOBILE # define READ_FILES #endif @@ -60,6 +60,7 @@ struct state { int which;/* the program to run*/ int demos;/* number of demos included */ struct timeval start_time; + int reset_p; }; static void @@ -222,6 +223,7 @@ m6502_draw (Display *dpy, Window window, void *closure) struct state *st = (struct state *) closure; unsigned int x = 0, y = 0; double te; + const analogtv_reception *reception = &st->reception; m6502_next_eval(st->machine,500); @@ -229,13 +231,12 @@ m6502_draw (Display *dpy, Window window, void *closure) for (y = 0; y < 32; y++) paint_pixel(st,x,y,st->pixels[x][y]); - analogtv_init_signal(st->tv, 0.04); analogtv_reception_update(&st->reception); - analogtv_add_signal(st->tv, &st->reception); - analogtv_draw(st->tv); + analogtv_draw(st->tv, 0.04, &reception, 1); te = get_time(st); - if (te > st->dt){ /* do something more interesting here XXX */ + if (st->reset_p || te > st->dt){ /* do something more interesting here XXX */ + st->reset_p = 0; for(x = 0; x < 32; x++) for(y = 0; y < 32; y++) st->pixels[x][y] = 0; @@ -243,7 +244,11 @@ m6502_draw (Display *dpy, Window window, void *closure) start_rand_bin_prog(st->machine,st); } - return 10000; +#ifdef HAVE_MOBILE + return 0; +#else + return 5000; +#endif } @@ -276,6 +281,12 @@ m6502_reshape (Display *dpy, Window window, void *closure, static Bool m6502_event (Display *dpy, Window window, void *closure, XEvent *event) { + struct state *st = (struct state *) closure; + if (screenhack_event_helper (dpy, window, event)) + { + st->reset_p = 1; + return True; + } return False; }