Setup menu cleanups (removed warnings, added a 'quit' button)
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1865 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -61,6 +61,7 @@ Widget_DrawToolTips (int numlines, const char **tips)
|
||||
|
||||
t.align = ALIGN_CENTER;
|
||||
t.valign = VALIGN_BOTTOM;
|
||||
t.CharCount = ~0;
|
||||
t.baseline.x = r.corner.x + (r.extent.width >> 1);
|
||||
t.baseline.y = r.corner.y + (r.extent.height - 8 - 8 * numlines);
|
||||
|
||||
@@ -134,6 +135,9 @@ Widget_DrawMenuScreen (WIDGET *_self, int x, int y)
|
||||
SetContextFontEffect (oldFontEffect.type, oldFontEffect.from, oldFontEffect.to);
|
||||
SetContextFont (oldfont);
|
||||
SetContextForeGroundColor (oldtext);
|
||||
|
||||
(void) x;
|
||||
(void) y;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -155,6 +159,7 @@ Widget_DrawChoice (WIDGET *_self, int x, int y)
|
||||
t.baseline.y = y;
|
||||
t.align = ALIGN_LEFT;
|
||||
t.valign = VALIGN_BOTTOM;
|
||||
t.CharCount = ~0;
|
||||
t.pStr = self->category;
|
||||
if (widget_focus == _self)
|
||||
{
|
||||
@@ -204,7 +209,6 @@ Widget_DrawButton (WIDGET *_self, int x, int y)
|
||||
FONT oldfont = SetContextFont (StarConFont);
|
||||
FONTEFFECT oldFontEffect = SetContextFontEffect (0, 0, 0);
|
||||
TEXT t;
|
||||
int i, home_x, home_y;
|
||||
|
||||
selected = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x00), 0x0E);
|
||||
inactive = BUILD_COLOR (MAKE_RGB15 (0x18, 0x18, 0x1F), 0x07);
|
||||
@@ -213,12 +217,12 @@ Widget_DrawButton (WIDGET *_self, int x, int y)
|
||||
t.baseline.y = y;
|
||||
t.align = ALIGN_CENTER;
|
||||
t.valign = VALIGN_BOTTOM;
|
||||
t.CharCount = ~0;
|
||||
t.pStr = self->name;
|
||||
if (widget_focus == _self)
|
||||
{
|
||||
Widget_DrawToolTips (3, self->tooltip);
|
||||
oldtext = SetContextForeGroundColor (selected);
|
||||
Widget_DrawToolTips (3, self->tooltip);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -228,6 +232,7 @@ Widget_DrawButton (WIDGET *_self, int x, int y)
|
||||
SetContextFontEffect (oldFontEffect.type, oldFontEffect.from, oldFontEffect.to);
|
||||
SetContextFont (oldfont);
|
||||
SetContextForeGroundColor (oldtext);
|
||||
(void) x;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -239,17 +244,20 @@ Widget_HeightChoice (WIDGET *_self)
|
||||
int
|
||||
Widget_HeightFullScreen (WIDGET *_self)
|
||||
{
|
||||
(void)_self;
|
||||
return SCREEN_HEIGHT;
|
||||
}
|
||||
|
||||
int
|
||||
Widget_HeightOneLine (WIDGET *_self)
|
||||
{
|
||||
(void)_self;
|
||||
return 8;
|
||||
}
|
||||
|
||||
int Widget_WidthFullScreen (WIDGET *_self)
|
||||
{
|
||||
(void)_self;
|
||||
return SCREEN_WIDTH;
|
||||
}
|
||||
|
||||
@@ -257,6 +265,7 @@ int
|
||||
Widget_ReceiveFocusButton (WIDGET *_self, int event)
|
||||
{
|
||||
widget_focus = _self;
|
||||
(void)event;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -266,6 +275,7 @@ Widget_ReceiveFocusChoice (WIDGET *_self, int event)
|
||||
WIDGET_CHOICE *self = (WIDGET_CHOICE *)_self;
|
||||
widget_focus = _self;
|
||||
self->highlighted = self->selected;
|
||||
(void)event;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -305,6 +315,8 @@ Widget_ReceiveFocusMenuScreen (WIDGET *_self, int event)
|
||||
int
|
||||
Widget_HandleEventIgnoreAll (WIDGET *self, int event)
|
||||
{
|
||||
(void)event;
|
||||
(void)self;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,19 @@ typedef struct setup_menu_state {
|
||||
typedef SETUP_MENU_STATE *PSETUP_MENU_STATE;
|
||||
|
||||
static BOOLEAN DoSetupMenu (PSETUP_MENU_STATE pInputState);
|
||||
static BOOLEAN done;
|
||||
|
||||
static int
|
||||
quit_main_menu (WIDGET *self, int event)
|
||||
{
|
||||
if (event == WIDGET_EVENT_SELECT)
|
||||
{
|
||||
done = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
(void)self;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static CHOICE_OPTION scaler_opts[] = {
|
||||
{ "None",
|
||||
@@ -230,6 +243,11 @@ static WIDGET_CHOICE cmdline_opts[] = {
|
||||
{ CHOICE_PREFACE, "Scroll Style", 2, scroll_opts, 0, 0 },
|
||||
{ CHOICE_PREFACE, "Subtitles", 2, subtitles_opts, 0, 0 } };
|
||||
|
||||
static WIDGET_BUTTON quit_button = {
|
||||
NULL, quit_main_menu, Widget_ReceiveFocusButton, Widget_DrawButton,
|
||||
Widget_HeightOneLine, Widget_WidthFullScreen,
|
||||
"Quit Setup Menu", {"Return to the main menu.", "", ""} };
|
||||
|
||||
static WIDGET *opt_widgets[] = {
|
||||
(WIDGET *)(&cmdline_opts[0]),
|
||||
(WIDGET *)(&cmdline_opts[1]),
|
||||
@@ -239,17 +257,16 @@ static WIDGET *opt_widgets[] = {
|
||||
(WIDGET *)(&cmdline_opts[5]),
|
||||
(WIDGET *)(&cmdline_opts[6]),
|
||||
(WIDGET *)(&cmdline_opts[7]),
|
||||
(WIDGET *)(&cmdline_opts[8]) } ;
|
||||
(WIDGET *)(&cmdline_opts[8]),
|
||||
(WIDGET *)(&quit_button) } ;
|
||||
|
||||
static WIDGET_MENU_SCREEN menu = {
|
||||
NULL, Widget_HandleEventMenuScreen, Widget_ReceiveFocusMenuScreen,
|
||||
Widget_DrawMenuScreen, Widget_HeightFullScreen, Widget_WidthFullScreen,
|
||||
// "Ur-Quan Masters Setup",
|
||||
// "Graphics Options",
|
||||
"Use arrows and fire to select options",
|
||||
"Press cancel when done",
|
||||
"Ur-Quan Masters Setup",
|
||||
"",
|
||||
{ {0, 0}, NULL },
|
||||
9, opt_widgets,
|
||||
10, opt_widgets,
|
||||
0 };
|
||||
|
||||
#define NUM_STEPS 20
|
||||
@@ -350,7 +367,7 @@ DoSetupMenu (PSETUP_MENU_STATE pInputState)
|
||||
SleepThreadUntil (pInputState->NextTime + MENU_FRAME_RATE);
|
||||
pInputState->NextTime = GetTimeCounter ();
|
||||
return !((GLOBAL (CurrentActivity) & CHECK_ABORT) ||
|
||||
PulsedInputState.key[KEY_MENU_CANCEL]);
|
||||
PulsedInputState.key[KEY_MENU_CANCEL] || done);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -361,6 +378,7 @@ SetupMenu (void)
|
||||
s.InputFunc = DoSetupMenu;
|
||||
s.initialized = FALSE;
|
||||
SetMenuSounds (0, MENU_SOUND_SELECT);
|
||||
done = FALSE;
|
||||
DoInput ((PVOID)&s, TRUE);
|
||||
GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
|
||||
PropagateResults ();
|
||||
|
||||
Reference in New Issue
Block a user