mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
Make it so you can always click on hotbar (not just in inventory) when on mobile
This commit is contained in:
parent
5268d5b565
commit
018f57945c
@ -288,6 +288,18 @@ static int HUDScreen_KeyUp(void* screen, int key) {
|
|||||||
return Elem_HandlesKeyUp(&s->hotbar, key);
|
return Elem_HandlesKeyUp(&s->hotbar, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int HUDscreen_PointerDown(void* screen, int id, int x, int y) {
|
||||||
|
struct HUDScreen* s = (struct HUDScreen*)screen;
|
||||||
|
#ifdef CC_BUILD_TOUCH
|
||||||
|
if (Input_TouchMode || Gui_GetInputGrab()) {
|
||||||
|
return Elem_HandlesPointerDown(&s->hotbar, id, x, y);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (Gui_GetInputGrab()) return Elem_HandlesPointerDown(&s->hotbar, id, x, y);
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static void HUDScreen_Init(void* screen) {
|
static void HUDScreen_Init(void* screen) {
|
||||||
struct HUDScreen* s = (struct HUDScreen*)screen;
|
struct HUDScreen* s = (struct HUDScreen*)screen;
|
||||||
HotbarWidget_Create(&s->hotbar);
|
HotbarWidget_Create(&s->hotbar);
|
||||||
@ -318,7 +330,7 @@ static const struct ScreenVTABLE HUDScreen_VTABLE = {
|
|||||||
HUDScreen_Init, Screen_NullUpdate, Screen_NullFunc,
|
HUDScreen_Init, Screen_NullUpdate, Screen_NullFunc,
|
||||||
HUDScreen_Render, HUDScreen_BuildMesh,
|
HUDScreen_Render, HUDScreen_BuildMesh,
|
||||||
HUDScreen_KeyDown, HUDScreen_KeyUp, Screen_FKeyPress, Screen_FText,
|
HUDScreen_KeyDown, HUDScreen_KeyUp, Screen_FKeyPress, Screen_FText,
|
||||||
Screen_FPointer, Screen_FPointer, Screen_FPointer, Screen_FMouseScroll,
|
HUDscreen_PointerDown, Screen_FPointer, Screen_FPointer, Screen_FMouseScroll,
|
||||||
Screen_NullFunc, HUDScreen_ContextLost, HUDScreen_ContextRecreated
|
Screen_NullFunc, HUDScreen_ContextLost, HUDScreen_ContextRecreated
|
||||||
};
|
};
|
||||||
void HUDScreen_Show(void) {
|
void HUDScreen_Show(void) {
|
||||||
@ -1102,7 +1114,7 @@ static int InventoryScreen_PointerDown(void* screen, int id, int x, int y) {
|
|||||||
cc_bool handled, hotbar;
|
cc_bool handled, hotbar;
|
||||||
|
|
||||||
if (table->scroll.draggingId == id) return true;
|
if (table->scroll.draggingId == id) return true;
|
||||||
if (Elem_HandlesPointerDown(&Gui_HUD->hotbar, id, x, y)) return true;
|
if (HUDscreen_PointerDown(Gui_HUD, id, x, y)) return true;
|
||||||
handled = Elem_HandlesPointerDown(table, id, x, y);
|
handled = Elem_HandlesPointerDown(table, id, x, y);
|
||||||
|
|
||||||
if (!handled || table->pendingClose) {
|
if (!handled || table->pendingClose) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user