mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
some changes to use of display_text.
* add parameter, wait_key to display_text(). - set this true to wait button press after all words is displayed. * use ARRAYLEN macro instead of #define WORDS * add macro to indicate end of style array. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24846 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
04067fd7a0
commit
56d29e8977
13 changed files with 91 additions and 166 deletions
|
@ -1135,7 +1135,6 @@ static unsigned int play_again(void) {
|
||||||
* blackjack_help() displays help text.
|
* blackjack_help() displays help text.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static bool blackjack_help(void) {
|
static bool blackjack_help(void) {
|
||||||
#define WORDS (sizeof help_text / sizeof (char*))
|
|
||||||
static char *help_text[] = {
|
static char *help_text[] = {
|
||||||
"Blackjack", "", "Aim", "",
|
"Blackjack", "", "Aim", "",
|
||||||
"Try", "to", "get", "as", "close", "to", "21", "without", "going",
|
"Try", "to", "get", "as", "close", "to", "21", "without", "going",
|
||||||
|
@ -1151,26 +1150,18 @@ static bool blackjack_help(void) {
|
||||||
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
||||||
{ 2, C_RED },
|
{ 2, C_RED },
|
||||||
{ 26, C_RED },
|
{ 26, C_RED },
|
||||||
{ -1, 0 }
|
LAST_STYLE_ITEM
|
||||||
};
|
};
|
||||||
int button;
|
|
||||||
|
|
||||||
rb->lcd_setfont(FONT_UI);
|
rb->lcd_setfont(FONT_UI);
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
rb->lcd_set_background(LCD_BLACK);
|
rb->lcd_set_background(LCD_BLACK);
|
||||||
rb->lcd_set_foreground(LCD_WHITE);
|
rb->lcd_set_foreground(LCD_WHITE);
|
||||||
#endif
|
#endif
|
||||||
|
if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true))
|
||||||
if (display_text(WORDS, help_text, formation, NULL))
|
|
||||||
return true;
|
return true;
|
||||||
do {
|
|
||||||
button = rb->button_get(true);
|
|
||||||
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} while( ( button == BUTTON_NONE )
|
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1138,7 +1138,6 @@ static void brickmania_sleep(int secs)
|
||||||
|
|
||||||
static int brickmania_help(void)
|
static int brickmania_help(void)
|
||||||
{
|
{
|
||||||
#define WORDS (sizeof help_text / sizeof (char*))
|
|
||||||
static char *help_text[] = {
|
static char *help_text[] = {
|
||||||
"Brickmania", "", "Aim", "",
|
"Brickmania", "", "Aim", "",
|
||||||
"Destroy", "all", "the", "bricks", "by", "bouncing",
|
"Destroy", "all", "the", "bricks", "by", "bouncing",
|
||||||
|
@ -1205,26 +1204,18 @@ static int brickmania_help(void)
|
||||||
{ 67, C_GREEN },
|
{ 67, C_GREEN },
|
||||||
{ 74, C_YELLOW },
|
{ 74, C_YELLOW },
|
||||||
{ 80, C_RED },
|
{ 80, C_RED },
|
||||||
{ -1, 0 }
|
LAST_STYLE_ITEM
|
||||||
};
|
};
|
||||||
int button;
|
|
||||||
|
|
||||||
rb->lcd_setfont(FONT_UI);
|
rb->lcd_setfont(FONT_UI);
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
rb->lcd_set_background(LCD_BLACK);
|
rb->lcd_set_background(LCD_BLACK);
|
||||||
rb->lcd_set_foreground(LCD_WHITE);
|
rb->lcd_set_foreground(LCD_WHITE);
|
||||||
#endif
|
#endif
|
||||||
|
if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true))
|
||||||
if (display_text(WORDS, help_text, formation, NULL))
|
|
||||||
return 1;
|
return 1;
|
||||||
do {
|
|
||||||
button = rb->button_get(true);
|
|
||||||
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
} while( ( button == BUTTON_NONE )
|
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -435,6 +435,7 @@ static void clix_draw(struct clix_game_state_t* state)
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
rb->lcd_set_foreground(LCD_WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clix_move_cursor(struct clix_game_state_t* state, const bool left)
|
static void clix_move_cursor(struct clix_game_state_t* state, const bool left)
|
||||||
|
@ -467,7 +468,6 @@ static void clix_move_cursor(struct clix_game_state_t* state, const bool left)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while ( y != state->y);
|
} while ( y != state->y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns the color of the given position, if out of bounds return CC_BLACK */
|
/* returns the color of the given position, if out of bounds return CC_BLACK */
|
||||||
|
@ -581,7 +581,6 @@ static int clix_clear_selected(struct clix_game_state_t* state)
|
||||||
|
|
||||||
static bool clix_help(void)
|
static bool clix_help(void)
|
||||||
{
|
{
|
||||||
#define WORDS (sizeof help_text / sizeof (char*))
|
|
||||||
static char *help_text[] = {
|
static char *help_text[] = {
|
||||||
"Clix", "", "Aim", "",
|
"Clix", "", "Aim", "",
|
||||||
"Remove", "all", "blocks", "from", "the", "board", "to", "achieve",
|
"Remove", "all", "blocks", "from", "the", "board", "to", "achieve",
|
||||||
|
@ -593,22 +592,16 @@ static bool clix_help(void)
|
||||||
static struct style_text formation[]={
|
static struct style_text formation[]={
|
||||||
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
||||||
{ 2, C_RED },
|
{ 2, C_RED },
|
||||||
{ -1, 0 }
|
LAST_STYLE_ITEM
|
||||||
};
|
};
|
||||||
int button;
|
|
||||||
|
|
||||||
rb->lcd_setfont(FONT_UI);
|
rb->lcd_setfont(FONT_UI);
|
||||||
rb->lcd_set_foreground(LCD_WHITE);
|
rb->lcd_set_foreground(LCD_WHITE);
|
||||||
if (display_text(WORDS, help_text, formation, NULL))
|
if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true))
|
||||||
return true;
|
return true;
|
||||||
do {
|
|
||||||
button = rb->button_get(true);
|
|
||||||
if ( rb->default_event_handler( button ) == SYS_USB_CONNECTED )
|
|
||||||
return true;
|
|
||||||
} while( ( button == BUTTON_NONE )
|
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
return 0;
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _ingame;
|
static bool _ingame;
|
||||||
|
|
|
@ -1300,8 +1300,6 @@ static void jewels_nextlevel(struct game_context* bj) {
|
||||||
|
|
||||||
static bool jewels_help(void)
|
static bool jewels_help(void)
|
||||||
{
|
{
|
||||||
rb->lcd_setfont(FONT_UI);
|
|
||||||
#define WORDS (sizeof help_text / sizeof (char*))
|
|
||||||
static char *help_text[] = {
|
static char *help_text[] = {
|
||||||
"Jewels", "", "Aim", "",
|
"Jewels", "", "Aim", "",
|
||||||
"Swap", "pairs", "of", "jewels", "to", "form", "connected",
|
"Swap", "pairs", "of", "jewels", "to", "form", "connected",
|
||||||
|
@ -1323,22 +1321,12 @@ static bool jewels_help(void)
|
||||||
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
||||||
{ 2, C_RED },
|
{ 2, C_RED },
|
||||||
{ 42, C_RED },
|
{ 42, C_RED },
|
||||||
{ -1, 0 }
|
LAST_STYLE_ITEM
|
||||||
};
|
};
|
||||||
#ifdef HAVE_LCD_COLOR
|
|
||||||
rb->lcd_set_background(LCD_BLACK);
|
rb->lcd_setfont(FONT_UI);
|
||||||
rb->lcd_set_foreground(LCD_WHITE);
|
if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true))
|
||||||
#endif
|
|
||||||
int button;
|
|
||||||
if (display_text(WORDS, help_text, formation, NULL))
|
|
||||||
return true;
|
return true;
|
||||||
do {
|
|
||||||
button = rb->button_get(true);
|
|
||||||
if (rb->default_event_handler (button) == SYS_USB_CONNECTED) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} while( ( button == BUTTON_NONE )
|
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -28,8 +28,20 @@
|
||||||
#define MARGIN 5
|
#define MARGIN 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool display_text(short words, char** text, struct style_text* style,
|
static bool wait_key_press(void)
|
||||||
struct viewport* vp_text)
|
{
|
||||||
|
int button;
|
||||||
|
do {
|
||||||
|
button = rb->button_get(true);
|
||||||
|
if ( rb->default_event_handler( button ) == SYS_USB_CONNECTED )
|
||||||
|
return true;
|
||||||
|
} while( ( button == BUTTON_NONE )
|
||||||
|
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool display_text(unsigned short words, char** text, struct style_text* style,
|
||||||
|
struct viewport* vp_text, bool wait_key)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
int prev_drawmode;
|
int prev_drawmode;
|
||||||
|
@ -41,7 +53,6 @@ bool display_text(short words, char** text, struct style_text* style,
|
||||||
unsigned short x , y;
|
unsigned short x , y;
|
||||||
unsigned short vp_width = LCD_WIDTH;
|
unsigned short vp_width = LCD_WIDTH;
|
||||||
unsigned short vp_height = LCD_HEIGHT;
|
unsigned short vp_height = LCD_HEIGHT;
|
||||||
int button;
|
|
||||||
unsigned short i = 0, style_index = 0;
|
unsigned short i = 0, style_index = 0;
|
||||||
if (vp_text != NULL) {
|
if (vp_text != NULL) {
|
||||||
vp_width = vp_text->width;
|
vp_width = vp_text->width;
|
||||||
|
@ -76,12 +87,8 @@ bool display_text(short words, char** text, struct style_text* style,
|
||||||
if (y + height > vp_height - MARGIN) {
|
if (y + height > vp_height - MARGIN) {
|
||||||
y = MARGIN;
|
y = MARGIN;
|
||||||
rb->screens[SCREEN_MAIN]->update_viewport();
|
rb->screens[SCREEN_MAIN]->update_viewport();
|
||||||
do {
|
if (wait_key_press())
|
||||||
button = rb->button_get(true);
|
return true;
|
||||||
if ( rb->default_event_handler( button ) == SYS_USB_CONNECTED )
|
|
||||||
return true;
|
|
||||||
} while( ( button == BUTTON_NONE )
|
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|
||||||
rb->screens[SCREEN_MAIN]->clear_viewport();
|
rb->screens[SCREEN_MAIN]->clear_viewport();
|
||||||
}
|
}
|
||||||
/* no text formatting available */
|
/* no text formatting available */
|
||||||
|
@ -134,5 +141,10 @@ bool display_text(short words, char** text, struct style_text* style,
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
rb->lcd_set_drawmode(prev_drawmode);
|
rb->lcd_set_drawmode(prev_drawmode);
|
||||||
#endif
|
#endif
|
||||||
|
if (wait_key)
|
||||||
|
{
|
||||||
|
if (wait_key_press())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,16 +19,20 @@
|
||||||
* KIND, either express or implied.
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#ifndef _DISPLAY_TEXT_H
|
||||||
|
#define _DISPLAY_TEXT_H
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* basic usage:
|
* basic usage:
|
||||||
* #define WORDS (sizeof text / sizeof (char*))
|
|
||||||
* char *text[] = {"normal", "centering", "red,underline"};
|
* char *text[] = {"normal", "centering", "red,underline"};
|
||||||
* struct style_text formation[]={
|
* struct style_text formation[]={
|
||||||
* { 1, TEXT_CENTER },
|
* { 1, TEXT_CENTER },
|
||||||
* { 2, C_RED|TEXT_UNDERLINE },
|
* { 2, C_RED|TEXT_UNDERLINE },
|
||||||
|
* LAST_STYLE_ITEM
|
||||||
* };
|
* };
|
||||||
* if (display_text(WORDS, text, formation, NULL))
|
* if (display_text(ARRAYLEN(text), text, formation, NULL, true))
|
||||||
* return PLUGIN_USB_CONNECTED;
|
* return PLUGIN_USB_CONNECTED;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -36,13 +40,23 @@ enum ecolor { STANDARD, C_YELLOW, C_RED, C_BLUE, C_GREEN , C_ORANGE };
|
||||||
#define TEXT_COLOR_MASK 0x00ff
|
#define TEXT_COLOR_MASK 0x00ff
|
||||||
#define TEXT_CENTER 0x0100
|
#define TEXT_CENTER 0x0100
|
||||||
#define TEXT_UNDERLINE 0x0200
|
#define TEXT_UNDERLINE 0x0200
|
||||||
|
#define LAST_STYLE_ITEM { -1, 0 }
|
||||||
|
|
||||||
struct style_text {
|
struct style_text {
|
||||||
unsigned short index;
|
unsigned short index;
|
||||||
unsigned short flags;
|
unsigned short flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* style and vp_text are optional.
|
/*
|
||||||
* return true if usb is connected. */
|
* display text.
|
||||||
bool display_text(short words, char** text, struct style_text* style,
|
* - words : number of words in text.
|
||||||
struct viewport* vp_text);
|
* - text : array of word to be displayed. use empty string for newline.
|
||||||
|
* - style : (optional) set style of each word. must be sorted by index.
|
||||||
|
* - vp_text : (optional) viewport to display text.
|
||||||
|
* - wait_key : set true to wait button press after all words is displayed.
|
||||||
|
* return true if usb is connected, false otherwise.
|
||||||
|
*/
|
||||||
|
bool display_text(unsigned short words, char** text, struct style_text* style,
|
||||||
|
struct viewport* vp_text, bool wait_key);
|
||||||
|
|
||||||
|
#endif /* _DISPLAY_TEXT_H */
|
||||||
|
|
|
@ -970,8 +970,6 @@ static void pegbox_move_player(struct game_context* pb, signed int x_dir,
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static bool pegbox_help(void)
|
static bool pegbox_help(void)
|
||||||
{
|
{
|
||||||
int button;
|
|
||||||
#define WORDS (sizeof help_text / sizeof (char*))
|
|
||||||
static char* help_text[] = {
|
static char* help_text[] = {
|
||||||
"Pegbox", "", "Aim", "",
|
"Pegbox", "", "Aim", "",
|
||||||
"To", "beat", "each", "level,", "you", "must", "destroy", "all", "of",
|
"To", "beat", "each", "level,", "you", "must", "destroy", "all", "of",
|
||||||
|
@ -990,20 +988,14 @@ static bool pegbox_help(void)
|
||||||
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
||||||
{ 2, C_RED },
|
{ 2, C_RED },
|
||||||
{ 46, C_RED },
|
{ 46, C_RED },
|
||||||
{ -1, 0 }
|
LAST_STYLE_ITEM
|
||||||
};
|
};
|
||||||
|
|
||||||
rb->lcd_setfont(FONT_UI);
|
rb->lcd_setfont(FONT_UI);
|
||||||
|
if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true))
|
||||||
if (display_text(WORDS, help_text, formation, NULL))
|
|
||||||
return true;
|
return true;
|
||||||
do {
|
|
||||||
button = rb->button_get(true);
|
|
||||||
if ( rb->default_event_handler( button ) == SYS_USB_CONNECTED )
|
|
||||||
return true;
|
|
||||||
} while( ( button == BUTTON_NONE )
|
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -863,7 +863,6 @@ static void play_animation(int input)
|
||||||
|
|
||||||
static void instructions()
|
static void instructions()
|
||||||
{
|
{
|
||||||
#define WORDS (sizeof help_text / sizeof (char*))
|
|
||||||
static char* help_text[] = {
|
static char* help_text[] = {
|
||||||
#if 0
|
#if 0
|
||||||
/* Not sure if we want to include this? */
|
/* Not sure if we want to include this? */
|
||||||
|
@ -879,7 +878,7 @@ static void instructions()
|
||||||
"The", "game", "ends", "when", "robotfindskitten.", "", "",
|
"The", "game", "ends", "when", "robotfindskitten.", "", "",
|
||||||
"Press", "any", "key", "to", "start",
|
"Press", "any", "key", "to", "start",
|
||||||
};
|
};
|
||||||
display_text(WORDS, help_text, NULL, NULL);
|
display_text(ARRAYLEN(help_text), help_text, NULL, NULL, false);
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1218,20 +1218,20 @@ static void move_down (void)
|
||||||
|
|
||||||
static bool rockblox_help(void)
|
static bool rockblox_help(void)
|
||||||
{
|
{
|
||||||
int button;
|
static char *help_text[] = {
|
||||||
|
"Rockblox", "", "Aim", "",
|
||||||
#define WORDS (sizeof help_text / sizeof (char*))
|
"Make", "the", "falling", "blocks", "of",
|
||||||
char *help_text[] = {
|
"different", "shapes", "form", "full", "rows.",
|
||||||
"Rockblox", "", "Aim", "", "Make", "the", "falling", "blocks", "of", "different",
|
"Whenever", "a", "row", "is", "completed,",
|
||||||
"shapes", "form", "full", "rows.", "Whenever", "a", "row", "is", "completed,", "it",
|
"it", "will", "be", "cleared", "away",
|
||||||
"will", "be", "cleared", "away", "and", "you", "gain", "points."
|
"and", "you", "gain", "points."
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct style_text formation[]={
|
static struct style_text formation[]={
|
||||||
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
||||||
{ 2, C_RED },
|
{ 2, C_RED },
|
||||||
{ -1, 0 }
|
LAST_STYLE_ITEM
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
rb->lcd_setfont(FONT_UI);
|
rb->lcd_setfont(FONT_UI);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1239,17 +1239,12 @@ static bool rockblox_help(void)
|
||||||
rb->lcd_set_background(LCD_BLACK);
|
rb->lcd_set_background(LCD_BLACK);
|
||||||
rb->lcd_set_foreground(LCD_WHITE);
|
rb->lcd_set_foreground(LCD_WHITE);
|
||||||
#endif
|
#endif
|
||||||
if (display_text(WORDS, help_text, formation, NULL))
|
if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true))
|
||||||
return true;
|
return true;
|
||||||
do {
|
|
||||||
button = rb->button_get(true);
|
|
||||||
if ( rb->default_event_handler( button ) == SYS_USB_CONNECTED )
|
|
||||||
return true;
|
|
||||||
} while( ( button == BUTTON_NONE )
|
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -686,8 +686,6 @@ static void draw_empty_stack( int s, int x, int y, bool cursor )
|
||||||
/* Help */
|
/* Help */
|
||||||
static bool solitaire_help( void )
|
static bool solitaire_help( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
#define WORDS (sizeof help_text / sizeof (char*))
|
|
||||||
static char* help_text[] = {
|
static char* help_text[] = {
|
||||||
"Solitaire", "", "Controls", "",
|
"Solitaire", "", "Controls", "",
|
||||||
HK_LR ":", "Move", "the", "cursor", "to", "the",
|
HK_LR ":", "Move", "the", "cursor", "to", "the",
|
||||||
|
@ -711,29 +709,10 @@ static bool solitaire_help( void )
|
||||||
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
||||||
{ 2, C_RED },
|
{ 2, C_RED },
|
||||||
{ 48, C_RED },
|
{ 48, C_RED },
|
||||||
{ -1, 0 }
|
LAST_STYLE_ITEM
|
||||||
};
|
};
|
||||||
#if LCD_DEPTH > 1
|
if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true))
|
||||||
fb_data* backdrop = rb->lcd_get_backdrop();
|
|
||||||
rb->lcd_set_backdrop(NULL);
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
|
||||||
rb->lcd_set_background(LCD_BLACK);
|
|
||||||
rb->lcd_set_foreground(LCD_WHITE);
|
|
||||||
#endif
|
|
||||||
int button;
|
|
||||||
if (display_text(WORDS, help_text, formation, NULL))
|
|
||||||
return true;
|
return true;
|
||||||
do {
|
|
||||||
button = rb->button_get(true);
|
|
||||||
if ( rb->default_event_handler( button ) == SYS_USB_CONNECTED )
|
|
||||||
return true;
|
|
||||||
} while( ( button == BUTTON_NONE )
|
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|
||||||
|
|
||||||
#if LCD_DEPTH > 1
|
|
||||||
rb->lcd_set_backdrop(backdrop);
|
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1745,31 +1745,22 @@ static void initialise_game(void)
|
||||||
static bool spacerocks_help(void)
|
static bool spacerocks_help(void)
|
||||||
{
|
{
|
||||||
static char *help_text[] = {
|
static char *help_text[] = {
|
||||||
"Spacerocks", "", "Aim", "", "The", "goal", "of", "the", "game", "is",
|
"Spacerocks", "", "Aim", "",
|
||||||
"to", "blow", "up", "the", "asteroids", "and", "avoid", "being", "hit", "by",
|
"The", "goal", "of", "the", "game", "is", "to", "blow", "up",
|
||||||
"them.", "Also", "you'd", "better", "watch", "out", "for", "the", "UFOs!"
|
"the", "asteroids", "and", "avoid", "being", "hit", "by", "them.",
|
||||||
|
"Also", "you'd", "better", "watch", "out", "for", "the", "UFOs!"
|
||||||
};
|
};
|
||||||
static struct style_text formation[]={
|
static struct style_text formation[]={
|
||||||
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
||||||
{ 2, C_RED },
|
{ 2, C_RED },
|
||||||
{ -1, 0 }
|
LAST_STYLE_ITEM
|
||||||
};
|
};
|
||||||
int button;
|
|
||||||
|
|
||||||
rb->lcd_setfont(FONT_UI);
|
rb->lcd_setfont(FONT_UI);
|
||||||
#ifdef HAVE_LCD_COLOR
|
SET_BG(LCD_BLACK);
|
||||||
rb->lcd_set_background(LCD_BLACK);
|
SET_FG(LCD_WHITE);
|
||||||
rb->lcd_set_foreground(LCD_WHITE);
|
if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true))
|
||||||
#endif
|
|
||||||
if (display_text(ARRAYLEN(help_text), help_text, formation, NULL)
|
|
||||||
== PLUGIN_USB_CONNECTED)
|
|
||||||
return true;
|
return true;
|
||||||
do {
|
|
||||||
button = rb->button_get(true);
|
|
||||||
if (button == SYS_USB_CONNECTED)
|
|
||||||
return true;
|
|
||||||
} while( ( button == BUTTON_NONE )
|
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1051,8 +1051,6 @@ static int star_run_game(int current_level)
|
||||||
*/
|
*/
|
||||||
static bool star_help(void)
|
static bool star_help(void)
|
||||||
{
|
{
|
||||||
int button;
|
|
||||||
#define WORDS (sizeof help_text / sizeof (char*))
|
|
||||||
static char* help_text[] = {
|
static char* help_text[] = {
|
||||||
"Star", "", "Aim", "",
|
"Star", "", "Aim", "",
|
||||||
"Take", "all", "the", "stars", "to", "go", "to", "the", "next", "level.",
|
"Take", "all", "the", "stars", "to", "go", "to", "the", "next", "level.",
|
||||||
|
@ -1070,27 +1068,17 @@ static bool star_help(void)
|
||||||
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
{ 0, TEXT_CENTER|TEXT_UNDERLINE },
|
||||||
{ 2, C_RED },
|
{ 2, C_RED },
|
||||||
{ 35, C_RED },
|
{ 35, C_RED },
|
||||||
{ -1, 0 }
|
LAST_STYLE_ITEM
|
||||||
};
|
};
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1 && !defined(HAVE_LCD_COLOR)
|
||||||
#ifndef HAVE_LCD_COLOR
|
rb->lcd_set_background(LCD_WHITE);
|
||||||
rb->lcd_set_background(LCD_WHITE );
|
rb->lcd_set_foreground(LCD_BLACK);
|
||||||
rb->lcd_set_foreground(LCD_BLACK );
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true))
|
||||||
if (display_text(WORDS, help_text, formation, NULL))
|
|
||||||
return true;
|
return true;
|
||||||
do {
|
#if LCD_DEPTH > 1 && !defined(HAVE_LCD_COLOR)
|
||||||
button = rb->button_get(true);
|
rb->lcd_set_background(LCD_BLACK);
|
||||||
if ( rb->default_event_handler( button ) == SYS_USB_CONNECTED )
|
rb->lcd_set_foreground(LCD_WHITE);
|
||||||
return true;
|
|
||||||
} while( ( button == BUTTON_NONE )
|
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|
||||||
#if LCD_DEPTH > 1
|
|
||||||
#ifndef HAVE_LCD_COLOR
|
|
||||||
rb->lcd_set_background(LCD_BLACK );
|
|
||||||
rb->lcd_set_foreground(LCD_WHITE );
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -566,7 +566,6 @@ int settings_menu(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int superdom_help(void) {
|
static int superdom_help(void) {
|
||||||
int button;
|
|
||||||
static char* help_text[] = {
|
static char* help_text[] = {
|
||||||
"Super", "domination", "is", "a", "turn", "based", "strategy", "game,",
|
"Super", "domination", "is", "a", "turn", "based", "strategy", "game,",
|
||||||
"where", "the", "aim", "is", "to", "overpower", "the", "computer",
|
"where", "the", "aim", "is", "to", "overpower", "the", "computer",
|
||||||
|
@ -580,15 +579,8 @@ static int superdom_help(void) {
|
||||||
"and", "number", "of", "troops", "on", "them.",
|
"and", "number", "of", "troops", "on", "them.",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (display_text(ARRAYLEN(help_text), help_text, NULL, NULL))
|
if (display_text(ARRAYLEN(help_text), help_text, NULL, NULL, true))
|
||||||
return RET_VAL_USB;
|
return RET_VAL_USB;
|
||||||
do {
|
|
||||||
button = rb->button_get(true);
|
|
||||||
if ( rb->default_event_handler( button ) == SYS_USB_CONNECTED )
|
|
||||||
return RET_VAL_USB;
|
|
||||||
} while( ( button == BUTTON_NONE )
|
|
||||||
|| ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
|
|
||||||
|
|
||||||
return RET_VAL_OK;
|
return RET_VAL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue