mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-04 19:36:43 +03:00
Add enhancement to support scroll wheel for inventory
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#define ENH_HIGHLIGHT_BY_HOVER // Highlight buttons by hovering them instead of the usual way.
|
||||
#define ENH_ALLOW_SAND_GRAVITY // Allow sand to fall.
|
||||
#define ENH_USE_GUI_SCALE_2 // Use a 2x GUI scale instead of 3x. Looks better on PC
|
||||
#define ENH_ALLOW_SCROLL_WHEEL // Allow use of the scroll wheel to change selected inventory slots
|
||||
|
||||
// Mods
|
||||
//#define MOD_USE_FLAT_WORLD // Use a flat world instead of the regular world generation
|
||||
|
||||
@@ -135,6 +135,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
break;
|
||||
}
|
||||
#ifdef ENH_ALLOW_SCROLL_WHEEL
|
||||
case WM_MOUSEWHEEL:
|
||||
Mouse::feed(3, GET_WHEEL_DELTA_WPARAM(wParam), g_MousePosX, g_MousePosY);
|
||||
|
||||
break;
|
||||
#endif
|
||||
case WM_SIZE:
|
||||
{
|
||||
UINT width = LOWORD(lParam);
|
||||
|
||||
@@ -341,6 +341,35 @@ void Minecraft::tickInput()
|
||||
handleMouseClick(2);
|
||||
field_DAC = field_DA8;
|
||||
}
|
||||
#ifdef ENH_ALLOW_SCROLL_WHEEL
|
||||
if (input.field_0 == 3)
|
||||
{
|
||||
int slot = m_pLocalPlayer->m_pInventory->m_SelectedHotbarSlot;
|
||||
|
||||
#ifdef ENH_ENABLE_9TH_SLOT
|
||||
#define MAX_ITEMS (C_MAX_HOTBAR_ITEMS - 1)
|
||||
#else
|
||||
#define MAX_ITEMS (C_MAX_HOTBAR_ITEMS - 2)
|
||||
#endif
|
||||
|
||||
if (input.field_4 > 0) // @NOTE: Scroll up
|
||||
{
|
||||
if (slot-- == 0)
|
||||
{
|
||||
slot = MAX_ITEMS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (slot++ == MAX_ITEMS) // @NOTE: Scroll down
|
||||
{
|
||||
slot = 0;
|
||||
}
|
||||
}
|
||||
|
||||
m_pLocalPlayer->m_pInventory->selectSlot(slot);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user