katherine 2 years ago
parent 0d7a72fabf
commit c798ac3371
  1. 1
      05-brain/src/main.c
  2. 6
      06-brain2/src/main.c

@ -76,6 +76,7 @@ int main(int argc, char **argv)
reset:
memset(bits1, 0, sizeof(bits1));
memset(bits2, 0, sizeof(bits2));
while(true) {
al_wait_for_event(eq, &e);

@ -76,6 +76,7 @@ int main(int argc, char **argv)
reset:
memset(bits1, 0, sizeof(bits1));
memset(bits2, 0, sizeof(bits1));
while(true) {
al_wait_for_event(eq, &e);
@ -86,7 +87,7 @@ reset:
goto done;
case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN:
bits1[e.mouse.y / DISP_SCALE][e.mouse.x / DISP_SCALE] = 1;
bits1[e.mouse.y / DISP_SCALE][e.mouse.x / DISP_SCALE] = 3;
mouse_down = true;
break;
@ -107,6 +108,7 @@ reset:
case ALLEGRO_KEY_2:
memset(bits1, 0, sizeof(bits1));
memset(bits2, 0, sizeof(bits2));
for (x = 0; x < SEED_BITS; x++) {
bits1[randombytes_random() % BUF_H][randombytes_random() % BUF_W] = 3;
}
@ -131,7 +133,7 @@ reset:
if (mouse_down) {
al_get_mouse_state(&ms);
bits1[ms.y / DISP_SCALE][ms.x / DISP_SCALE] = 1;
bits1[ms.y / DISP_SCALE][ms.x / DISP_SCALE] = 3;
}
/* step */

Loading…
Cancel
Save