diff --git a/platforms/sdl/main.cpp b/platforms/sdl/main.cpp index 784856a..b85d9a0 100644 --- a/platforms/sdl/main.cpp +++ b/platforms/sdl/main.cpp @@ -51,14 +51,14 @@ static int TranslateSDLKeyCodeToVirtual(int sdlCode) #define TOUCH_IDS_SIZE (MAX_TOUCHES - 1) // ID 0 Is Reserved For The Mouse struct touch_id_data { bool active = false; - int id; + int device; + int finger; }; static touch_id_data touch_ids[TOUCH_IDS_SIZE]; static char get_touch_id(int device, int finger) { - int real_id = (device * 100) + finger; for (int i = 0; i < TOUCH_IDS_SIZE; i++) { touch_id_data &data = touch_ids[i]; - if (data.active && data.id == real_id) { + if (data.active && data.device == device && data.finger == finger) { return i + 1; } } @@ -68,7 +68,8 @@ static char get_touch_id(int device, int finger) { touch_id_data &data = touch_ids[i]; if (!data.active) { data.active = true; - data.id = real_id; + data.device = device; + data.finger = finger; return i + 1; } } @@ -241,7 +242,6 @@ static void resize() } // Main Loop -static bool is_first_window_resize = true; static EM_BOOL main_loop(double time, void *user_data) { // Handle Events diff --git a/source/client/gui/Screen.cpp b/source/client/gui/Screen.cpp index b2b76f2..5cafe87 100644 --- a/source/client/gui/Screen.cpp +++ b/source/client/gui/Screen.cpp @@ -295,12 +295,12 @@ void Screen::mouseReleased(int xPos, int yPos, int d) if (m_pClickedButton) { - m_pClickedButton->released(xPos, yPos); - if (m_pMinecraft->isTouchscreen()) + if (m_pMinecraft->isTouchscreen() && button->clicked(m_pMinecraft, xPos, yPos)) { m_pMinecraft->m_pSoundEngine->play("random.click"); buttonClicked(m_pClickedButton); } + m_pClickedButton->released(xPos, yPos); m_pClickedButton = nullptr; } }