mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
add playback control to more menu of plugins.
although it doesn't make much sense for some plugins like dice as the menu is only shown when you start that plugin. change star plugin to go back to menu when exit game instead of closing plugin so that above change makes useful. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22171 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
eac0a5b840
commit
e2e7ecf350
9 changed files with 106 additions and 57 deletions
|
@ -24,6 +24,7 @@
|
||||||
#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
|
#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
|
||||||
|
|
||||||
#include <timefuncs.h>
|
#include <timefuncs.h>
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -620,7 +621,8 @@ static bool edit_memo(int change, struct shown *shown)
|
||||||
MENUITEM_STRINGLIST(edit_menu, "Edit menu", edit_menu_cb,
|
MENUITEM_STRINGLIST(edit_menu, "Edit menu", edit_menu_cb,
|
||||||
"Remove", "Edit",
|
"Remove", "Edit",
|
||||||
"New Weekly", "New Monthly",
|
"New Weekly", "New Monthly",
|
||||||
"New Yearly", "New One off");
|
"New Yearly", "New One off",
|
||||||
|
"Playback Control");
|
||||||
|
|
||||||
while (!exit)
|
while (!exit)
|
||||||
{
|
{
|
||||||
|
@ -652,6 +654,10 @@ static bool edit_memo(int change, struct shown *shown)
|
||||||
add_memo(shown,3);
|
add_memo(shown,3);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
case 6: /* playback control */
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
case GO_TO_PREVIOUS:
|
case GO_TO_PREVIOUS:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -327,13 +328,13 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
int i;
|
int i;
|
||||||
bool done;
|
bool done;
|
||||||
int nr;
|
int nr;
|
||||||
|
|
||||||
(void)parameter;
|
(void)parameter;
|
||||||
|
|
||||||
settings.nr_timers = 1;
|
settings.nr_timers = 1;
|
||||||
settings.total_time = 10;
|
settings.total_time = 10;
|
||||||
settings.round_time = 10;
|
settings.round_time = 10;
|
||||||
|
|
||||||
/* now go ahead and have fun! */
|
/* now go ahead and have fun! */
|
||||||
rb->splash(HZ, "Chess Clock");
|
rb->splash(HZ, "Chess Clock");
|
||||||
|
|
||||||
|
@ -380,7 +381,7 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
timer_holder[i].used_time=0;
|
timer_holder[i].used_time=0;
|
||||||
timer_holder[i].hidden=false;
|
timer_holder[i].hidden=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pause=true; /* We start paused */
|
pause=true; /* We start paused */
|
||||||
|
|
||||||
nr=0;
|
nr=0;
|
||||||
|
@ -431,7 +432,7 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
static void show_pause_mode(bool enabled)
|
static void show_pause_mode(bool enabled)
|
||||||
{
|
{
|
||||||
static const char pause_icon[] = {0x00,0x7f,0x7f,0x00,0x7f,0x7f,0x00};
|
static const char pause_icon[] = {0x00,0x7f,0x7f,0x00,0x7f,0x7f,0x00};
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
rb->lcd_mono_bitmap((unsigned char *)pause_icon, 52, 0, 7, 8);
|
rb->lcd_mono_bitmap((unsigned char *)pause_icon, 52, 0, 7, 8);
|
||||||
else
|
else
|
||||||
|
@ -524,13 +525,14 @@ static int run_timer(int nr)
|
||||||
{
|
{
|
||||||
MENUITEM_STRINGLIST(menu, "Menu", NULL,
|
MENUITEM_STRINGLIST(menu, "Menu", NULL,
|
||||||
"Delete player", "Restart round",
|
"Delete player", "Restart round",
|
||||||
"Set round time", "Set total time");
|
"Set round time", "Set total time",
|
||||||
|
"Playback Control");
|
||||||
|
|
||||||
int val, res;
|
int val, res;
|
||||||
switch(rb->do_menu(&menu, NULL, NULL, false))
|
switch(rb->do_menu(&menu, NULL, NULL, false))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/* delete player */
|
/* delete player */
|
||||||
timer_holder[nr].hidden=true;
|
timer_holder[nr].hidden=true;
|
||||||
retval = CHCL_NEXT;
|
retval = CHCL_NEXT;
|
||||||
done=true;
|
done=true;
|
||||||
|
@ -544,8 +546,7 @@ static int run_timer(int nr)
|
||||||
/* set round time */
|
/* set round time */
|
||||||
val=(max_ticks-ticks)/HZ;
|
val=(max_ticks-ticks)/HZ;
|
||||||
res=chessclock_set_int("Round time",
|
res=chessclock_set_int("Round time",
|
||||||
&val,
|
&val, 10, 0, MAX_TIME,
|
||||||
10, 0, MAX_TIME,
|
|
||||||
FLAGS_SET_INT_SECONDS);
|
FLAGS_SET_INT_SECONDS);
|
||||||
if (res==CHCL_USB) {
|
if (res==CHCL_USB) {
|
||||||
retval = CHCL_USB;
|
retval = CHCL_USB;
|
||||||
|
@ -569,6 +570,9 @@ static int run_timer(int nr)
|
||||||
timer_holder[nr].total_time=val;
|
timer_holder[nr].total_time=val;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
case MENU_ATTACHED_USB:
|
case MENU_ATTACHED_USB:
|
||||||
retval = CHCL_USB;
|
retval = CHCL_USB;
|
||||||
done=true;
|
done=true;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "lib/pluginlib_actions.h"
|
#include "lib/pluginlib_actions.h"
|
||||||
#include "lib/configfile.h"
|
#include "lib/configfile.h"
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
#define MAX_DICES 12
|
#define MAX_DICES 12
|
||||||
#define INITIAL_NB_DICES 1
|
#define INITIAL_NB_DICES 1
|
||||||
|
@ -79,7 +80,7 @@ enum plugin_status plugin_start(const void* parameter) {
|
||||||
|
|
||||||
dice_init(&dice);
|
dice_init(&dice);
|
||||||
rb->srand(*rb->current_tick);
|
rb->srand(*rb->current_tick);
|
||||||
|
|
||||||
configfile_load(CFG_FILE, config, 2, 0);
|
configfile_load(CFG_FILE, config, 2, 0);
|
||||||
dice.nb_sides = nb_sides_values[sides_index];
|
dice.nb_sides = nb_sides_values[sides_index];
|
||||||
if(!dice_menu(&dice))
|
if(!dice_menu(&dice))
|
||||||
|
@ -171,8 +172,10 @@ bool dice_menu(struct dices * dice) {
|
||||||
int selection;
|
int selection;
|
||||||
bool menu_quit = false, result = false;
|
bool menu_quit = false, result = false;
|
||||||
|
|
||||||
MENUITEM_STRINGLIST(menu,"Dice Menu",NULL,"Roll Dice","Number of Dice",
|
MENUITEM_STRINGLIST(menu, "Dice Menu", NULL,
|
||||||
"Number of Sides","Quit");
|
"Roll Dice",
|
||||||
|
"Number of Dice", "Number of Sides",
|
||||||
|
"Playback Control", "Quit");
|
||||||
|
|
||||||
|
|
||||||
while (!menu_quit) {
|
while (!menu_quit) {
|
||||||
|
@ -194,11 +197,15 @@ bool dice_menu(struct dices * dice) {
|
||||||
dice->nb_sides=nb_sides_values[sides_index];
|
dice->nb_sides=nb_sides_values[sides_index];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
menu_quit = true;
|
menu_quit = true;
|
||||||
result = false;
|
result = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
#include "lib/playback_control.h"
|
||||||
#include "lib/md5.h"
|
#include "lib/md5.h"
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -29,7 +30,6 @@ PLUGIN_HEADER
|
||||||
|
|
||||||
/* The header begins with the unencrypted salt (4 bytes) padded with 4 bytes of
|
/* The header begins with the unencrypted salt (4 bytes) padded with 4 bytes of
|
||||||
zeroes. After that comes the encrypted hash of the master password (16 bytes) */
|
zeroes. After that comes the encrypted hash of the master password (16 bytes) */
|
||||||
|
|
||||||
|
|
||||||
#define HEADER_LEN 24
|
#define HEADER_LEN 24
|
||||||
|
|
||||||
|
@ -106,9 +106,10 @@ static void decrypt(uint32_t* v, uint32_t* k)
|
||||||
|
|
||||||
static int context_item_cb(int action, const struct menu_item_ex *this_item)
|
static int context_item_cb(int action, const struct menu_item_ex *this_item)
|
||||||
{
|
{
|
||||||
|
int i = (intptr_t)this_item;
|
||||||
if (action == ACTION_REQUEST_MENUITEM
|
if (action == ACTION_REQUEST_MENUITEM
|
||||||
&& pw_list.num_entries == 0
|
&& pw_list.num_entries == 0
|
||||||
&& ((intptr_t)this_item) != 0)
|
&& (i != 0 && i != 5))
|
||||||
{
|
{
|
||||||
return ACTION_EXIT_MENUITEM;
|
return ACTION_EXIT_MENUITEM;
|
||||||
}
|
}
|
||||||
|
@ -117,8 +118,9 @@ static int context_item_cb(int action, const struct menu_item_ex *this_item)
|
||||||
|
|
||||||
MENUITEM_STRINGLIST(context_m, "Context menu", context_item_cb,
|
MENUITEM_STRINGLIST(context_m, "Context menu", context_item_cb,
|
||||||
"Add entry",
|
"Add entry",
|
||||||
"Edit title", "Edit user name", "Edit password",
|
"Edit title", "Edit user name", "Edit password",
|
||||||
"Delete entry")
|
"Delete entry",
|
||||||
|
"Playback Control");
|
||||||
|
|
||||||
static char * kb_list_cb(int selected_item, void *data,
|
static char * kb_list_cb(int selected_item, void *data,
|
||||||
char *buffer, size_t buffer_len)
|
char *buffer, size_t buffer_len)
|
||||||
|
@ -133,7 +135,7 @@ static char * kb_list_cb(int selected_item, void *data,
|
||||||
}
|
}
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
rb->snprintf(buffer, buffer_len, "%s", entry->title);
|
rb->snprintf(buffer, buffer_len, "%s", entry->title);
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
|
@ -161,7 +163,7 @@ static void delete_entry(int selected_item)
|
||||||
entry2 = entry->next;
|
entry2 = entry->next;
|
||||||
if (!entry2)
|
if (!entry2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
entry->next = entry2->next;
|
entry->next = entry2->next;
|
||||||
|
|
||||||
entry2->used = false;
|
entry2->used = false;
|
||||||
|
@ -289,6 +291,9 @@ static void context_menu(int selected_item)
|
||||||
case 4:
|
case 4:
|
||||||
delete_entry(selected_item);
|
delete_entry(selected_item);
|
||||||
return;
|
return;
|
||||||
|
case 5:
|
||||||
|
playback_control(NULL);
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
|
@ -610,8 +615,9 @@ static int main_menu(void)
|
||||||
int selection, result, ret;
|
int selection, result, ret;
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
|
|
||||||
MENUITEM_STRINGLIST(menu,"Keybox", NULL, "Enter Keybox",
|
MENUITEM_STRINGLIST(menu, "Keybox", NULL,
|
||||||
"Reset Keybox", "Exit");
|
"Enter Keybox", "Reset Keybox",
|
||||||
|
"Playback Control", "Exit");
|
||||||
|
|
||||||
do {
|
do {
|
||||||
result = rb->do_menu(&menu, &selection, NULL, false);
|
result = rb->do_menu(&menu, &selection, NULL, false);
|
||||||
|
@ -625,6 +631,9 @@ static int main_menu(void)
|
||||||
reset();
|
reset();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,7 @@ static enum {
|
||||||
|
|
||||||
STATE_FAILED, /* The player wants to retry the level */
|
STATE_FAILED, /* The player wants to retry the level */
|
||||||
STATE_GAME_MENU, /* The player wan't to access the in-game menu */
|
STATE_GAME_MENU, /* The player wan't to access the in-game menu */
|
||||||
|
|
||||||
STATE_IN_LEVEL,
|
STATE_IN_LEVEL,
|
||||||
} state;
|
} state;
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ static void draw_level(
|
||||||
short xOff = (LCD_WIDTH - (size*li->width))/2;
|
short xOff = (LCD_WIDTH - (size*li->width))/2;
|
||||||
short yOff = (LCD_HEIGHT - (size*li->height))/2;
|
short yOff = (LCD_HEIGHT - (size*li->height))/2;
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
|
|
||||||
draw_walls(size,xOff,yOff,li->width, li->height, li->entrance, li->exit);
|
draw_walls(size,xOff,yOff,li->width, li->height, li->entrance, li->exit);
|
||||||
|
@ -658,7 +658,7 @@ static void in_game_menu(void)
|
||||||
MAZEZAM_TEXT_RETRY_LEVEL,
|
MAZEZAM_TEXT_RETRY_LEVEL,
|
||||||
MAZEZAM_TEXT_AUDIO_PLAYBACK,
|
MAZEZAM_TEXT_AUDIO_PLAYBACK,
|
||||||
MAZEZAM_TEXT_QUIT);
|
MAZEZAM_TEXT_QUIT);
|
||||||
|
|
||||||
/* Don't show the status bar */
|
/* Don't show the status bar */
|
||||||
switch(rb->do_menu(&menu, &start_selection, NULL, false)){
|
switch(rb->do_menu(&menu, &start_selection, NULL, false)){
|
||||||
case 1: /* retry */
|
case 1: /* retry */
|
||||||
|
@ -888,6 +888,7 @@ static void main_menu(void)
|
||||||
MENUITEM_STRINGLIST(menu,MAZEZAM_TEXT_MAIN_MENU,main_menu_cb,
|
MENUITEM_STRINGLIST(menu,MAZEZAM_TEXT_MAIN_MENU,main_menu_cb,
|
||||||
MAZEZAM_TEXT_CONTINUE,
|
MAZEZAM_TEXT_CONTINUE,
|
||||||
MAZEZAM_TEXT_PLAY_NEW_GAME,
|
MAZEZAM_TEXT_PLAY_NEW_GAME,
|
||||||
|
MAZEZAM_TEXT_AUDIO_PLAYBACK,
|
||||||
MAZEZAM_TEXT_QUIT);
|
MAZEZAM_TEXT_QUIT);
|
||||||
|
|
||||||
while (state >= STATE_IN_APPLICATION) {
|
while (state >= STATE_IN_APPLICATION) {
|
||||||
|
@ -906,6 +907,10 @@ static void main_menu(void)
|
||||||
game_loop(&r_data);
|
game_loop(&r_data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 2: /* Audio playback */
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_ATTACHED_USB:
|
case MENU_ATTACHED_USB:
|
||||||
state = STATE_USB_CONNECTED;
|
state = STATE_USB_CONNECTED;
|
||||||
break;
|
break;
|
||||||
|
@ -935,7 +940,7 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
store_lcd_settings();
|
store_lcd_settings();
|
||||||
|
|
||||||
state = STATE_MAIN_MENU;
|
state = STATE_MAIN_MENU;
|
||||||
main_menu();
|
main_menu();
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case STATE_USB_CONNECTED:
|
case STATE_USB_CONNECTED:
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "pacbox.h"
|
#include "pacbox.h"
|
||||||
#include "pacbox_lcd.h"
|
#include "pacbox_lcd.h"
|
||||||
#include "lib/configfile.h"
|
#include "lib/configfile.h"
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
PLUGIN_IRAM_DECLARE
|
PLUGIN_IRAM_DECLARE
|
||||||
|
@ -78,9 +79,9 @@ static bool loadFile( const char * name, unsigned char * buf, int len )
|
||||||
if( fd < 0 ) {
|
if( fd < 0 ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int n = rb->read( fd, buf, len);
|
int n = rb->read( fd, buf, len);
|
||||||
|
|
||||||
rb->close( fd );
|
rb->close( fd );
|
||||||
|
|
||||||
if( n != len ) {
|
if( n != len ) {
|
||||||
|
@ -174,7 +175,8 @@ static bool pacbox_menu(void)
|
||||||
|
|
||||||
MENUITEM_STRINGLIST(menu, "Pacbox Menu", NULL,
|
MENUITEM_STRINGLIST(menu, "Pacbox Menu", NULL,
|
||||||
"Difficulty", "Pacmen Per Game", "Bonus Life",
|
"Difficulty", "Pacmen Per Game", "Bonus Life",
|
||||||
"Ghost Names", "Display FPS", "Restart", "Quit");
|
"Ghost Names", "Display FPS",
|
||||||
|
"Playback Control", "Restart", "Quit");
|
||||||
|
|
||||||
rb->button_clear_queue();
|
rb->button_clear_queue();
|
||||||
|
|
||||||
|
@ -220,10 +222,13 @@ static bool pacbox_menu(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: /* Show FPS */
|
case 4: /* Show FPS */
|
||||||
rb->set_option("Display FPS",&settings.showfps,INT,
|
rb->set_option("Display FPS",&settings.showfps,INT,
|
||||||
noyes, 2, NULL);
|
noyes, 2, NULL);
|
||||||
break;
|
break;
|
||||||
case 5: /* Restart */
|
case 5: /* playback control */
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
case 6: /* Restart */
|
||||||
need_restart=true;
|
need_restart=true;
|
||||||
menu_quit=1;
|
menu_quit=1;
|
||||||
break;
|
break;
|
||||||
|
@ -323,7 +328,7 @@ static int gameProc( void )
|
||||||
yield_counter = 0;
|
yield_counter = 0;
|
||||||
rb->yield ();
|
rb->yield ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following functions render the Pacman screen from the
|
/* The following functions render the Pacman screen from the
|
||||||
contents of the video and color ram. We first update the
|
contents of the video and color ram. We first update the
|
||||||
background, and then draw the Sprites on top.
|
background, and then draw the Sprites on top.
|
||||||
|
@ -343,10 +348,10 @@ static int gameProc( void )
|
||||||
|
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
||||||
/* Keep the framerate at Pacman's 60fps */
|
/* Keep the framerate at Pacman's 60fps */
|
||||||
end_time = start_time + (video_frames*HZ)/FPS;
|
end_time = start_time + (video_frames*HZ)/FPS;
|
||||||
while (TIME_BEFORE(*rb->current_tick,end_time)) {
|
while (TIME_BEFORE(*rb->current_tick,end_time)) {
|
||||||
rb->sleep(1);
|
rb->sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "lib/pluginlib_bmp.h"
|
#include "lib/pluginlib_bmp.h"
|
||||||
#include "lib/rgb_hsv.h"
|
#include "lib/rgb_hsv.h"
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -533,6 +534,7 @@ enum {
|
||||||
MAIN_MENU_NEW, MAIN_MENU_LOAD, MAIN_MENU_SAVE,
|
MAIN_MENU_NEW, MAIN_MENU_LOAD, MAIN_MENU_SAVE,
|
||||||
MAIN_MENU_BRUSH_SIZE, MAIN_MENU_BRUSH_SPEED, MAIN_MENU_COLOR,
|
MAIN_MENU_BRUSH_SIZE, MAIN_MENU_BRUSH_SPEED, MAIN_MENU_COLOR,
|
||||||
MAIN_MENU_GRID_SIZE,
|
MAIN_MENU_GRID_SIZE,
|
||||||
|
MAIN_MENU_PLAYBACK_CONTROL,
|
||||||
MAIN_MENU_EXIT,
|
MAIN_MENU_EXIT,
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
|
@ -551,7 +553,8 @@ enum {
|
||||||
MENUITEM_STRINGLIST(main_menu, "RockPaint", NULL,
|
MENUITEM_STRINGLIST(main_menu, "RockPaint", NULL,
|
||||||
"Resume", "New", "Load", "Save",
|
"Resume", "New", "Load", "Save",
|
||||||
"Brush Size", "Brush Speed",
|
"Brush Size", "Brush Speed",
|
||||||
"Choose Color", "Grid Size", "Exit");
|
"Choose Color", "Grid Size",
|
||||||
|
"Playback Control", "Exit");
|
||||||
MENUITEM_STRINGLIST(size_menu, "Choose Size", NULL,
|
MENUITEM_STRINGLIST(size_menu, "Choose Size", NULL,
|
||||||
"1x", "2x","4x", "8x");
|
"1x", "2x","4x", "8x");
|
||||||
MENUITEM_STRINGLIST(speed_menu, "Choose Speed", NULL,
|
MENUITEM_STRINGLIST(speed_menu, "Choose Speed", NULL,
|
||||||
|
@ -2527,6 +2530,10 @@ static void goto_menu(void)
|
||||||
gridsize = gridsize_list[multi];
|
gridsize = gridsize_list[multi];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MAIN_MENU_PLAYBACK_CONTROL:
|
||||||
|
playback_control( NULL );
|
||||||
|
break;
|
||||||
|
|
||||||
case MAIN_MENU_EXIT:
|
case MAIN_MENU_EXIT:
|
||||||
restore_screen();
|
restore_screen();
|
||||||
quit=true;
|
quit=true;
|
||||||
|
|
|
@ -34,6 +34,7 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left;
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -393,7 +394,7 @@ void game (void) {
|
||||||
rb->sleep(HZ/level);
|
rb->sleep(HZ/level);
|
||||||
|
|
||||||
button=rb->button_get(false);
|
button=rb->button_get(false);
|
||||||
|
|
||||||
#ifdef HAS_BUTTON_HOLD
|
#ifdef HAS_BUTTON_HOLD
|
||||||
if (rb->button_hold())
|
if (rb->button_hold())
|
||||||
button = SNAKE_PLAYPAUSE;
|
button = SNAKE_PLAYPAUSE;
|
||||||
|
@ -445,23 +446,28 @@ void game_init(void) {
|
||||||
apple=false;
|
apple=false;
|
||||||
snakelength=4;
|
snakelength=4;
|
||||||
score=0;
|
score=0;
|
||||||
board[11][7]=1;
|
board[11][7]=1;
|
||||||
|
|
||||||
MENUITEM_STRINGLIST(menu,"Snake Menu",NULL,"Start New Game","Starting Level",
|
MENUITEM_STRINGLIST(menu, "Snake Menu", NULL,
|
||||||
"Quit");
|
"Start New Game", "Starting Level",
|
||||||
|
"Playback Control", "Quit");
|
||||||
|
|
||||||
while (!menu_quit) {
|
while (!menu_quit) {
|
||||||
switch(rb->do_menu(&menu, &selection, NULL, false))
|
switch(rb->do_menu(&menu, &selection, NULL, false))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
menu_quit = true; /* start playing */
|
menu_quit = true; /* start playing */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
rb->set_int("Starting Level", "", UNIT_INT, &level, NULL,
|
rb->set_int("Starting Level", "", UNIT_INT, &level, NULL,
|
||||||
1, 1, 9, NULL );
|
1, 1, 9, NULL );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dead=1; /* quit program */
|
dead=1; /* quit program */
|
||||||
menu_quit = true;
|
menu_quit = true;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#include "lib/display_text.h"
|
#include "lib/display_text.h"
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -424,8 +425,6 @@ static char board[STAR_HEIGHT][STAR_WIDTH];
|
||||||
#define STAR 3
|
#define STAR 3
|
||||||
#define BALL 4
|
#define BALL 4
|
||||||
|
|
||||||
#define MENU_START 0
|
|
||||||
|
|
||||||
/* char font size */
|
/* char font size */
|
||||||
static int char_width = -1;
|
static int char_width = -1;
|
||||||
static int char_height = -1;
|
static int char_height = -1;
|
||||||
|
@ -1051,18 +1050,21 @@ static int star_menu(void)
|
||||||
{
|
{
|
||||||
int selection, level=1;
|
int selection, level=1;
|
||||||
bool menu_quit = false;
|
bool menu_quit = false;
|
||||||
/* get the size of char */
|
|
||||||
rb->lcd_getstringsize("a", &char_width, &char_height);
|
|
||||||
|
|
||||||
MENUITEM_STRINGLIST(menu,"Star Menu",NULL,"Start Game","Choose Level",
|
MENUITEM_STRINGLIST(menu, "Star Menu", NULL,
|
||||||
"Help", "Quit");
|
"Start Game","Choose Level",
|
||||||
|
"Help", "Playback Control", "Quit");
|
||||||
|
|
||||||
while(!menu_quit)
|
while(!menu_quit)
|
||||||
{
|
{
|
||||||
switch(rb->do_menu(&menu, &selection, NULL, false))
|
switch(rb->do_menu(&menu, &selection, NULL, false))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
menu_quit = true;
|
/* use system font and get the size of char */
|
||||||
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
|
rb->lcd_getstringsize("a", &char_width, &char_height);
|
||||||
|
star_run_game(level-1);
|
||||||
|
rb->lcd_setfont(FONT_UI);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
rb->set_int("Level", "", UNIT_INT, &level,
|
rb->set_int("Level", "", UNIT_INT, &level,
|
||||||
|
@ -1072,19 +1074,17 @@ static int star_menu(void)
|
||||||
if(star_help())
|
if(star_help())
|
||||||
usb_detected = true;
|
usb_detected = true;
|
||||||
break;
|
break;
|
||||||
default:
|
case 3:
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
menu_quit = true;
|
menu_quit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(usb_detected)
|
||||||
|
return PLUGIN_USB_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selection == MENU_START)
|
|
||||||
{
|
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
|
||||||
rb->lcd_getstringsize("a", &char_width, &char_height);
|
|
||||||
level--;
|
|
||||||
star_run_game(level);
|
|
||||||
}
|
|
||||||
return PLUGIN_OK;
|
return PLUGIN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue