In touchscreen mode, click button after release

This commit is contained in:
TheBrokenRail
2023-11-02 16:46:04 -04:00
committed by iProgramInCpp
parent f9b07014d2
commit c47457725e

View File

@@ -242,9 +242,12 @@ void Screen::mouseClicked(int xPos, int yPos, int d) // d = clicked?
if (button->clicked(m_pMinecraft, xPos, yPos))
{
m_pClickedButton = button;
m_pMinecraft->m_pSoundEngine->play("random.click");
buttonClicked(button);
if (!m_pMinecraft->isTouchscreen())
{
m_pMinecraft->m_pSoundEngine->play("random.click");
buttonClicked(button);
}
}
}
@@ -293,6 +296,11 @@ void Screen::mouseReleased(int xPos, int yPos, int d)
if (m_pClickedButton)
{
m_pClickedButton->released(xPos, yPos);
if (m_pMinecraft->isTouchscreen())
{
m_pMinecraft->m_pSoundEngine->play("random.click");
buttonClicked(m_pClickedButton);
}
m_pClickedButton = nullptr;
}
}