mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
Fix disconnect screen not disappearing when you click Reconnect
This commit is contained in:
parent
5febbe41d0
commit
f9bf1029fa
@ -70,6 +70,11 @@ bool Gui_Contains(int recX, int recY, int width, int height, int x, int y) {
|
|||||||
return x >= recX && y >= recY && x < (recX + width) && y < (recY + height);
|
return x >= recX && y >= recY && x < (recX + width) && y < (recY + height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Gui_ShowDefault(void) {
|
||||||
|
StatusScreen_Show();
|
||||||
|
HUDScreen_Show();
|
||||||
|
}
|
||||||
|
|
||||||
static void Gui_ContextLost(void* obj) {
|
static void Gui_ContextLost(void* obj) {
|
||||||
struct Screen* s;
|
struct Screen* s;
|
||||||
int i;
|
int i;
|
||||||
@ -120,9 +125,7 @@ static void Gui_Init(void) {
|
|||||||
Event_RegisterVoid(&GfxEvents.ContextLost, NULL, Gui_ContextLost);
|
Event_RegisterVoid(&GfxEvents.ContextLost, NULL, Gui_ContextLost);
|
||||||
Event_RegisterVoid(&GfxEvents.ContextRecreated, NULL, Gui_ContextRecreated);
|
Event_RegisterVoid(&GfxEvents.ContextRecreated, NULL, Gui_ContextRecreated);
|
||||||
Gui_LoadOptions();
|
Gui_LoadOptions();
|
||||||
|
Gui_ShowDefault();
|
||||||
StatusScreen_Show();
|
|
||||||
HUDScreen_Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Gui_Reset(void) {
|
static void Gui_Reset(void) {
|
||||||
|
@ -115,6 +115,8 @@ extern int Gui_ScreensCount;
|
|||||||
int Gui_CalcPos(uint8_t anchor, int offset, int size, int axisLen);
|
int Gui_CalcPos(uint8_t anchor, int offset, int size, int axisLen);
|
||||||
/* Returns whether the given rectangle contains the given point. */
|
/* Returns whether the given rectangle contains the given point. */
|
||||||
bool Gui_Contains(int recX, int recY, int width, int height, int x, int y);
|
bool Gui_Contains(int recX, int recY, int width, int height, int x, int y);
|
||||||
|
/* Shows HUD and Status screens. */
|
||||||
|
void Gui_ShowDefault(void);
|
||||||
|
|
||||||
/* Returns index of the given screen in the screens list, -1 if not */
|
/* Returns index of the given screen in the screens list, -1 if not */
|
||||||
int Gui_Index(struct Screen* screen);
|
int Gui_Index(struct Screen* screen);
|
||||||
|
@ -2885,12 +2885,9 @@ static bool TexIdsOverlay_KeyDown(void* screen, Key key) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool TexIdsOverlay_KeyPress(void* screen, char keyChar) { return false; }
|
|
||||||
static bool TexIdsOverlay_KeyUp(void* screen, Key key) { return false; }
|
|
||||||
|
|
||||||
static const struct ScreenVTABLE TexIdsOverlay_VTABLE = {
|
static const struct ScreenVTABLE TexIdsOverlay_VTABLE = {
|
||||||
TexIdsOverlay_Init, TexIdsOverlay_Render, MenuScreen_Free,
|
TexIdsOverlay_Init, TexIdsOverlay_Render, MenuScreen_Free,
|
||||||
TexIdsOverlay_KeyDown, TexIdsOverlay_KeyUp, TexIdsOverlay_KeyPress,
|
TexIdsOverlay_KeyDown, Screen_FKey, Screen_FKeyPress,
|
||||||
Menu_MouseDown, Screen_TMouse, Menu_MouseMove, MenuScreen_MouseScroll,
|
Menu_MouseDown, Screen_TMouse, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||||
Menu_OnResize, TexIdsOverlay_ContextLost, TexIdsOverlay_ContextRecreated
|
Menu_OnResize, TexIdsOverlay_ContextLost, TexIdsOverlay_ContextRecreated
|
||||||
};
|
};
|
||||||
|
@ -1363,7 +1363,12 @@ static bool DisconnectScreen_MouseDown(void* screen, int x, int y, MouseButton b
|
|||||||
struct ButtonWidget* w = &s->reconnect;
|
struct ButtonWidget* w = &s->reconnect;
|
||||||
|
|
||||||
if (btn != MOUSE_LEFT) return true;
|
if (btn != MOUSE_LEFT) return true;
|
||||||
if (!w->disabled && Widget_Contains(w, x, y)) Server.BeginConnect();
|
|
||||||
|
if (!w->disabled && Widget_Contains(w, x, y)) {
|
||||||
|
Gui_Remove((struct Screen*)s);
|
||||||
|
Gui_ShowDefault();
|
||||||
|
Server.BeginConnect();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user