mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 20:15:35 -04:00
Get rid of unused wasDown argument for KeyDown handler in screens/widgets
This commit is contained in:
parent
340555833e
commit
22dea901ee
@ -39,7 +39,7 @@ extern bool Gui_ShowFPS;
|
||||
void (*Render)(void* elem, double delta); \
|
||||
void (*Free)(void* elem); \
|
||||
void (*Recreate)(void* elem); \
|
||||
bool (*HandlesKeyDown)(void* elem, Key key, bool wasDown); \
|
||||
bool (*HandlesKeyDown)(void* elem, Key key); \
|
||||
bool (*HandlesKeyUp)(void* elem, Key key); \
|
||||
bool (*HandlesKeyPress)(void* elem, char keyChar); \
|
||||
bool (*HandlesMouseDown)(void* elem, int x, int y, MouseButton btn); \
|
||||
@ -188,7 +188,7 @@ void TextAtlas_AddInt(struct TextAtlas* atlas, int value, VertexP3fT2fC4b** vert
|
||||
#define Elem_Free(elem) (elem)->VTABLE->Free(elem)
|
||||
#define Elem_Recreate(elem) (elem)->VTABLE->Recreate(elem)
|
||||
#define Elem_HandlesKeyPress(elem, key) (elem)->VTABLE->HandlesKeyPress(elem, key)
|
||||
#define Elem_HandlesKeyDown(elem, key, was) (elem)->VTABLE->HandlesKeyDown(elem, key, was)
|
||||
#define Elem_HandlesKeyDown(elem, key) (elem)->VTABLE->HandlesKeyDown(elem, key)
|
||||
#define Elem_HandlesKeyUp(elem, key) (elem)->VTABLE->HandlesKeyUp(elem, key)
|
||||
#define Elem_HandlesMouseDown(elem, x, y, btn) (elem)->VTABLE->HandlesMouseDown(elem, x, y, btn)
|
||||
#define Elem_HandlesMouseUp(elem, x, y, btn) (elem)->VTABLE->HandlesMouseUp(elem, x, y, btn)
|
||||
|
@ -418,7 +418,7 @@ static void InputHandler_MouseMove(void* obj, int xDelta, int yDelta) {
|
||||
|
||||
for (i = 0; i < Gui_ScreensCount; i++) {
|
||||
s = Gui_Screens[i];
|
||||
if (Elem_HandlesMouseMove(s, Mouse_X, Mouse_Y)) return;
|
||||
if (s->VTABLE->HandlesMouseMove(s, Mouse_X, Mouse_Y)) return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -428,7 +428,7 @@ static void InputHandler_MouseDown(void* obj, int btn) {
|
||||
|
||||
for (i = 0; i < Gui_ScreensCount; i++) {
|
||||
s = Gui_Screens[i];
|
||||
if (Elem_HandlesMouseDown(s, Mouse_X, Mouse_Y, btn)) {
|
||||
if (s->VTABLE->HandlesMouseDown(s, Mouse_X, Mouse_Y, btn)) {
|
||||
input_lastClick = DateTime_CurrentUTC_MS(); return;
|
||||
}
|
||||
}
|
||||
@ -443,7 +443,7 @@ static void InputHandler_MouseUp(void* obj, int btn) {
|
||||
|
||||
for (i = 0; i < Gui_ScreensCount; i++) {
|
||||
s = Gui_Screens[i];
|
||||
if (Elem_HandlesMouseUp(s, Mouse_X, Mouse_Y, btn)) return;
|
||||
if (s->VTABLE->HandlesMouseUp(s, Mouse_X, Mouse_Y, btn)) return;
|
||||
}
|
||||
|
||||
if (Server.SupportsPlayerClick && btn <= MOUSE_MIDDLE) {
|
||||
@ -487,7 +487,7 @@ static void InputHandler_KeyDown(void* obj, int key, bool was) {
|
||||
Window_Close(); return;
|
||||
} else if (key == KeyBinds[KEYBIND_SCREENSHOT] && !was) {
|
||||
Game_ScreenshotRequested = true; return;
|
||||
} else if (Elem_HandlesKeyDown(active, key, was)) {
|
||||
} else if (Elem_HandlesKeyDown(active, key)) {
|
||||
return;
|
||||
} else if ((key == KEY_ESCAPE || key == KEY_PAUSE) && !Gui_GetInputGrab()) {
|
||||
#ifdef CC_BUILD_WEB
|
||||
|
36
src/Menus.c
36
src/Menus.c
@ -508,7 +508,7 @@ static void ListScreen_Free(void* screen) {
|
||||
StringsBuffer_Clear(&s->entries);
|
||||
}
|
||||
|
||||
static bool ListScreen_KeyDown(void* screen, Key key, bool was) {
|
||||
static bool ListScreen_KeyDown(void* screen, Key key) {
|
||||
struct ListScreen* s = (struct ListScreen*)screen;
|
||||
if (key == KEY_LEFT || key == KEY_PAGEUP) {
|
||||
ListScreen_PageClick(s, false);
|
||||
@ -546,7 +546,7 @@ void ListScreen_Show(void) {
|
||||
/*########################################################################################################################*
|
||||
*--------------------------------------------------------MenuScreen-------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
static bool MenuScreen_KeyDown(void* screen, Key key, bool was) { return key < KEY_F1 || key > KEY_F35; }
|
||||
static bool MenuScreen_KeyDown(void* screen, Key key) { return key < KEY_F1 || key > KEY_F35; }
|
||||
static bool MenuScreen_MouseScroll(void* screen, float delta) { return true; }
|
||||
|
||||
static void MenuScreen_Init(void* screen) {
|
||||
@ -911,7 +911,7 @@ static bool EditHotkeyScreen_KeyPress(void* screen, char keyChar) {
|
||||
return Elem_HandlesKeyPress(&s->input.base, keyChar);
|
||||
}
|
||||
|
||||
static bool EditHotkeyScreen_KeyDown(void* screen, Key key, bool was) {
|
||||
static bool EditHotkeyScreen_KeyDown(void* screen, Key key) {
|
||||
struct EditHotkeyScreen* s = (struct EditHotkeyScreen*)screen;
|
||||
if (s->selectedI >= 0) {
|
||||
if (s->selectedI == 0) {
|
||||
@ -930,7 +930,7 @@ static bool EditHotkeyScreen_KeyDown(void* screen, Key key, bool was) {
|
||||
s->selectedI = -1;
|
||||
return true;
|
||||
}
|
||||
return Elem_HandlesKeyDown(&s->input.base, key, was) || MenuScreen_KeyDown(s, key, was);
|
||||
return Elem_HandlesKeyDown(&s->input.base, key) || MenuScreen_KeyDown(s, key);
|
||||
}
|
||||
|
||||
static bool EditHotkeyScreen_KeyUp(void* screen, Key key) {
|
||||
@ -1088,10 +1088,10 @@ static void GenLevelScreen_Label(struct GenLevelScreen* s, int i, int x, int y,
|
||||
Widget_Reposition(label);
|
||||
}
|
||||
|
||||
static bool GenLevelScreen_KeyDown(void* screen, Key key, bool was) {
|
||||
static bool GenLevelScreen_KeyDown(void* screen, Key key) {
|
||||
struct GenLevelScreen* s = (struct GenLevelScreen*)screen;
|
||||
if (s->selected && Elem_HandlesKeyDown(&s->selected->base, key, was)) return true;
|
||||
return MenuScreen_KeyDown(s, key, was);
|
||||
if (s->selected && Elem_HandlesKeyDown(&s->selected->base, key)) return true;
|
||||
return MenuScreen_KeyDown(s, key);
|
||||
}
|
||||
|
||||
static bool GenLevelScreen_KeyUp(void* screen, Key key) {
|
||||
@ -1303,11 +1303,11 @@ static bool SaveLevelScreen_KeyPress(void* screen, char keyChar) {
|
||||
return Elem_HandlesKeyPress(&s->input.base, keyChar);
|
||||
}
|
||||
|
||||
static bool SaveLevelScreen_KeyDown(void* screen, Key key, bool was) {
|
||||
static bool SaveLevelScreen_KeyDown(void* screen, Key key) {
|
||||
struct SaveLevelScreen* s = (struct SaveLevelScreen*)screen;
|
||||
SaveLevelScreen_RemoveOverwrites(s);
|
||||
if (Elem_HandlesKeyDown(&s->input.base, key, was)) return true;
|
||||
return MenuScreen_KeyDown(s, key, was);
|
||||
if (Elem_HandlesKeyDown(&s->input.base, key)) return true;
|
||||
return MenuScreen_KeyDown(s, key);
|
||||
}
|
||||
|
||||
static bool SaveLevelScreen_KeyUp(void* screen, Key key) {
|
||||
@ -1666,13 +1666,13 @@ static int KeyBindingsScreen_MakeWidgets(struct KeyBindingsScreen* s, int y, int
|
||||
return i;
|
||||
}
|
||||
|
||||
static bool KeyBindingsScreen_KeyDown(void* screen, Key key, bool was) {
|
||||
static bool KeyBindingsScreen_KeyDown(void* screen, Key key) {
|
||||
String text; char textBuffer[STRING_SIZE];
|
||||
struct KeyBindingsScreen* s = (struct KeyBindingsScreen*)screen;
|
||||
struct ButtonWidget* cur;
|
||||
KeyBind bind;
|
||||
|
||||
if (s->curI == -1) return MenuScreen_KeyDown(s, key, was);
|
||||
if (s->curI == -1) return MenuScreen_KeyDown(s, key);
|
||||
bind = s->binds[s->curI];
|
||||
if (key == KEY_ESCAPE) key = KeyBind_Defaults[bind];
|
||||
|
||||
@ -1698,7 +1698,7 @@ static bool KeyBindingsScreen_MouseDown(void* screen, int x, int y, MouseButton
|
||||
/* Reset a key binding by right clicking */
|
||||
if ((s->curI == -1 || s->curI == i) && i < s->bindsCount) {
|
||||
s->curI = i;
|
||||
Elem_HandlesKeyDown(s, KeyBind_Defaults[s->binds[i]], false);
|
||||
Elem_HandlesKeyDown(s, KeyBind_Defaults[s->binds[i]]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -2002,16 +2002,16 @@ static bool MenuOptionsScreen_KeyPress(void* screen, char keyChar) {
|
||||
return Elem_HandlesKeyPress(&s->input.base, keyChar);
|
||||
}
|
||||
|
||||
static bool MenuOptionsScreen_KeyDown(void* screen, Key key, bool was) {
|
||||
static bool MenuOptionsScreen_KeyDown(void* screen, Key key) {
|
||||
struct MenuOptionsScreen* s = (struct MenuOptionsScreen*)screen;
|
||||
if (s->activeI >= 0) {
|
||||
if (Elem_HandlesKeyDown(&s->input.base, key, was)) return true;
|
||||
if (Elem_HandlesKeyDown(&s->input.base, key)) return true;
|
||||
|
||||
if (key == KEY_ENTER || key == KEY_KP_ENTER) {
|
||||
MenuOptionsScreen_EnterInput(s); return true;
|
||||
}
|
||||
}
|
||||
return MenuScreen_KeyDown(s, key, was);
|
||||
return MenuScreen_KeyDown(s, key);
|
||||
}
|
||||
|
||||
static bool MenuOptionsScreen_KeyUp(void* screen, Key key) {
|
||||
@ -2874,7 +2874,7 @@ static void Overlay_Free(void* screen) {
|
||||
Gui_RemoveOverlay(screen);
|
||||
}
|
||||
|
||||
static bool Overlay_KeyDown(void* screen, Key key, bool was) { return true; }
|
||||
static bool Overlay_KeyDown(void* screen, Key key) { return true; }
|
||||
|
||||
static void Overlay_MakeLabels(void* menu, struct TextWidget* labels, const String* lines) {
|
||||
struct MenuScreen* s = (struct MenuScreen*)menu;
|
||||
@ -3039,7 +3039,7 @@ static void TexIdsOverlay_Render(void* screen, double delta) {
|
||||
Gfx_SetTexturing(false);
|
||||
}
|
||||
|
||||
static bool TexIdsOverlay_KeyDown(void* screen, Key key, bool was) {
|
||||
static bool TexIdsOverlay_KeyDown(void* screen, Key key) {
|
||||
struct Screen* s = (struct Screen*)screen;
|
||||
if (key == KeyBinds[KEYBIND_IDOVERLAY]) { Gui_Remove(s); return true; }
|
||||
return false;
|
||||
|
@ -50,15 +50,14 @@ struct HUDScreen {
|
||||
};
|
||||
|
||||
|
||||
static bool Screen_FKeyDown(void* elem, Key key, bool was) { return false; }
|
||||
static bool Screen_FKeyUp(void* elem, Key key) { return false; }
|
||||
static bool Screen_FKey(void* elem, Key key) { return false; }
|
||||
static bool Screen_FKeyPress(void* elem, char keyChar) { return false; }
|
||||
static bool Screen_FMouseScroll(void* elem, float delta) { return false; }
|
||||
static bool Screen_FMouse(void* elem, int x, int y, int btn) { return false; }
|
||||
static bool Screen_FMouseMove(void* elem, int x, int y) { return false; }
|
||||
|
||||
static bool Screen_TKeyPress(void* elem, char keyChar) { return true; }
|
||||
static bool Screen_TKeyUp(void* s, Key key) { return true; }
|
||||
static bool Screen_TKey(void* s, Key key) { return true; }
|
||||
static bool Screen_TMouseScroll(void* screen, float delta) { return true; }
|
||||
static bool Screen_TMouse(void* screen, int x, int y, int btn) { return true; }
|
||||
static void Screen_NullFunc(void* screen) { }
|
||||
@ -137,7 +136,7 @@ static void InventoryScreen_Free(void* screen) {
|
||||
Event_UnregisterVoid(&BlockEvents.BlockDefChanged, s, InventoryScreen_OnBlockChanged);
|
||||
}
|
||||
|
||||
static bool InventoryScreen_KeyDown(void* screen, Key key, bool was) {
|
||||
static bool InventoryScreen_KeyDown(void* screen, Key key) {
|
||||
struct InventoryScreen* s = (struct InventoryScreen*)screen;
|
||||
struct TableWidget* table = &s->table;
|
||||
|
||||
@ -146,10 +145,10 @@ static bool InventoryScreen_KeyDown(void* screen, Key key, bool was) {
|
||||
} else if (key == KEY_ENTER && table->selectedIndex != -1) {
|
||||
Inventory_SetSelectedBlock(table->elements[table->selectedIndex]);
|
||||
Gui_Remove(screen);
|
||||
} else if (Elem_HandlesKeyDown(table, key, was)) {
|
||||
} else if (Elem_HandlesKeyDown(table, key)) {
|
||||
} else {
|
||||
struct HUDScreen* hud = (struct HUDScreen*)Gui_HUD;
|
||||
return Elem_HandlesKeyDown(&hud->hotbar, key, was);
|
||||
return Elem_HandlesKeyDown(&hud->hotbar, key);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -399,7 +398,7 @@ static void StatusScreen_Render(void* screen, double delta) {
|
||||
|
||||
static struct ScreenVTABLE StatusScreen_VTABLE = {
|
||||
Screen_NullFunc, StatusScreen_Render, Screen_NullFunc, Gui_DefaultRecreate,
|
||||
Screen_FKeyDown, Screen_FKeyUp, Screen_FKeyPress,
|
||||
Screen_FKey, Screen_FKey, Screen_FKeyPress,
|
||||
Screen_FMouse, Screen_FMouse, Screen_FMouseMove, Screen_FMouseScroll,
|
||||
Screen_NullFunc, StatusScreen_ContextLost, StatusScreen_ContextRecreated,
|
||||
};
|
||||
@ -563,7 +562,7 @@ CC_NOINLINE static void LoadingScreen_ShowCommon(const String* title, const Stri
|
||||
|
||||
static struct ScreenVTABLE LoadingScreen_VTABLE = {
|
||||
LoadingScreen_Init, LoadingScreen_Render, LoadingScreen_Free, Gui_DefaultRecreate,
|
||||
Screen_FKeyDown, Screen_FKeyUp, Screen_FKeyPress,
|
||||
Screen_FKey, Screen_FKey, Screen_FKeyPress,
|
||||
Screen_FMouse, Screen_FMouse, Screen_FMouseMove, Screen_FMouseScroll,
|
||||
LoadingScreen_OnResize, LoadingScreen_ContextLost, LoadingScreen_ContextRecreated,
|
||||
};
|
||||
@ -633,7 +632,7 @@ static void GeneratingScreen_Render(void* screen, double delta) {
|
||||
|
||||
static struct ScreenVTABLE GeneratingScreen_VTABLE = {
|
||||
GeneratingScreen_Init, GeneratingScreen_Render, LoadingScreen_Free, Gui_DefaultRecreate,
|
||||
Screen_FKeyDown, Screen_FKeyUp, Screen_FKeyPress,
|
||||
Screen_FKey, Screen_FKey, Screen_FKeyPress,
|
||||
Screen_FMouse, Screen_FMouse, Screen_FMouseMove, Screen_FMouseScroll,
|
||||
LoadingScreen_OnResize, LoadingScreen_ContextLost, LoadingScreen_ContextRecreated,
|
||||
};
|
||||
@ -1036,7 +1035,7 @@ static bool HUDScreen_KeyPress(void* screen, char keyChar) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HUDScreen_KeyDown(void* screen, Key key, bool was) {
|
||||
static bool HUDScreen_KeyDown(void* screen, Key key) {
|
||||
static const String slash = String_FromConst("/");
|
||||
struct HUDScreen* s = (struct HUDScreen*)screen;
|
||||
Key playerListKey = KeyBinds[KEYBIND_PLAYER_LIST];
|
||||
@ -1066,7 +1065,7 @@ static bool HUDScreen_KeyDown(void* screen, Key key, bool was) {
|
||||
} else if (key == KEY_PAGEDOWN) {
|
||||
HUDScreen_ScrollChatBy(s, +Gui_Chatlines);
|
||||
} else {
|
||||
Elem_HandlesKeyDown(&s->input.base, key, was);
|
||||
Elem_HandlesKeyDown(&s->input.base, key);
|
||||
HUDScreen_UpdateAltTextY(s);
|
||||
}
|
||||
return key < KEY_F1 || key > KEY_F35;
|
||||
@ -1077,7 +1076,7 @@ static bool HUDScreen_KeyDown(void* screen, Key key, bool was) {
|
||||
} else if (key == KEY_SLASH) {
|
||||
HUDScreen_OpenInput(&slash);
|
||||
} else {
|
||||
return Elem_HandlesKeyDown(&s->hotbar, key, was);
|
||||
return Elem_HandlesKeyDown(&s->hotbar, key);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1368,7 +1367,7 @@ static void DisconnectScreen_OnResize(void* screen) {
|
||||
Widget_Reposition(&s->reconnect);
|
||||
}
|
||||
|
||||
static bool DisconnectScreen_KeyDown(void* s, Key key, bool was) { return key < KEY_F1 || key > KEY_F35; }
|
||||
static bool DisconnectScreen_KeyDown(void* s, Key key) { return key < KEY_F1 || key > KEY_F35; }
|
||||
|
||||
static bool DisconnectScreen_MouseDown(void* screen, int x, int y, MouseButton btn) {
|
||||
struct DisconnectScreen* s = (struct DisconnectScreen*)screen;
|
||||
@ -1389,7 +1388,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_KeyDown, Screen_TKeyUp, Screen_TKeyPress,
|
||||
DisconnectScreen_KeyDown, Screen_TKey, Screen_TKeyPress,
|
||||
DisconnectScreen_MouseDown, Screen_TMouse, DisconnectScreen_MouseMove, Screen_TMouseScroll,
|
||||
DisconnectScreen_OnResize, DisconnectScreen_ContextLost, DisconnectScreen_ContextRecreated
|
||||
};
|
||||
|
@ -23,8 +23,7 @@ static void Widget_NullFunc(void* widget) { }
|
||||
static Size2D Size2D_Empty;
|
||||
|
||||
static bool Widget_Mouse(void* elem, int x, int y, MouseButton btn) { return false; }
|
||||
static bool Widget_KeyDown(void* elem, Key key, bool was) { return false; }
|
||||
static bool Widget_KeyUp(void* elem, Key key) { return false; }
|
||||
static bool Widget_Key(void* elem, Key key) { return false; }
|
||||
static bool Widget_KeyPress(void* elem, char keyChar) { return false; }
|
||||
static bool Widget_MouseMove(void* elem, int x, int y) { return false; }
|
||||
static bool Widget_MouseScroll(void* elem, float delta) { return false; }
|
||||
@ -44,16 +43,14 @@ static void TextWidget_Free(void* widget) {
|
||||
|
||||
static void TextWidget_Reposition(void* widget) {
|
||||
struct TextWidget* w = (struct TextWidget*)widget;
|
||||
int oldX = w->x, oldY = w->y;
|
||||
|
||||
Widget_CalcPosition(w);
|
||||
w->texture.X += w->x - oldX;
|
||||
w->texture.Y += w->y - oldY;
|
||||
w->texture.X = w->x;
|
||||
w->texture.Y = w->y;
|
||||
}
|
||||
|
||||
static struct WidgetVTABLE TextWidget_VTABLE = {
|
||||
Widget_NullFunc, TextWidget_Render, TextWidget_Free, Gui_DefaultRecreate,
|
||||
Widget_KeyDown, Widget_KeyUp, Widget_KeyPress,
|
||||
Widget_Key, Widget_Key, Widget_KeyPress,
|
||||
Widget_Mouse, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
TextWidget_Reposition,
|
||||
};
|
||||
@ -108,11 +105,10 @@ static void ButtonWidget_Free(void* widget) {
|
||||
|
||||
static void ButtonWidget_Reposition(void* widget) {
|
||||
struct ButtonWidget* w = (struct ButtonWidget*)widget;
|
||||
int oldX = w->x, oldY = w->y;
|
||||
Widget_CalcPosition(w);
|
||||
|
||||
w->texture.X += w->x - oldX;
|
||||
w->texture.Y += w->y - oldY;
|
||||
w->texture.X = w->x + (w->width / 2 - w->texture.Width / 2);
|
||||
w->texture.Y = w->y + (w->height / 2 - w->texture.Height / 2);
|
||||
}
|
||||
|
||||
static void ButtonWidget_Render(void* widget, double delta) {
|
||||
@ -156,7 +152,7 @@ static void ButtonWidget_Render(void* widget, double delta) {
|
||||
|
||||
static struct WidgetVTABLE ButtonWidget_VTABLE = {
|
||||
Widget_NullFunc, ButtonWidget_Render, ButtonWidget_Free, Gui_DefaultRecreate,
|
||||
Widget_KeyDown, Widget_KeyUp, Widget_KeyPress,
|
||||
Widget_Key, Widget_Key, Widget_KeyPress,
|
||||
Widget_Mouse, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
ButtonWidget_Reposition,
|
||||
};
|
||||
@ -182,10 +178,7 @@ void ButtonWidget_Set(struct ButtonWidget* w, const String* text, const FontDesc
|
||||
|
||||
w->width = max(w->texture.Width, w->minWidth);
|
||||
w->height = max(w->texture.Height, BUTTON_MIN_WIDTH);
|
||||
|
||||
Widget_Reposition(w);
|
||||
w->texture.X = w->x + (w->width / 2 - w->texture.Width / 2);
|
||||
w->texture.Y = w->y + (w->height / 2 - w->texture.Height / 2);
|
||||
}
|
||||
|
||||
void ButtonWidget_Create(struct ButtonWidget* w, int minWidth, const String* text, const FontDesc* font, Widget_LeftClick onClick) {
|
||||
@ -304,7 +297,7 @@ static bool ScrollbarWidget_MouseMove(void* widget, int x, int y) {
|
||||
|
||||
static struct WidgetVTABLE ScrollbarWidget_VTABLE = {
|
||||
Widget_NullFunc, ScrollbarWidget_Render, Widget_NullFunc, Gui_DefaultRecreate,
|
||||
Widget_KeyDown, Widget_KeyUp, Widget_KeyPress,
|
||||
Widget_Key, Widget_Key, Widget_KeyPress,
|
||||
ScrollbarWidget_MouseDown, ScrollbarWidget_MouseUp, ScrollbarWidget_MouseMove, ScrollbarWidget_MouseScroll,
|
||||
Widget_CalcPosition,
|
||||
};
|
||||
@ -417,7 +410,7 @@ static void HotbarWidget_Render(void* widget, double delta) {
|
||||
HotbarWidget_RenderHotbarBlocks(w);
|
||||
}
|
||||
|
||||
static bool HotbarWidget_KeyDown(void* widget, Key key, bool was) {
|
||||
static bool HotbarWidget_KeyDown(void* widget, Key key) {
|
||||
struct HotbarWidget* w = (struct HotbarWidget*)widget;
|
||||
int index;
|
||||
if (key < '1' || key > '9') return false;
|
||||
@ -809,7 +802,7 @@ static bool TableWidget_MouseMove(void* widget, int x, int y) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool TableWidget_KeyDown(void* widget, Key key, bool was) {
|
||||
static bool TableWidget_KeyDown(void* widget, Key key) {
|
||||
struct TableWidget* w = (struct TableWidget*)widget;
|
||||
if (w->selectedIndex == -1) return false;
|
||||
|
||||
@ -829,7 +822,7 @@ static bool TableWidget_KeyDown(void* widget, Key key, bool was) {
|
||||
|
||||
static struct WidgetVTABLE TableWidget_VTABLE = {
|
||||
TableWidget_Init, TableWidget_Render, TableWidget_Free, TableWidget_Recreate,
|
||||
TableWidget_KeyDown, Widget_KeyUp, Widget_KeyPress,
|
||||
TableWidget_KeyDown, Widget_Key, Widget_KeyPress,
|
||||
TableWidget_MouseDown, TableWidget_MouseUp, TableWidget_MouseMove, TableWidget_MouseScroll,
|
||||
TableWidget_Reposition,
|
||||
};
|
||||
@ -1200,7 +1193,7 @@ static void InputWidget_Reposition(void* widget) {
|
||||
w->inputTex.X += w->x - oldX; w->inputTex.Y += w->y - oldY;
|
||||
}
|
||||
|
||||
static bool InputWidget_KeyDown(void* widget, Key key, bool was) {
|
||||
static bool InputWidget_KeyDown(void* widget, Key key) {
|
||||
struct InputWidget* w = (struct InputWidget*)widget;
|
||||
if (key == KEY_LEFT) {
|
||||
InputWidget_LeftKey(w);
|
||||
@ -1741,12 +1734,12 @@ static void ChatInputWidget_TabKey(struct InputWidget* w) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool ChatInputWidget_KeyDown(void* widget, Key key, bool was) {
|
||||
static bool ChatInputWidget_KeyDown(void* widget, Key key) {
|
||||
struct InputWidget* w = (struct InputWidget*)widget;
|
||||
if (key == KEY_TAB) { ChatInputWidget_TabKey(w); return true; }
|
||||
if (key == KEY_UP) { ChatInputWidget_UpKey(w); return true; }
|
||||
if (key == KEY_DOWN) { ChatInputWidget_DownKey(w); return true; }
|
||||
return InputWidget_KeyDown(w, key, was);
|
||||
return InputWidget_KeyDown(w, key);
|
||||
}
|
||||
|
||||
static int ChatInputWidget_GetMaxLines(void) {
|
||||
@ -2153,7 +2146,7 @@ static void PlayerListWidget_Free(void* widget) {
|
||||
|
||||
static struct WidgetVTABLE PlayerListWidget_VTABLE = {
|
||||
PlayerListWidget_Init, PlayerListWidget_Render, PlayerListWidget_Free, Gui_DefaultRecreate,
|
||||
Widget_KeyDown, Widget_KeyUp, Widget_KeyPress,
|
||||
Widget_Key, Widget_Key, Widget_KeyPress,
|
||||
Widget_Mouse, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
PlayerListWidget_Reposition,
|
||||
};
|
||||
@ -2585,7 +2578,7 @@ static void TextGroupWidget_Free(void* widget) {
|
||||
|
||||
static struct WidgetVTABLE TextGroupWidget_VTABLE = {
|
||||
TextGroupWidget_Init, TextGroupWidget_Render, TextGroupWidget_Free, Gui_DefaultRecreate,
|
||||
Widget_KeyDown, Widget_KeyUp, Widget_KeyPress,
|
||||
Widget_Key, Widget_Key, Widget_KeyPress,
|
||||
Widget_Mouse, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
TextGroupWidget_Reposition,
|
||||
};
|
||||
@ -2838,7 +2831,7 @@ void SpecialInputWidget_SetActive(struct SpecialInputWidget* w, bool active) {
|
||||
|
||||
static struct WidgetVTABLE SpecialInputWidget_VTABLE = {
|
||||
SpecialInputWidget_Init, SpecialInputWidget_Render, SpecialInputWidget_Free, Gui_DefaultRecreate,
|
||||
Widget_KeyDown, Widget_KeyUp, Widget_KeyPress,
|
||||
Widget_Key, Widget_Key, Widget_KeyPress,
|
||||
SpecialInputWidget_MouseDown, Widget_Mouse, Widget_MouseMove, Widget_MouseScroll,
|
||||
Widget_CalcPosition,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user