From 5d098ca88bd11f0af09c95c9e91166fb82faa07b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Jun 2013 15:12:18 +0200 Subject: [PATCH] Fix mouse bug in SDL port --- base/PCMain.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/base/PCMain.cpp b/base/PCMain.cpp index 22b951e7d8..74b8d31f77 100644 --- a/base/PCMain.cpp +++ b/base/PCMain.cpp @@ -515,7 +515,6 @@ int main(int argc, char *argv[]) { #endif int framecount = 0; - bool nextFrameMD = 0; float t = 0, lastT = 0; while (true) { input_state.accelerometer_valid = false; @@ -533,6 +532,19 @@ int main(int argc, char *argv[]) { if (event.key.keysym.sym == SDLK_ESCAPE) { quitRequested = 1; } + } else if (event.type == SDL_MOUSEBUTTONDOWN) { + if (event.button.button == SDL_BUTTON_LEFT) { + input_state.pointer_x[0] = mx; + input_state.pointer_y[0] = my; + //input_state.mouse_buttons_down = 1; + input_state.pointer_down[0] = true; + TouchInput input; + input.x = mx; + input.y = my; + input.flags = TOUCH_DOWN; + input.id = 0; + NativeTouch(input); + } } else if (event.type == SDL_MOUSEMOTION) { if (input_state.pointer_down[0]) { input_state.pointer_x[0] = mx; @@ -544,22 +556,11 @@ int main(int argc, char *argv[]) { input.id = 0; NativeTouch(input); } - } else if (event.type == SDL_MOUSEBUTTONDOWN) { - if (event.button.button == SDL_BUTTON_LEFT) { - //input_state.mouse_buttons_down = 1; - input_state.pointer_down[0] = true; - nextFrameMD = true; - TouchInput input; - input.x = mx; - input.y = my; - input.flags = TOUCH_DOWN; - input.id = 0; - NativeTouch(input); - } } else if (event.type == SDL_MOUSEBUTTONUP) { if (event.button.button == SDL_BUTTON_LEFT) { + input_state.pointer_x[0] = mx; + input_state.pointer_y[0] = my; input_state.pointer_down[0] = false; - nextFrameMD = false; //input_state.mouse_buttons_up = 1; TouchInput input; input.x = mx;