mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-23 01:21:57 -05:00
Fix cursor being visible at wrong time
And gen/save menus show up properly now
This commit is contained in:
parent
22dea901ee
commit
5934c3618b
3 changed files with 33 additions and 16 deletions
25
src/Gui.c
25
src/Gui.c
|
@ -227,7 +227,7 @@ int Gui_Index(struct Screen* s) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
void Gui_Add(struct Screen* s, int priority) {
|
||||
static void Gui_AddCore(struct Screen* s, int priority) {
|
||||
int i, j;
|
||||
if (Gui_ScreensCount >= GUI_MAX_SCREENS) Logger_Abort("Hit max screens");
|
||||
|
||||
|
@ -252,7 +252,7 @@ void Gui_Add(struct Screen* s, int priority) {
|
|||
s->VTABLE->HandlesMouseMove(s, Mouse_X, Mouse_Y);
|
||||
}
|
||||
|
||||
void Gui_Remove(struct Screen* s) {
|
||||
static void Gui_RemoveCore(struct Screen* s) {
|
||||
int i = Gui_Index(s);
|
||||
if (i == -1) return;
|
||||
|
||||
|
@ -266,9 +266,26 @@ void Gui_Remove(struct Screen* s) {
|
|||
s->VTABLE->Free(s);
|
||||
}
|
||||
|
||||
void Gui_Add(struct Screen* s, int priority) {
|
||||
Gui_AddCore(s, priority);
|
||||
Camera_CheckFocus();
|
||||
}
|
||||
|
||||
void Gui_Remove(struct Screen* s) {
|
||||
Gui_RemoveCore(s);
|
||||
Camera_CheckFocus();
|
||||
}
|
||||
|
||||
void Gui_Replace(struct Screen* s, int priority) {
|
||||
Gui_Remove(s);
|
||||
Gui_Add(s, priority);
|
||||
int i;
|
||||
Gui_RemoveCore(s);
|
||||
/* Backwards loop since removing changes count and gui_screens */
|
||||
for (i = Gui_ScreensCount - 1; i >= 0; i--) {
|
||||
if (priorities[i] == priority) Gui_RemoveCore(Gui_Screens[i]);
|
||||
}
|
||||
|
||||
Gui_AddCore(s, priority);
|
||||
Camera_CheckFocus();
|
||||
}
|
||||
|
||||
struct Screen* Gui_GetInputGrab(void) {
|
||||
|
|
18
src/Menus.c
18
src/Menus.c
|
@ -316,10 +316,10 @@ static void Menu_SwitchHacks(void* a, void* b) { Menu_ReplaceActive(HacksSet
|
|||
static void Menu_SwitchEnv(void* a, void* b) { Menu_ReplaceActive(EnvSettingsScreen_MakeInstance()); }
|
||||
static void Menu_SwitchNostalgia(void* a, void* b) { Menu_ReplaceActive(NostalgiaScreen_MakeInstance()); }
|
||||
|
||||
static void Menu_SwitchGenLevel(void* a, void* b) { Menu_ReplaceActive(GenLevelScreen_MakeInstance()); }
|
||||
static void Menu_SwitchClassicGenLevel(void* a, void* b) { Menu_ReplaceActive(ClassicGenScreen_MakeInstance()); }
|
||||
static void Menu_SwitchGenLevel(void* a, void* b) { GenLevelScreen_Show(); }
|
||||
static void Menu_SwitchClassicGenLevel(void* a, void* b) { ClassicGenScreen_Show(); }
|
||||
static void Menu_SwitchLoadLevel(void* a, void* b) { LoadLevelScreen_Show(); }
|
||||
static void Menu_SwitchSaveLevel(void* a, void* b) { Menu_ReplaceActive(SaveLevelScreen_MakeInstance()); }
|
||||
static void Menu_SwitchSaveLevel(void* a, void* b) { SaveLevelScreen_Show(); }
|
||||
static void Menu_SwitchTexPacks(void* a, void* b) { TexturePackScreen_Show(); }
|
||||
static void Menu_SwitchHotkeys(void* a, void* b) { HotkeyListScreen_Show(); }
|
||||
static void Menu_SwitchFont(void* a, void* b) { FontListScreen_Show(); }
|
||||
|
@ -1135,7 +1135,7 @@ static struct ScreenVTABLE GenLevelScreen_VTABLE = {
|
|||
Menu_MouseDown, Menu_MouseUp, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, GenLevelScreen_ContextRecreated,
|
||||
};
|
||||
struct Screen* GenLevelScreen_MakeInstance(void) {
|
||||
void GenLevelScreen_Show(void) {
|
||||
static struct Widget* widgets[12];
|
||||
struct GenLevelScreen* s = &GenLevelScreen_Instance;
|
||||
|
||||
|
@ -1145,7 +1145,7 @@ struct Screen* GenLevelScreen_MakeInstance(void) {
|
|||
s->widgetsCount = Array_Elems(widgets);
|
||||
|
||||
s->VTABLE = &GenLevelScreen_VTABLE;
|
||||
return (struct Screen*)s;
|
||||
Gui_Replace((struct Screen*)s, GUI_PRIORITY_MENU);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1186,7 +1186,7 @@ static struct ScreenVTABLE ClassicGenScreen_VTABLE = {
|
|||
Menu_MouseDown, Menu_MouseUp, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, ClassicGenScreen_ContextRecreated,
|
||||
};
|
||||
struct Screen* ClassicGenScreen_MakeInstance(void) {
|
||||
void ClassicGenScreen_Show(void) {
|
||||
static struct Widget* widgets[4];
|
||||
struct ClassicGenScreen* s = &ClassicGenScreen_Instance;
|
||||
|
||||
|
@ -1196,7 +1196,7 @@ struct Screen* ClassicGenScreen_MakeInstance(void) {
|
|||
s->widgetsCount = Array_Elems(widgets);
|
||||
|
||||
s->VTABLE = &ClassicGenScreen_VTABLE;
|
||||
return (struct Screen*)s;
|
||||
Gui_Replace((struct Screen*)s, GUI_PRIORITY_MENU);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1343,7 +1343,7 @@ static struct ScreenVTABLE SaveLevelScreen_VTABLE = {
|
|||
Menu_MouseDown, Menu_MouseUp, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, SaveLevelScreen_ContextRecreated,
|
||||
};
|
||||
struct Screen* SaveLevelScreen_MakeInstance(void) {
|
||||
void SaveLevelScreen_Show(void) {
|
||||
static struct Widget* widgets[6];
|
||||
struct SaveLevelScreen* s = &SaveLevelScreen_Instance;
|
||||
|
||||
|
@ -1353,7 +1353,7 @@ struct Screen* SaveLevelScreen_MakeInstance(void) {
|
|||
s->widgetsCount = Array_Elems(widgets);
|
||||
|
||||
s->VTABLE = &SaveLevelScreen_VTABLE;
|
||||
return (struct Screen*)s;
|
||||
Gui_Replace((struct Screen*)s, GUI_PRIORITY_MENU);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ struct Screen* HacksKeyBindingsScreen_MakeInstance(void);
|
|||
struct Screen* OtherKeyBindingsScreen_MakeInstance(void);
|
||||
struct Screen* MouseKeyBindingsScreen_MakeInstance(void);
|
||||
|
||||
struct Screen* GenLevelScreen_MakeInstance(void);
|
||||
struct Screen* ClassicGenScreen_MakeInstance(void);
|
||||
void GenLevelScreen_Show(void);
|
||||
void ClassicGenScreen_Show(void);
|
||||
void LoadLevelScreen_Show(void);
|
||||
struct Screen* SaveLevelScreen_MakeInstance(void);
|
||||
void SaveLevelScreen_Show(void);
|
||||
void TexturePackScreen_Show(void);
|
||||
void FontListScreen_Show(void);
|
||||
void HotkeyListScreen_Show(void);
|
||||
|
|
Loading…
Reference in a new issue