diff options
Diffstat (limited to '04-conway')
| -rw-r--r-- | 04-conway/src/main.c | 17 | 
1 files changed, 7 insertions, 10 deletions
diff --git a/04-conway/src/main.c b/04-conway/src/main.c index 75ed338..914a1a0 100644 --- a/04-conway/src/main.c +++ b/04-conway/src/main.c @@ -15,7 +15,7 @@  #define SEED_BITS 4096 -#define FPS 60.0 +#define FPS 30.0  #define DO_INIT(check, desc) \  	if (!(check)) { \ @@ -111,7 +111,7 @@ reset:  				goto done;  			case ALLEGRO_KEY_1: -				framerate = (framerate == 2 ? 16 : framerate / 2); +				framerate = (framerate == 1 ? 16 : framerate / 2);  				printf("fps: %.1f\n", FPS / ((float)framerate) );  				break; @@ -144,17 +144,14 @@ reset:  			if (mouse_down) {  				al_get_mouse_state(&ms); -				bit_set(bits1[ms.y / 2], ms.x / 2); -			} - -			if (goframes > 1) { -				goframes--; -				break; +				bit_set(bits1[ms.y / DISP_SCALE], ms.x / DISP_SCALE);  			}  			/* step */ -			if (!pause) { +			if (goframes) { +				goframes--; +			} else if (!pause) {  				memset(bits2, 0, sizeof(bits1));  				for (y = 0; y < BUF_H; y++) { @@ -176,6 +173,7 @@ reset:  				}  				memcpy(bits1, bits2, sizeof(bits1)); +				goframes = framerate;  			}  			/* draw frame */ @@ -203,7 +201,6 @@ reset:  			);  			al_flip_display(); -			goframes = framerate;  		}  	}  | 
