mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-04 14:09:47 +03:00
@@ -420,6 +420,11 @@ void Minecraft::tickInput()
|
||||
if (Mouse::isButtonDown(BUTTON_LEFT))
|
||||
m_gui.handleClick(1, Mouse::getX(), Mouse::getY());
|
||||
|
||||
#ifdef ENH_ALLOW_SCROLL_WHEEL
|
||||
if (Mouse::getEventButton() == BUTTON_SCROLLWHEEL)
|
||||
m_gui.handleScroll(Mouse::getEventButtonState() == 1);
|
||||
#endif
|
||||
|
||||
if (!bIsInGUI && getOptions()->field_19)
|
||||
{
|
||||
MouseButtonType buttonType = Mouse::getEventButton();
|
||||
@@ -428,32 +433,6 @@ void Minecraft::tickInput()
|
||||
handleMouseClick(buttonType);
|
||||
field_DAC = field_DA8;
|
||||
}
|
||||
|
||||
#ifdef ENH_ALLOW_SCROLL_WHEEL
|
||||
if (Mouse::getEventButton() == BUTTON_SCROLLWHEEL)
|
||||
{
|
||||
int slot = m_pLocalPlayer->m_pInventory->m_selectedHotbarSlot;
|
||||
|
||||
int maxItems = m_gui.getNumUsableSlots() - 1;
|
||||
|
||||
if (Mouse::getEventButtonState() == 0) // @NOTE: Scroll up
|
||||
{
|
||||
if (slot-- == 0)
|
||||
{
|
||||
slot = maxItems;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (slot++ == maxItems) // @NOTE: Scroll down
|
||||
{
|
||||
slot = 0;
|
||||
}
|
||||
}
|
||||
|
||||
m_pLocalPlayer->m_pInventory->selectSlot(slot);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1244,4 +1223,4 @@ void Minecraft::locateMultiplayer()
|
||||
m_pRakNetInstance->pingForHosts(C_DEFAULT_PORT);
|
||||
m_pNetEventCallback = new ClientSideNetworkHandler(this, m_pRakNetInstance);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,6 +446,26 @@ void Gui::handleClick(int clickID, int mouseX, int mouseY)
|
||||
m_pMinecraft->m_pLocalPlayer->m_pInventory->selectSlot(slot);
|
||||
}
|
||||
|
||||
void Gui::handleScroll(bool down)
|
||||
{
|
||||
int slot = m_pMinecraft->m_pLocalPlayer->m_pInventory->m_selectedHotbarSlot;
|
||||
|
||||
int maxItems = getNumUsableSlots() - 1;
|
||||
|
||||
if (down)
|
||||
{
|
||||
if (slot++ == maxItems)
|
||||
slot = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (slot-- == 0)
|
||||
slot = maxItems;
|
||||
}
|
||||
|
||||
m_pMinecraft->m_pLocalPlayer->m_pInventory->selectSlot(slot);
|
||||
}
|
||||
|
||||
void Gui::handleKeyPressed(int keyCode)
|
||||
{
|
||||
if (m_pMinecraft->getOptions()->isKey(KM_INVENTORY, keyCode))
|
||||
@@ -553,4 +573,4 @@ RectangleArea Gui::getRectangleArea(bool b)
|
||||
Minecraft::height - 24.0f / InvGuiScale,
|
||||
centerX + hotbarWidthHalf,
|
||||
Minecraft::height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
int getSlotIdAt(int mx, int my);
|
||||
bool isInside(int mx, int my);
|
||||
void handleClick(int id, int mx, int my);
|
||||
void handleScroll(bool down);
|
||||
void handleKeyPressed(int keyCode);
|
||||
void renderMessages(bool bShowAll);
|
||||
int getNumSlots(); // Gets the number of slots in the inventory. Includes the '...' if in touch mode.
|
||||
|
||||
@@ -120,6 +120,10 @@ void Screen::charInput(char chr)
|
||||
}
|
||||
}
|
||||
|
||||
void Screen::handleScroll(bool down)
|
||||
{
|
||||
}
|
||||
|
||||
static const char* g_panoramaList[] =
|
||||
{
|
||||
"gui/background/panorama_0.png",
|
||||
@@ -430,6 +434,8 @@ void Screen::mouseEvent()
|
||||
else
|
||||
mouseReleased(m_width * pAction->_posX / Minecraft::width, m_height * pAction->_posY / Minecraft::height - 1 + getYOffset(), Mouse::getEventButton());
|
||||
}
|
||||
if (pAction->_buttonType == BUTTON_SCROLLWHEEL)
|
||||
handleScroll(Mouse::getEventButtonState());
|
||||
}
|
||||
|
||||
void Screen::renderBackground(int unk)
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
virtual void mouseReleased(int, int, int);
|
||||
virtual void keyPressed(int);
|
||||
virtual void charInput(char);
|
||||
virtual void handleScroll(bool down);
|
||||
|
||||
// ported from 0.8
|
||||
virtual void renderMenuBackground(float f);
|
||||
|
||||
@@ -335,3 +335,10 @@ void RolledSelectionList::clickedHeader(int x, int y)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RolledSelectionList::handleScroll(bool down)
|
||||
{
|
||||
float diff = 5.0f * (down ? -1.0f : 1.0f);
|
||||
field_34 = field_30 = field_30 + diff;
|
||||
field_28 = 0;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
virtual void renderBackground() = 0;
|
||||
virtual void renderDecorations(int x, int y);
|
||||
virtual void clickedHeader(int, int);
|
||||
virtual void handleScroll(bool down);
|
||||
|
||||
int getItemAtXPositionRaw(int x);
|
||||
|
||||
|
||||
@@ -97,7 +97,6 @@ void ScrolledSelectionList::renderScrollBackground()
|
||||
|
||||
void ScrolledSelectionList::checkInput(int mouseX, int mouseY)
|
||||
{
|
||||
int nItems = getNumberOfItems();
|
||||
if (Mouse::isButtonDown(BUTTON_LEFT))
|
||||
{
|
||||
if (float(mouseY) >= field_C && float(mouseY) <= field_10 && abs(mouseY - field_28) > 5)
|
||||
@@ -276,3 +275,10 @@ void ScrolledSelectionList::setRenderHeader(bool b, int i)
|
||||
i = 0;
|
||||
field_48 = i;
|
||||
}
|
||||
|
||||
void ScrolledSelectionList::handleScroll(bool down)
|
||||
{
|
||||
float diff = 5.0f * (down ? -1.0f : 1.0f);
|
||||
field_34 -= diff;
|
||||
field_38 += diff;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
virtual void checkInput(int mouseX, int mouseY);
|
||||
virtual void onClickItem(int index, int mouseX, int mouseY);
|
||||
virtual void renderScrollBackground();
|
||||
virtual void handleScroll(bool down);
|
||||
|
||||
void setRenderHeader(bool, int);
|
||||
|
||||
|
||||
@@ -71,6 +71,10 @@ void OptionsScreen::buttonClicked(Button* pButton)
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsScreen::handleScroll(bool down)
|
||||
{
|
||||
m_pList->handleScroll(down);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
void render(int, int, float) override;
|
||||
void removed() override;
|
||||
void buttonClicked(Button* pButton) override;
|
||||
void handleScroll(bool down) override;
|
||||
|
||||
private:
|
||||
OptionList* m_pList;
|
||||
|
||||
@@ -222,6 +222,11 @@ void SelectWorldScreen::buttonClicked(Button* pButton)
|
||||
}
|
||||
}
|
||||
|
||||
void SelectWorldScreen::handleScroll(bool down)
|
||||
{
|
||||
m_pWorldSelectionList->handleScroll(down);
|
||||
}
|
||||
|
||||
bool SelectWorldScreen::isIndexValid(int idx)
|
||||
{
|
||||
if (!m_pWorldSelectionList)
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
void render(int mouseX, int mouseY, float f) override;
|
||||
bool handleBackEvent(bool b) override;
|
||||
void buttonClicked(Button* pButton) override;
|
||||
void handleScroll(bool down) override;
|
||||
|
||||
bool isIndexValid(int);
|
||||
std::string getUniqueLevelName(const std::string& in);
|
||||
|
||||
Reference in New Issue
Block a user