mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 18:15:28 -04:00
For mobile, clicking last slot in inventory hotbar instead opens the inventory. Also replace 'inventory' with 'screenshot' in more menu.
This commit is contained in:
parent
31ea08eead
commit
fa355250c1
@ -13,6 +13,7 @@ extern struct IGameComponent Inventory_Component;
|
|||||||
#define INVENTORY_BLOCKS_PER_HOTBAR 9
|
#define INVENTORY_BLOCKS_PER_HOTBAR 9
|
||||||
/* Number of hotbars that can be selected between */
|
/* Number of hotbars that can be selected between */
|
||||||
#define INVENTORY_HOTBARS 9
|
#define INVENTORY_HOTBARS 9
|
||||||
|
#define HOTBAR_MAX_INDEX (INVENTORY_BLOCKS_PER_HOTBAR - 1)
|
||||||
|
|
||||||
CC_VAR extern struct _InventoryData {
|
CC_VAR extern struct _InventoryData {
|
||||||
/* Stores the currently bound blocks for all hotbars. */
|
/* Stores the currently bound blocks for all hotbars. */
|
||||||
|
@ -47,8 +47,7 @@ struct LWebTask {
|
|||||||
cc_result res; /* Error returned (e.g. for DNS failure) */
|
cc_result res; /* Error returned (e.g. for DNS failure) */
|
||||||
int status; /* HTTP return code for the request */
|
int status; /* HTTP return code for the request */
|
||||||
|
|
||||||
int reqID; /* Unique identifier for this web task. */
|
int reqID; /* Unique request identifier for this web task. */
|
||||||
String url; /* URL this task is downloading from/uploading to. */
|
|
||||||
/* Called when task successfully downloaded/uploaded data. */
|
/* Called when task successfully downloaded/uploaded data. */
|
||||||
void (*Handle)(cc_uint8* data, cc_uint32 len);
|
void (*Handle)(cc_uint8* data, cc_uint32 len);
|
||||||
};
|
};
|
||||||
@ -65,7 +64,7 @@ void GetTokenTask_Run(void);
|
|||||||
extern struct SignInTaskData {
|
extern struct SignInTaskData {
|
||||||
struct LWebTask Base;
|
struct LWebTask Base;
|
||||||
String username; /* Username to sign in as. Changed to case correct username. */
|
String username; /* Username to sign in as. Changed to case correct username. */
|
||||||
const char* error; /* If sign in fails, the reason as to why. */
|
const char* error; /* If sign in fails, the reason why. */
|
||||||
cc_bool needMFA; /* need login code for multifactor authentication */
|
cc_bool needMFA; /* need login code for multifactor authentication */
|
||||||
} SignInTask;
|
} SignInTask;
|
||||||
void SignInTask_Run(const String* user, const String* pass, const String* mfaCode);
|
void SignInTask_Run(const String* user, const String* pass, const String* mfaCode);
|
||||||
|
@ -3568,9 +3568,9 @@ static void TouchMore_Chat(void* s, void* w) {
|
|||||||
Gui_Remove((struct Screen*)&TouchMoreScreen);
|
Gui_Remove((struct Screen*)&TouchMoreScreen);
|
||||||
ChatScreen_OpenInput(&String_Empty);
|
ChatScreen_OpenInput(&String_Empty);
|
||||||
}
|
}
|
||||||
static void TouchMore_Inv(void* s, void* w) {
|
static void TouchMore_Take(void* s, void* w) {
|
||||||
Gui_Remove((struct Screen*)&TouchMoreScreen);
|
Gui_Remove((struct Screen*)&TouchMoreScreen);
|
||||||
InventoryScreen_Show();
|
Game_ScreenshotRequested = true;
|
||||||
}
|
}
|
||||||
static void TouchMore_Menu(void* s, void* w) {
|
static void TouchMore_Menu(void* s, void* w) {
|
||||||
Gui_Remove((struct Screen*)&TouchMoreScreen);
|
Gui_Remove((struct Screen*)&TouchMoreScreen);
|
||||||
@ -3587,7 +3587,7 @@ static const struct SimpleButtonDesc touchMore_btns[8] = {
|
|||||||
{ -160, 0, "Speed", TouchMore_Speed },
|
{ -160, 0, "Speed", TouchMore_Speed },
|
||||||
{ -160, 50, "Fly", TouchMore_Fly },
|
{ -160, 50, "Fly", TouchMore_Fly },
|
||||||
{ -160, 100, "Menu", TouchMore_Menu },
|
{ -160, 100, "Menu", TouchMore_Menu },
|
||||||
{ 160, -50, "Inventory", TouchMore_Inv },
|
{ 160, -50, "Screenshot", TouchMore_Take },
|
||||||
{ 160, 0, "Fullscreen", TouchMore_Screen },
|
{ 160, 0, "Fullscreen", TouchMore_Screen },
|
||||||
{ 160, 50, "Noclip", TouchMore_Noclip },
|
{ 160, 50, "Noclip", TouchMore_Noclip },
|
||||||
{ 160, 100, "Fog", TouchMore_Fog }
|
{ 160, 100, "Fog", TouchMore_Fog }
|
||||||
|
@ -416,6 +416,10 @@ static void HotbarWidget_RenderHotbarBlocks(struct HotbarWidget* w) {
|
|||||||
for (i = 0; i < INVENTORY_BLOCKS_PER_HOTBAR; i++) {
|
for (i = 0; i < INVENTORY_BLOCKS_PER_HOTBAR; i++) {
|
||||||
x = (int)(w->x + w->slotXOffset + width * i);
|
x = (int)(w->x + w->slotXOffset + width * i);
|
||||||
y = w->y + (w->height / 2);
|
y = w->y + (w->height / 2);
|
||||||
|
|
||||||
|
#ifdef CC_BUILD_TOUCH
|
||||||
|
if (i == HOTBAR_MAX_INDEX && Input_TouchMode) continue;
|
||||||
|
#endif
|
||||||
IsometricDrawer_DrawBatch(Inventory_Get(i), scale, x, y);
|
IsometricDrawer_DrawBatch(Inventory_Get(i), scale, x, y);
|
||||||
}
|
}
|
||||||
IsometricDrawer_EndBatch();
|
IsometricDrawer_EndBatch();
|
||||||
@ -510,11 +514,15 @@ static int HotbarWidget_PointerDown(void* widget, int id, int x, int y) {
|
|||||||
for (i = 0; i < INVENTORY_BLOCKS_PER_HOTBAR; i++) {
|
for (i = 0; i < INVENTORY_BLOCKS_PER_HOTBAR; i++) {
|
||||||
cellX = (int)(w->x + width * i);
|
cellX = (int)(w->x + width * i);
|
||||||
cellY = w->y;
|
cellY = w->y;
|
||||||
|
if (!Gui_Contains(cellX, cellY, width, height, x, y)) continue;
|
||||||
|
|
||||||
if (Gui_Contains(cellX, cellY, width, height, x, y)) {
|
#ifdef CC_BUILD_TOUCH
|
||||||
Inventory_SetSelectedIndex(i);
|
if (i == HOTBAR_MAX_INDEX && Input_TouchMode) {
|
||||||
return true;
|
InventoryScreen_Show(); return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
Inventory_SetSelectedIndex(i);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user