1
0
Fork 0
forked from len0rd/rockbox

Fix Pong button handling

* allow button combos for QUIT (fixes MPIO_HD300)
* allow quitting during PAUSE mode

Change-Id: Iaf8ffc65cdcfe6c1d25bfbad3e38764eea2664cc
This commit is contained in:
Sebastian Leonhardt 2015-07-13 00:30:14 +02:00 committed by Gerrit Rockbox
parent d552ff2648
commit 072d3cb268

View file

@ -631,9 +631,9 @@ static int keys(struct pong *p)
return 2; /* Pause game */ return 2; /* Pause game */
#endif #endif
if(key & PONG_QUIT if(key == PONG_QUIT
#ifdef PONG_RC_QUIT #ifdef PONG_RC_QUIT
|| key & PONG_RC_QUIT || key == PONG_RC_QUIT
#endif #endif
) )
return 0; /* exit game NOW */ return 0; /* exit game NOW */
@ -719,13 +719,6 @@ enum plugin_status plugin_start(const void* parameter)
/* go go go */ /* go go go */
while(game > 0) { while(game > 0) {
if (game == 2) { /* Game Paused */
rb->splash(0, "PAUSED");
while(game == 2)
game = keys(&pong); /* short circuit */
rb->lcd_clear_display();
}
if( pong.player[0].iscpu && pong.player[1].iscpu ) { if( pong.player[0].iscpu && pong.player[1].iscpu ) {
if(blink_timer<blink_rate) { if(blink_timer<blink_rate) {
++blink_timer; ++blink_timer;
@ -751,6 +744,13 @@ enum plugin_status plugin_start(const void* parameter)
rb->lcd_update(); rb->lcd_update();
game = keys(&pong); /* deal with keys */ game = keys(&pong); /* deal with keys */
if (game == 2) { /* Game Paused */
rb->splash(0, "PAUSED");
while(game == 2)
game = keys(&pong); /* short circuit */
rb->lcd_clear_display();
}
} }
/* Turn on backlight timeout (revert to settings) */ /* Turn on backlight timeout (revert to settings) */