mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
Cleanup ExtHelp code
This commit is contained in:
parent
635c6fb4ec
commit
085b63532b
20
src/Menus.c
20
src/Menus.c
@ -2054,7 +2054,10 @@ CC_NOINLINE static void MenuOptionsScreen_FreeExtHelp(struct MenuOptionsScreen*
|
|||||||
s->extHelp.lines = 0;
|
s->extHelp.lines = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MenuOptionsScreen_RepositionExtHelp(struct MenuOptionsScreen* s) {
|
static void MenuOptionsScreen_LayoutExtHelp(struct MenuOptionsScreen* s) {
|
||||||
|
Widget_SetLocation(&s->extHelp, ANCHOR_MIN, ANCHOR_CENTRE_MIN, 0, 100);
|
||||||
|
/* If use centre align above, then each line in extended help gets */
|
||||||
|
/* centered aligned separately - which is not the desired behaviour. */
|
||||||
s->extHelp.xOffset = WindowInfo.Width / 2 - s->extHelp.width / 2;
|
s->extHelp.xOffset = WindowInfo.Width / 2 - s->extHelp.width / 2;
|
||||||
Widget_Layout(&s->extHelp);
|
Widget_Layout(&s->extHelp);
|
||||||
}
|
}
|
||||||
@ -2082,7 +2085,7 @@ static void MenuOptionsScreen_SelectExtHelp(struct MenuOptionsScreen* s, int idx
|
|||||||
|
|
||||||
s->extHelpDesc = desc;
|
s->extHelpDesc = desc;
|
||||||
TextGroupWidget_RedrawAll(&s->extHelp);
|
TextGroupWidget_RedrawAll(&s->extHelp);
|
||||||
MenuOptionsScreen_RepositionExtHelp(s);
|
MenuOptionsScreen_LayoutExtHelp(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MenuOptionsScreen_FreeInput(struct MenuOptionsScreen* s) {
|
static void MenuOptionsScreen_FreeInput(struct MenuOptionsScreen* s) {
|
||||||
@ -2168,10 +2171,6 @@ static void MenuOptionsScreen_InitButtons(struct MenuOptionsScreen* s, const str
|
|||||||
}
|
}
|
||||||
s->numButtons = count;
|
s->numButtons = count;
|
||||||
Menu_InitBack(&s->done, backClick);
|
Menu_InitBack(&s->done, backClick);
|
||||||
|
|
||||||
TextGroupWidget_Create(&s->extHelp, 5, s->extHelpTextures, MenuOptionsScreen_GetDesc);
|
|
||||||
s->extHelp.lines = 0;
|
|
||||||
Widget_SetLocation(&s->extHelp, ANCHOR_MIN, ANCHOR_CENTRE_MIN, 0, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MenuOptionsScreen_OK(void* screen, void* widget) {
|
static void MenuOptionsScreen_OK(void* screen, void* widget) {
|
||||||
@ -2257,14 +2256,17 @@ static void MenuOptionsScreen_Init(void* screen) {
|
|||||||
struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen;
|
struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
s->widgets = menuOpts_widgets;
|
s->widgets = menuOpts_widgets;
|
||||||
|
s->numWidgets = MENUOPTS_MAX_OPTS + 1; /* always have back button */
|
||||||
/* The various menu options screens might have different number of widgets */
|
/* The various menu options screens might have different number of widgets */
|
||||||
for (i = 0; i < MENUOPTS_MAX_OPTS; i++) { s->widgets[i] = NULL; }
|
for (i = 0; i < MENUOPTS_MAX_OPTS; i++) { s->widgets[i] = NULL; }
|
||||||
|
|
||||||
s->activeI = -1;
|
s->activeI = -1;
|
||||||
s->selectedI = -1;
|
s->selectedI = -1;
|
||||||
s->DoInit(s);
|
s->DoInit(s);
|
||||||
s->numWidgets = MENUOPTS_MAX_OPTS + 1; /* always have back button */
|
|
||||||
|
TextGroupWidget_Create(&s->extHelp, 5, s->extHelpTextures, MenuOptionsScreen_GetDesc);
|
||||||
|
s->extHelp.lines = 0;
|
||||||
Event_Register_(&UserEvents.HackPermissionsChanged, screen, MenuOptionsScreen_OnHacksChanged);
|
Event_Register_(&UserEvents.HackPermissionsChanged, screen, MenuOptionsScreen_OnHacksChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2296,7 +2298,7 @@ static void MenuOptionsScreen_Layout(void* screen) {
|
|||||||
struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen;
|
struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen;
|
||||||
Screen_Layout(s);
|
Screen_Layout(s);
|
||||||
Menu_LayoutBack(&s->done);
|
Menu_LayoutBack(&s->done);
|
||||||
MenuOptionsScreen_RepositionExtHelp(s);
|
MenuOptionsScreen_LayoutExtHelp(s);
|
||||||
|
|
||||||
if (s->activeI == -1) return;
|
if (s->activeI == -1) return;
|
||||||
Widget_SetLocation(&s->input, ANCHOR_CENTRE, ANCHOR_CENTRE, 0, 110);
|
Widget_SetLocation(&s->input, ANCHOR_CENTRE, ANCHOR_CENTRE, 0, 110);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user