mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Kill off GuiElem and Recreate method
This commit is contained in:
parent
5006716c4c
commit
26120c219a
@ -25,11 +25,6 @@ struct Screen* Gui_Screens[GUI_MAX_SCREENS];
|
||||
int Gui_ScreensCount, Gui_OverlaysCount;
|
||||
static uint8_t priorities[GUI_MAX_SCREENS];
|
||||
|
||||
void Gui_DefaultRecreate(void* elem) {
|
||||
struct GuiElem* e = (struct GuiElem*)elem;
|
||||
Elem_Free(e); Elem_Init(e);
|
||||
}
|
||||
|
||||
void Widget_SetLocation(void* widget, uint8_t horAnchor, uint8_t verAnchor, int xOffset, int yOffset) {
|
||||
struct Widget* w = (struct Widget*)widget;
|
||||
w->horAnchor = horAnchor; w->verAnchor = verAnchor;
|
||||
|
12
src/Gui.h
12
src/Gui.h
@ -39,7 +39,6 @@ extern bool Gui_ShowFPS;
|
||||
void (*Init)(void* elem); \
|
||||
void (*Render)(void* elem, double delta); \
|
||||
void (*Free)(void* elem); \
|
||||
void (*Recreate)(void* elem); \
|
||||
bool (*HandlesKeyDown)(void* elem, Key key); \
|
||||
bool (*HandlesKeyUp)(void* elem, Key key); \
|
||||
bool (*HandlesKeyPress)(void* elem, char keyChar); \
|
||||
@ -48,10 +47,6 @@ extern bool Gui_ShowFPS;
|
||||
bool (*HandlesMouseMove)(void* elem, int x, int y); \
|
||||
bool (*HandlesMouseScroll)(void* elem, float delta);
|
||||
|
||||
struct GuiElemVTABLE { GuiElemVTABLE_Layout() };
|
||||
struct GuiElem { struct GuiElemVTABLE* VTABLE; };
|
||||
void Gui_DefaultRecreate(void* elem);
|
||||
|
||||
struct ScreenVTABLE {
|
||||
GuiElemVTABLE_Layout()
|
||||
void (*OnResize)(void* elem);
|
||||
@ -179,10 +174,9 @@ void TextAtlas_Add(struct TextAtlas* atlas, int charI, VertexP3fT2fC4b** vertice
|
||||
void TextAtlas_AddInt(struct TextAtlas* atlas, int value, VertexP3fT2fC4b** vertices);
|
||||
|
||||
|
||||
#define Elem_Init(elem) (elem)->VTABLE->Init(elem)
|
||||
#define Elem_Render(elem, delta) (elem)->VTABLE->Render(elem, delta)
|
||||
#define Elem_Free(elem) (elem)->VTABLE->Free(elem)
|
||||
#define Elem_Recreate(elem) (elem)->VTABLE->Recreate(elem)
|
||||
#define Elem_Init(elem) (elem)->VTABLE->Init(elem)
|
||||
#define Elem_Render(elem, delta) (elem)->VTABLE->Render(elem, delta)
|
||||
#define Elem_Free(elem) (elem)->VTABLE->Free(elem)
|
||||
#define Elem_HandlesKeyPress(elem, key) (elem)->VTABLE->HandlesKeyPress(elem, key)
|
||||
#define Elem_HandlesKeyDown(elem, key) (elem)->VTABLE->HandlesKeyDown(elem, key)
|
||||
#define Elem_HandlesKeyUp(elem, key) (elem)->VTABLE->HandlesKeyUp(elem, key)
|
||||
|
68
src/Menus.c
68
src/Menus.c
@ -348,6 +348,12 @@ static void ListScreen_QuickSort(int left, int right) {
|
||||
}
|
||||
}
|
||||
|
||||
CC_NOINLINE static void ListScreen_Sort(struct ListScreen* s) {
|
||||
if (s->entries.count) {
|
||||
ListScreen_QuickSort(0, s->entries.count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
static String ListScreen_UNSAFE_GetCur(struct ListScreen* s, void* widget) {
|
||||
int i = Menu_Index(s, widget);
|
||||
return ListScreen_UNSAFE_Get(s, s->currentIndex + i);
|
||||
@ -446,10 +452,10 @@ static void ListScreen_ContextRecreated(void* screen) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE ListScreen_VTABLE = {
|
||||
ListScreen_Init, ListScreen_Render, ListScreen_Free, Gui_DefaultRecreate,
|
||||
ListScreen_Init, ListScreen_Render, ListScreen_Free,
|
||||
ListScreen_KeyDown, Menu_KeyUp, Menu_KeyPress,
|
||||
Menu_MouseDown, Menu_MouseUp, Menu_MouseMove, ListScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, ListScreen_ContextRecreated,
|
||||
Menu_OnResize, Menu_ContextLost, ListScreen_ContextRecreated
|
||||
};
|
||||
void ListScreen_Show(void) {
|
||||
struct ListScreen* s = &ListScreen;
|
||||
@ -567,10 +573,10 @@ static void PauseScreen_Free(void* screen) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE PauseScreen_VTABLE = {
|
||||
PauseScreen_Init, MenuScreen_Render, PauseScreen_Free, Gui_DefaultRecreate,
|
||||
PauseScreen_Init, MenuScreen_Render, PauseScreen_Free,
|
||||
MenuScreen_KeyDown, Menu_KeyUp, Menu_KeyPress,
|
||||
Menu_MouseDown, Menu_MouseUp, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, PauseScreen_ContextRecreated,
|
||||
Menu_OnResize, Menu_ContextLost, PauseScreen_ContextRecreated
|
||||
};
|
||||
void PauseScreen_Show(void) {
|
||||
static struct Widget* widgets[8];
|
||||
@ -682,10 +688,10 @@ static bool OptionsGroupScreen_MouseMove(void* screen, int x, int y) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE OptionsGroupScreen_VTABLE = {
|
||||
OptionsGroupScreen_Init, MenuScreen_Render, OptionsGroupScreen_Free, Gui_DefaultRecreate,
|
||||
OptionsGroupScreen_Init, MenuScreen_Render, OptionsGroupScreen_Free,
|
||||
MenuScreen_KeyDown, Menu_KeyUp, Menu_KeyPress,
|
||||
Menu_MouseDown, Menu_MouseUp, OptionsGroupScreen_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, OptionsGroupScreen_ContextRecreated,
|
||||
Menu_OnResize, Menu_ContextLost, OptionsGroupScreen_ContextRecreated
|
||||
};
|
||||
void OptionsGroupScreen_Show(void) {
|
||||
struct OptionsGroupScreen* s = &OptionsGroupScreen;
|
||||
@ -896,10 +902,10 @@ static void EditHotkeyScreen_ContextRecreated(void* screen) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE EditHotkeyScreen_VTABLE = {
|
||||
MenuScreen_Init, EditHotkeyScreen_Render, EditHotkeyScreen_Free, Gui_DefaultRecreate,
|
||||
MenuScreen_Init, EditHotkeyScreen_Render, EditHotkeyScreen_Free,
|
||||
EditHotkeyScreen_KeyDown, EditHotkeyScreen_KeyUp, EditHotkeyScreen_KeyPress,
|
||||
Menu_MouseDown, Menu_MouseUp, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, EditHotkeyScreen_ContextRecreated,
|
||||
Menu_OnResize, Menu_ContextLost, EditHotkeyScreen_ContextRecreated
|
||||
};
|
||||
struct Screen* EditHotkeyScreen_MakeInstance(struct HotkeyData original) {
|
||||
static struct Widget* widgets[7];
|
||||
@ -1062,10 +1068,10 @@ static void GenLevelScreen_ContextRecreated(void* screen) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE GenLevelScreen_VTABLE = {
|
||||
MenuScreen_Init, MenuScreen_Render, MenuScreen_Free, Gui_DefaultRecreate,
|
||||
MenuScreen_Init, MenuScreen_Render, MenuScreen_Free,
|
||||
GenLevelScreen_KeyDown, GenLevelScreen_KeyUp, GenLevelScreen_KeyPress,
|
||||
Menu_MouseDown, Menu_MouseUp, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, GenLevelScreen_ContextRecreated,
|
||||
Menu_OnResize, Menu_ContextLost, GenLevelScreen_ContextRecreated
|
||||
};
|
||||
void GenLevelScreen_Show(void) {
|
||||
static struct Widget* widgets[12];
|
||||
@ -1117,10 +1123,10 @@ static void ClassicGenScreen_ContextRecreated(void* screen) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE ClassicGenScreen_VTABLE = {
|
||||
MenuScreen_Init, MenuScreen_Render, MenuScreen_Free, Gui_DefaultRecreate,
|
||||
MenuScreen_Init, MenuScreen_Render, MenuScreen_Free,
|
||||
MenuScreen_KeyDown, Menu_KeyUp, Menu_KeyPress,
|
||||
Menu_MouseDown, Menu_MouseUp, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, ClassicGenScreen_ContextRecreated,
|
||||
Menu_OnResize, Menu_ContextLost, ClassicGenScreen_ContextRecreated
|
||||
};
|
||||
void ClassicGenScreen_Show(void) {
|
||||
static struct Widget* widgets[4];
|
||||
@ -1276,10 +1282,10 @@ static void SaveLevelScreen_ContextRecreated(void* screen) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE SaveLevelScreen_VTABLE = {
|
||||
MenuScreen_Init, SaveLevelScreen_Render, MenuScreen_Free, Gui_DefaultRecreate,
|
||||
MenuScreen_Init, SaveLevelScreen_Render, MenuScreen_Free,
|
||||
SaveLevelScreen_KeyDown, SaveLevelScreen_KeyUp, SaveLevelScreen_KeyPress,
|
||||
Menu_MouseDown, Menu_MouseUp, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, SaveLevelScreen_ContextRecreated,
|
||||
Menu_OnResize, Menu_ContextLost, SaveLevelScreen_ContextRecreated
|
||||
};
|
||||
void SaveLevelScreen_Show(void) {
|
||||
static struct Widget* widgets[6];
|
||||
@ -1325,10 +1331,7 @@ static void TexturePackScreen_FilterFiles(const String* path, void* obj) {
|
||||
static void TexturePackScreen_LoadEntries(struct ListScreen* s) {
|
||||
static const String path = String_FromConst("texpacks");
|
||||
Directory_Enum(&path, &s->entries, TexturePackScreen_FilterFiles);
|
||||
|
||||
if (s->entries.count) {
|
||||
ListScreen_QuickSort(0, s->entries.count - 1);
|
||||
}
|
||||
ListScreen_Sort(s);
|
||||
}
|
||||
|
||||
void TexturePackScreen_Show(void) {
|
||||
@ -1378,9 +1381,7 @@ static void FontListScreen_UpdateEntry(struct ListScreen* s, struct ButtonWidget
|
||||
|
||||
static void FontListScreen_LoadEntries(struct ListScreen* s) {
|
||||
Font_GetNames(&s->entries);
|
||||
if (s->entries.count) {
|
||||
ListScreen_QuickSort(0, s->entries.count - 1);
|
||||
}
|
||||
ListScreen_Sort(s);
|
||||
ListScreen_Select(s, &Drawer2D_FontName);
|
||||
}
|
||||
|
||||
@ -1499,10 +1500,7 @@ static void LoadLevelScreen_FilterFiles(const String* path, void* obj) {
|
||||
static void LoadLevelScreen_LoadEntries(struct ListScreen* s) {
|
||||
static const String path = String_FromConst("maps");
|
||||
Directory_Enum(&path, &s->entries, LoadLevelScreen_FilterFiles);
|
||||
|
||||
if (s->entries.count) {
|
||||
ListScreen_QuickSort(0, s->entries.count - 1);
|
||||
}
|
||||
ListScreen_Sort(s);
|
||||
}
|
||||
|
||||
void LoadLevelScreen_Show(void) {
|
||||
@ -1639,10 +1637,10 @@ static bool KeyBindingsScreen_MouseDown(void* screen, int x, int y, MouseButton
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE KeyBindingsScreen_VTABLE = {
|
||||
MenuScreen_Init, MenuScreen_Render, MenuScreen_Free, Gui_DefaultRecreate,
|
||||
MenuScreen_Init, MenuScreen_Render, MenuScreen_Free,
|
||||
KeyBindingsScreen_KeyDown, Menu_KeyUp, Menu_KeyPress,
|
||||
KeyBindingsScreen_MouseDown, Menu_MouseUp, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, NULL,
|
||||
Menu_OnResize, Menu_ContextLost, NULL
|
||||
};
|
||||
static struct KeyBindingsScreen* KeyBindingsScreen_Make(int bindsCount, uint8_t* binds, const char** descs, Event_Void_Callback contextRecreated) {
|
||||
static struct Widget* widgets[12 + 4]; /* 12 buttons + </> buttons + 2 widgets used by MouseKeyBindings */
|
||||
@ -2083,10 +2081,10 @@ static void MenuOptionsScreen_Input(void* screen, void* widget) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE MenuOptionsScreen_VTABLE = {
|
||||
MenuOptionsScreen_Init, MenuOptionsScreen_Render, MenuScreen_Free, Gui_DefaultRecreate,
|
||||
MenuOptionsScreen_Init, MenuOptionsScreen_Render, MenuScreen_Free,
|
||||
MenuOptionsScreen_KeyDown, MenuOptionsScreen_KeyUp, MenuOptionsScreen_KeyPress,
|
||||
Menu_MouseDown, Menu_MouseUp, MenuOptionsScreen_MouseMove, MenuScreen_MouseScroll,
|
||||
MenuOptionsScreen_OnResize, MenuOptionsScreen_ContextLost, NULL,
|
||||
MenuOptionsScreen_OnResize, MenuOptionsScreen_ContextLost, NULL
|
||||
};
|
||||
struct Screen* MenuOptionsScreen_MakeInstance(int count, Event_Void_Callback contextRecreated, struct MenuInputDesc* descs, const char** descriptions, int descsCount) {
|
||||
static struct Widget* widgets[11 + 3]; /* max buttons + 3 widgets for input */
|
||||
@ -2982,10 +2980,10 @@ static bool TexIdsOverlay_KeyPress(void* screen, char keyChar) { return false; }
|
||||
static bool TexIdsOverlay_KeyUp(void* screen, Key key) { return false; }
|
||||
|
||||
static struct ScreenVTABLE TexIdsOverlay_VTABLE = {
|
||||
TexIdsOverlay_Init, TexIdsOverlay_Render, Overlay_Free, Gui_DefaultRecreate,
|
||||
TexIdsOverlay_Init, TexIdsOverlay_Render, Overlay_Free,
|
||||
TexIdsOverlay_KeyDown, TexIdsOverlay_KeyUp, TexIdsOverlay_KeyPress,
|
||||
Menu_MouseDown, Menu_MouseUp, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, TexIdsOverlay_ContextLost, TexIdsOverlay_ContextRecreated,
|
||||
Menu_OnResize, TexIdsOverlay_ContextLost, TexIdsOverlay_ContextRecreated
|
||||
};
|
||||
void TexIdsOverlay_Show(void) {
|
||||
static struct Widget* widgets[1];
|
||||
@ -3051,10 +3049,10 @@ static void UrlWarningOverlay_ContextRecreated(void* screen) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE UrlWarningOverlay_VTABLE = {
|
||||
MenuScreen_Init, MenuScreen_Render, Overlay_Free, Gui_DefaultRecreate,
|
||||
MenuScreen_Init, MenuScreen_Render, Overlay_Free,
|
||||
Overlay_KeyDown, Menu_KeyUp, Menu_KeyPress,
|
||||
Menu_MouseDown, Menu_MouseUp, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, UrlWarningOverlay_ContextRecreated,
|
||||
Menu_OnResize, Menu_ContextLost, UrlWarningOverlay_ContextRecreated
|
||||
};
|
||||
void UrlWarningOverlay_Show(const String* url) {
|
||||
static struct Widget* widgets[6];
|
||||
@ -3197,10 +3195,10 @@ static void TexPackOverlay_ContextRecreated(void* screen) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE TexPackOverlay_VTABLE = {
|
||||
MenuScreen_Init, TexPackOverlay_Render, Overlay_Free, Gui_DefaultRecreate,
|
||||
MenuScreen_Init, TexPackOverlay_Render, Overlay_Free,
|
||||
Overlay_KeyDown, Menu_KeyUp, Menu_KeyPress,
|
||||
Menu_MouseDown, Menu_MouseUp, Menu_MouseMove, MenuScreen_MouseScroll,
|
||||
Menu_OnResize, Menu_ContextLost, TexPackOverlay_ContextRecreated,
|
||||
Menu_OnResize, Menu_ContextLost, TexPackOverlay_ContextRecreated
|
||||
};
|
||||
void TexPackOverlay_Show(const String* url) {
|
||||
static struct Widget* widgets[8];
|
||||
|
@ -203,10 +203,10 @@ static bool InventoryScreen_MouseScroll(void* screen, float delta) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE InventoryScreen_VTABLE = {
|
||||
InventoryScreen_Init, InventoryScreen_Render, InventoryScreen_Free, Gui_DefaultRecreate,
|
||||
InventoryScreen_Init, InventoryScreen_Render, InventoryScreen_Free,
|
||||
InventoryScreen_KeyDown, InventoryScreen_KeyUp, Screen_TKeyPress,
|
||||
InventoryScreen_MouseDown, InventoryScreen_MouseUp, InventoryScreen_MouseMove, InventoryScreen_MouseScroll,
|
||||
InventoryScreen_OnResize, InventoryScreen_ContextLost, InventoryScreen_ContextRecreated,
|
||||
InventoryScreen_OnResize, InventoryScreen_ContextLost, InventoryScreen_ContextRecreated
|
||||
};
|
||||
void InventoryScreen_Show(void) {
|
||||
struct InventoryScreen* s = &InventoryScreen_Instance;
|
||||
@ -394,10 +394,10 @@ static void StatusScreen_Render(void* screen, double delta) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE StatusScreen_VTABLE = {
|
||||
Screen_NullFunc, StatusScreen_Render, Screen_NullFunc, Gui_DefaultRecreate,
|
||||
Screen_NullFunc, StatusScreen_Render, Screen_NullFunc,
|
||||
Screen_FKey, Screen_FKey, Screen_FKeyPress,
|
||||
Screen_FMouse, Screen_FMouse, Screen_FMouseMove, Screen_FMouseScroll,
|
||||
Screen_NullFunc, StatusScreen_ContextLost, StatusScreen_ContextRecreated,
|
||||
Screen_NullFunc, StatusScreen_ContextLost, StatusScreen_ContextRecreated
|
||||
};
|
||||
void StatusScreen_Show(void) {
|
||||
struct StatusScreen* s = &StatusScreen_Instance;
|
||||
@ -556,10 +556,10 @@ CC_NOINLINE static void LoadingScreen_ShowCommon(const String* title, const Stri
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE LoadingScreen_VTABLE = {
|
||||
LoadingScreen_Init, LoadingScreen_Render, LoadingScreen_Free, Gui_DefaultRecreate,
|
||||
LoadingScreen_Init, LoadingScreen_Render, LoadingScreen_Free,
|
||||
Screen_FKey, Screen_FKey, Screen_FKeyPress,
|
||||
Screen_FMouse, Screen_FMouse, Screen_FMouseMove, Screen_FMouseScroll,
|
||||
LoadingScreen_OnResize, LoadingScreen_ContextLost, LoadingScreen_ContextRecreated,
|
||||
LoadingScreen_OnResize, LoadingScreen_ContextLost, LoadingScreen_ContextRecreated
|
||||
};
|
||||
void LoadingScreen_Show(const String* title, const String* message) {
|
||||
LoadingScreen_Instance.VTABLE = &LoadingScreen_VTABLE;
|
||||
@ -626,10 +626,10 @@ static void GeneratingScreen_Render(void* screen, double delta) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE GeneratingScreen_VTABLE = {
|
||||
GeneratingScreen_Init, GeneratingScreen_Render, LoadingScreen_Free, Gui_DefaultRecreate,
|
||||
GeneratingScreen_Init, GeneratingScreen_Render, LoadingScreen_Free,
|
||||
Screen_FKey, Screen_FKey, Screen_FKeyPress,
|
||||
Screen_FMouse, Screen_FMouse, Screen_FMouseMove, Screen_FMouseScroll,
|
||||
LoadingScreen_OnResize, LoadingScreen_ContextLost, LoadingScreen_ContextRecreated,
|
||||
LoadingScreen_OnResize, LoadingScreen_ContextLost, LoadingScreen_ContextRecreated
|
||||
};
|
||||
void GeneratingScreen_Show(void) {
|
||||
static const String title = String_FromConst("Generating level");
|
||||
@ -1008,7 +1008,7 @@ static void HUDScreen_OnResize(void* screen) {
|
||||
struct HUDScreen* s = (struct HUDScreen*)screen;
|
||||
/* TODO: Kill this awful hack with fire */
|
||||
bool active = s->altText.active;
|
||||
Gui_DefaultRecreate(s);
|
||||
Elem_Free(s); Elem_Init(s);
|
||||
SpecialInputWidget_SetActive(&s->altText, active);
|
||||
|
||||
Widget_Reposition(&s->hotbar);
|
||||
@ -1210,10 +1210,10 @@ static void HUDScreen_Free(void* screen) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE HUDScreen_VTABLE = {
|
||||
HUDScreen_Init, HUDScreen_Render, HUDScreen_Free, Gui_DefaultRecreate,
|
||||
HUDScreen_Init, HUDScreen_Render, HUDScreen_Free,
|
||||
HUDScreen_KeyDown, HUDScreen_KeyUp, HUDScreen_KeyPress,
|
||||
HUDScreen_MouseDown, Screen_FMouse, Screen_FMouseMove, HUDScreen_MouseScroll,
|
||||
HUDScreen_OnResize, HUDScreen_ContextLost, HUDScreen_ContextRecreated,
|
||||
HUDScreen_OnResize, HUDScreen_ContextLost, HUDScreen_ContextRecreated
|
||||
};
|
||||
void HUDScreen_Show(void) {
|
||||
struct HUDScreen* s = &HUDScreen_Instance;
|
||||
@ -1381,7 +1381,7 @@ static bool DisconnectScreen_MouseMove(void* screen, int x, int y) {
|
||||
}
|
||||
|
||||
static struct ScreenVTABLE DisconnectScreen_VTABLE = {
|
||||
DisconnectScreen_Init, DisconnectScreen_Render, DisconnectScreen_Free, Gui_DefaultRecreate,
|
||||
DisconnectScreen_Init, DisconnectScreen_Render, DisconnectScreen_Free,
|
||||
DisconnectScreen_KeyDown, Screen_TKey, Screen_TKeyPress,
|
||||
DisconnectScreen_MouseDown, Screen_TMouse, DisconnectScreen_MouseMove, Screen_TMouseScroll,
|
||||
DisconnectScreen_OnResize, DisconnectScreen_ContextLost, DisconnectScreen_ContextRecreated
|
||||
|
@ -49,10 +49,10 @@ static void TextWidget_Reposition(void* widget) {
|
||||
}
|
||||
|
||||
static struct WidgetVTABLE TextWidget_VTABLE = {
|
||||
Widget_NullFunc, TextWidget_Render, TextWidget_Free, Gui_DefaultRecreate,
|
||||
Widget_NullFunc, TextWidget_Render, TextWidget_Free,
|
||||
Widget_Key, Widget_Key, Widget_KeyPress,
|
||||
Widget_Mouse, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
TextWidget_Reposition,
|
||||
TextWidget_Reposition
|
||||
};
|
||||
void TextWidget_Make(struct TextWidget* w, uint8_t horAnchor, uint8_t verAnchor, int xOffset, int yOffset) {
|
||||
PackedCol col = PACKEDCOL_WHITE;
|
||||
@ -152,10 +152,10 @@ static void ButtonWidget_Render(void* widget, double delta) {
|
||||
}
|
||||
|
||||
static struct WidgetVTABLE ButtonWidget_VTABLE = {
|
||||
Widget_NullFunc, ButtonWidget_Render, ButtonWidget_Free, Gui_DefaultRecreate,
|
||||
Widget_NullFunc, ButtonWidget_Render, ButtonWidget_Free,
|
||||
Widget_Key, Widget_Key, Widget_KeyPress,
|
||||
Widget_Mouse, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
ButtonWidget_Reposition,
|
||||
ButtonWidget_Reposition
|
||||
};
|
||||
void ButtonWidget_Make(struct ButtonWidget* w, int minWidth, Widget_LeftClick onClick, uint8_t horAnchor, uint8_t verAnchor, int xOffset, int yOffset) {
|
||||
Widget_Reset(w);
|
||||
@ -298,10 +298,10 @@ static bool ScrollbarWidget_MouseMove(void* widget, int x, int y) {
|
||||
}
|
||||
|
||||
static struct WidgetVTABLE ScrollbarWidget_VTABLE = {
|
||||
Widget_NullFunc, ScrollbarWidget_Render, Widget_NullFunc, Gui_DefaultRecreate,
|
||||
Widget_NullFunc, ScrollbarWidget_Render, Widget_NullFunc,
|
||||
Widget_Key, Widget_Key, Widget_KeyPress,
|
||||
ScrollbarWidget_MouseDown, ScrollbarWidget_MouseUp, ScrollbarWidget_MouseMove, ScrollbarWidget_MouseScroll,
|
||||
Widget_CalcPosition,
|
||||
Widget_CalcPosition
|
||||
};
|
||||
void ScrollbarWidget_Create(struct ScrollbarWidget* w) {
|
||||
Widget_Reset(w);
|
||||
@ -487,10 +487,10 @@ static bool HotbarWidget_MouseScroll(void* widget, float delta) {
|
||||
}
|
||||
|
||||
static struct WidgetVTABLE HotbarWidget_VTABLE = {
|
||||
HotbarWidget_Init, HotbarWidget_Render, Widget_NullFunc, Gui_DefaultRecreate,
|
||||
HotbarWidget_Init, HotbarWidget_Render, Widget_NullFunc,
|
||||
HotbarWidget_KeyDown, HotbarWidget_KeyUp, Widget_KeyPress,
|
||||
HotbarWidget_MouseDown, Widget_Mouse, Widget_MouseMove, HotbarWidget_MouseScroll,
|
||||
HotbarWidget_Reposition,
|
||||
HotbarWidget_Reposition
|
||||
};
|
||||
void HotbarWidget_Create(struct HotbarWidget* w) {
|
||||
Widget_Reset(w);
|
||||
@ -819,10 +819,10 @@ static bool TableWidget_KeyDown(void* widget, Key key) {
|
||||
}
|
||||
|
||||
static struct WidgetVTABLE TableWidget_VTABLE = {
|
||||
TableWidget_Init, TableWidget_Render, TableWidget_Free, Gui_DefaultRecreate,
|
||||
TableWidget_Init, TableWidget_Render, TableWidget_Free,
|
||||
TableWidget_KeyDown, Widget_Key, Widget_KeyPress,
|
||||
TableWidget_MouseDown, TableWidget_MouseUp, TableWidget_MouseMove, TableWidget_MouseScroll,
|
||||
TableWidget_Reposition,
|
||||
TableWidget_Reposition
|
||||
};
|
||||
void TableWidget_Create(struct TableWidget* w) {
|
||||
Widget_Reset(w);
|
||||
@ -1491,10 +1491,10 @@ static bool MenuInputWidget_AllowedChar(void* widget, char c) {
|
||||
|
||||
static int MenuInputWidget_GetMaxLines(void) { return 1; }
|
||||
static struct WidgetVTABLE MenuInputWidget_VTABLE = {
|
||||
InputWidget_Init, MenuInputWidget_Render, InputWidget_Free, Gui_DefaultRecreate,
|
||||
InputWidget_Init, MenuInputWidget_Render, InputWidget_Free,
|
||||
InputWidget_KeyDown, InputWidget_KeyUp, InputWidget_KeyPress,
|
||||
InputWidget_MouseDown, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
InputWidget_Reposition,
|
||||
InputWidget_Reposition
|
||||
};
|
||||
void MenuInputWidget_Create(struct MenuInputWidget* w, int width, int height, const String* text, FontDesc* font, struct MenuInputDesc* desc) {
|
||||
InputWidget_Create(&w->base, font, &String_Empty);
|
||||
@ -1744,10 +1744,10 @@ static int ChatInputWidget_GetMaxLines(void) {
|
||||
}
|
||||
|
||||
static struct WidgetVTABLE ChatInputWidget_VTABLE = {
|
||||
InputWidget_Init, ChatInputWidget_Render, InputWidget_Free, Gui_DefaultRecreate,
|
||||
InputWidget_Init, ChatInputWidget_Render, InputWidget_Free,
|
||||
ChatInputWidget_KeyDown, InputWidget_KeyUp, InputWidget_KeyPress,
|
||||
InputWidget_MouseDown, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
InputWidget_Reposition,
|
||||
InputWidget_Reposition
|
||||
};
|
||||
void ChatInputWidget_Create(struct ChatInputWidget* w, FontDesc* font) {
|
||||
static const String prefix = String_FromConst("> ");
|
||||
@ -2141,10 +2141,10 @@ static void PlayerListWidget_Free(void* widget) {
|
||||
}
|
||||
|
||||
static struct WidgetVTABLE PlayerListWidget_VTABLE = {
|
||||
PlayerListWidget_Init, PlayerListWidget_Render, PlayerListWidget_Free, Gui_DefaultRecreate,
|
||||
PlayerListWidget_Init, PlayerListWidget_Render, PlayerListWidget_Free,
|
||||
Widget_Key, Widget_Key, Widget_KeyPress,
|
||||
Widget_Mouse, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
PlayerListWidget_Reposition,
|
||||
PlayerListWidget_Reposition
|
||||
};
|
||||
void PlayerListWidget_Create(struct PlayerListWidget* w, FontDesc* font, bool classic) {
|
||||
Widget_Reset(w);
|
||||
@ -2573,10 +2573,10 @@ static void TextGroupWidget_Free(void* widget) {
|
||||
}
|
||||
|
||||
static struct WidgetVTABLE TextGroupWidget_VTABLE = {
|
||||
TextGroupWidget_Init, TextGroupWidget_Render, TextGroupWidget_Free, Gui_DefaultRecreate,
|
||||
TextGroupWidget_Init, TextGroupWidget_Render, TextGroupWidget_Free,
|
||||
Widget_Key, Widget_Key, Widget_KeyPress,
|
||||
Widget_Mouse, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
TextGroupWidget_Reposition,
|
||||
TextGroupWidget_Reposition
|
||||
};
|
||||
void TextGroupWidget_Create(struct TextGroupWidget* w, int lines, FontDesc* font, struct Texture* textures, TextGroupWidget_Get getLine) {
|
||||
Widget_Reset(w);
|
||||
@ -2826,10 +2826,10 @@ void SpecialInputWidget_SetActive(struct SpecialInputWidget* w, bool active) {
|
||||
}
|
||||
|
||||
static struct WidgetVTABLE SpecialInputWidget_VTABLE = {
|
||||
SpecialInputWidget_Init, SpecialInputWidget_Render, SpecialInputWidget_Free, Gui_DefaultRecreate,
|
||||
SpecialInputWidget_Init, SpecialInputWidget_Render, SpecialInputWidget_Free,
|
||||
Widget_Key, Widget_Key, Widget_KeyPress,
|
||||
SpecialInputWidget_MouseDown, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
Widget_CalcPosition,
|
||||
Widget_CalcPosition
|
||||
};
|
||||
void SpecialInputWidget_Create(struct SpecialInputWidget* w, FontDesc* font, struct InputWidget* target) {
|
||||
Widget_Reset(w);
|
||||
|
Loading…
x
Reference in New Issue
Block a user