1010
Check-in [41ae9899c2]
Not logged in
Public Repositories
mwm's Repositories

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix it so you can only pause a game when SELECTING or MOVING, and so that you always restart to MENU, not DONE.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:41ae9899c209a071a3afd84d5541ff18aff2b3c7
User & Date: mwm 2016-11-17 02:28:05
Context
2016-12-25
22:01
Add the things for the arduboy file, including a make target. Leaf check-in: f7483feec8 user: mwm tags: trunk
2016-12-09
09:47
Create new branch named "mom" check-in: f1348eb33b user: mwm tags: mom
2016-11-17
02:28
Fix it so you can only pause a game when SELECTING or MOVING, and so that you always restart to MENU, not DONE. check-in: 41ae9899c2 user: mwm tags: trunk
2016-11-09
11:42
Integrate the DONE & MENU menu handling check-in: 0f10991731 user: mwm tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tiny-1010.ino.

393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
...
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
     arduboy.setCursor(0, 44); 
     arduboy.print(F("High\n"));
     arduboy.print(game.high);
     switch (state) {
     case INIT:
          arduboy.fillRect(0, 0, BOARD_X - 1, 64, 0);
          arduboy.setCursor(0, 16);
          draw_msg("1010 v0.95\n  by mwm\n\nPress A");
          break;
     case DONE:
          blue = RGB_ON;
          // Fall through
     case MENU:
          draw_menu();
          break;
................................................................................

void
loop(void) {
     const shape *const s = &shapes[game.waiting[selected]];
     const byte can_place = draw_game();

     arduboy.pollButtons();
     if (arduboy.justPressed(B_BUTTON) && state != MENU && state != DONE) {
          prompt = PAUSED;
          state = MENU;
          selected = RESUME;
          return;
     }

     switch (state) {
     case INIT:
          if (arduboy.justPressed(A_BUTTON)) {
               arduboy.initRandomSeed();
               state = prompt == PAUSED ? MENU : DONE;
          }
          break;
     case DONE:
          for (byte i = 0; i < WAIT_LEN; i += 1)
               game.waiting[i] = -1;
          // And fall through...
     case MENU:







|







 







|










|







393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
...
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
     arduboy.setCursor(0, 44); 
     arduboy.print(F("High\n"));
     arduboy.print(game.high);
     switch (state) {
     case INIT:
          arduboy.fillRect(0, 0, BOARD_X - 1, 64, 0);
          arduboy.setCursor(0, 16);
          draw_msg("1010 v0.96\n  by mwm\n\nPress A");
          break;
     case DONE:
          blue = RGB_ON;
          // Fall through
     case MENU:
          draw_menu();
          break;
................................................................................

void
loop(void) {
     const shape *const s = &shapes[game.waiting[selected]];
     const byte can_place = draw_game();

     arduboy.pollButtons();
     if (arduboy.justPressed(B_BUTTON) && (state == SELECTING || state == MOVING)) {
          prompt = PAUSED;
          state = MENU;
          selected = RESUME;
          return;
     }

     switch (state) {
     case INIT:
          if (arduboy.justPressed(A_BUTTON)) {
               arduboy.initRandomSeed();
               state = MENU;
          }
          break;
     case DONE:
          for (byte i = 0; i < WAIT_LEN; i += 1)
               game.waiting[i] = -1;
          // And fall through...
     case MENU: