diff options
author | bunnei <bunneidev@gmail.com> | 2015-03-09 02:45:45 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-03-10 23:05:20 +0100 |
commit | 953e09ddb5cab8f4d8606966020e8eefa20e04ce (patch) | |
tree | 9c128bb200272f233f6a4859640a74e34ba84b70 /src | |
parent | HID: Cleanup how `next_touch_index` is calculated for Pad and touch. (diff) | |
download | yuzu-953e09ddb5cab8f4d8606966020e8eefa20e04ce.tar yuzu-953e09ddb5cab8f4d8606966020e8eefa20e04ce.tar.gz yuzu-953e09ddb5cab8f4d8606966020e8eefa20e04ce.tar.bz2 yuzu-953e09ddb5cab8f4d8606966020e8eefa20e04ce.tar.lz yuzu-953e09ddb5cab8f4d8606966020e8eefa20e04ce.tar.xz yuzu-953e09ddb5cab8f4d8606966020e8eefa20e04ce.tar.zst yuzu-953e09ddb5cab8f4d8606966020e8eefa20e04ce.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/citra/emu_window/emu_window_glfw.cpp | 27 | ||||
-rw-r--r-- | src/common/emu_window.cpp | 2 | ||||
-rw-r--r-- | src/common/emu_window.h | 15 |
3 files changed, 20 insertions, 24 deletions
diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp index 8a0cd9b5a..3e58d6663 100644 --- a/src/citra/emu_window/emu_window_glfw.cpp +++ b/src/citra/emu_window/emu_window_glfw.cpp @@ -16,35 +16,36 @@ EmuWindow_GLFW* EmuWindow_GLFW::GetEmuWindow(GLFWwindow* win) { return static_cast<EmuWindow_GLFW*>(glfwGetWindowUserPointer(win)); } -void EmuWindow_GLFW::OnMouseButtonEvent(GLFWwindow* window, int button, int action, int mods) { +void EmuWindow_GLFW::OnMouseButtonEvent(GLFWwindow* win, int button, int action, int mods) { if (button == GLFW_MOUSE_BUTTON_LEFT) { - auto layout = GetEmuWindow(window)->GetFramebufferLayout(); + auto emu_window = GetEmuWindow(win); + auto layout = emu_window->GetFramebufferLayout(); double x, y; - glfwGetCursorPos(window, &x, &y); + glfwGetCursorPos(win, &x, &y); if (action == GLFW_PRESS) { - EmuWindow::TouchPressed(layout, static_cast<u16>(x), static_cast<u16>(y)); + emu_window->TouchPressed(layout, static_cast<u16>(x), static_cast<u16>(y)); } else if (action == GLFW_RELEASE) { - EmuWindow::TouchReleased(layout, static_cast<u16>(x), static_cast<u16>(y)); + emu_window->TouchReleased(layout, static_cast<u16>(x), static_cast<u16>(y)); } } } -void EmuWindow_GLFW::OnCursorPosEvent(GLFWwindow* window, double x, double y) { - - auto layout = GetEmuWindow(window)->GetFramebufferLayout(); - EmuWindow::TouchMoved(layout, static_cast<u16>(x), static_cast<u16>(y)); +void EmuWindow_GLFW::OnCursorPosEvent(GLFWwindow* win, double x, double y) { + auto emu_window = GetEmuWindow(win); + auto layout = emu_window->GetFramebufferLayout(); + emu_window->TouchMoved(layout, static_cast<u16>(x), static_cast<u16>(y)); } /// Called by GLFW when a key event occurs void EmuWindow_GLFW::OnKeyEvent(GLFWwindow* win, int key, int scancode, int action, int mods) { - - int keyboard_id = GetEmuWindow(win)->keyboard_id; + auto emu_window = GetEmuWindow(win); + int keyboard_id = emu_window->keyboard_id; if (action == GLFW_PRESS) { - EmuWindow::KeyPressed({key, keyboard_id}); + emu_window->KeyPressed({key, keyboard_id}); } else if (action == GLFW_RELEASE) { - EmuWindow::KeyReleased({key, keyboard_id}); + emu_window->KeyReleased({ key, keyboard_id }); } Service::HID::PadUpdateComplete(); diff --git a/src/common/emu_window.cpp b/src/common/emu_window.cpp index 11e6ad76b..89bb89481 100644 --- a/src/common/emu_window.cpp +++ b/src/common/emu_window.cpp @@ -5,8 +5,6 @@ #include "emu_window.h" #include "video_core/video_core.h" -bool EmuWindow::touch_pressed = false; - void EmuWindow::KeyPressed(KeyMap::HostDeviceKey key) { Service::HID::PadState mapped_key = KeyMap::GetPadKey(key); diff --git a/src/common/emu_window.h b/src/common/emu_window.h index df81e9e0f..8e4b510e9 100644 --- a/src/common/emu_window.h +++ b/src/common/emu_window.h @@ -71,10 +71,10 @@ public: virtual void ReloadSetKeymaps() = 0; /// Signals a key press action to the HID module - static void KeyPressed(KeyMap::HostDeviceKey key); + void KeyPressed(KeyMap::HostDeviceKey key); /// Signals a key release action to the HID module - static void KeyReleased(KeyMap::HostDeviceKey key); + void KeyReleased(KeyMap::HostDeviceKey key); /** * Signal that a touch pressed event has occurred (e.g. mouse click pressed) @@ -82,8 +82,7 @@ public: * @param framebuffer_x Framebuffer x-coordinate that was pressed * @param framebuffer_y Framebuffer y-coordinate that was pressed */ - static void TouchPressed(const FramebufferLayout& layout, unsigned framebuffer_x, - unsigned framebuffer_y); + void TouchPressed(const FramebufferLayout& layout, unsigned framebuffer_x, unsigned framebuffer_y); /** * Signal that a touch released event has occurred (e.g. mouse click released) @@ -91,8 +90,7 @@ public: * @param framebuffer_x Framebuffer x-coordinate that was released * @param framebuffer_y Framebuffer y-coordinate that was released */ - static void TouchReleased(const FramebufferLayout& layout, unsigned framebuffer_x, - unsigned framebuffer_y); + void TouchReleased(const FramebufferLayout& layout, unsigned framebuffer_x, unsigned framebuffer_y); /** * Signal that a touch movement event has occurred (e.g. mouse was moved over the emu window) @@ -100,8 +98,7 @@ public: * @param framebuffer_x Framebuffer x-coordinate * @param framebuffer_y Framebuffer y-coordinate */ - static void TouchMoved(const FramebufferLayout& layout, unsigned framebuffer_x, - unsigned framebuffer_y); + void TouchMoved(const FramebufferLayout& layout, unsigned framebuffer_x, unsigned framebuffer_y); /** * Returns currently active configuration. @@ -196,5 +193,5 @@ private: WindowConfig config; ///< Internal configuration (changes pending for being applied in ProcessConfigurationChanges) WindowConfig active_config; ///< Internal active configuration - static bool touch_pressed; ///< True if touchpad area is currently pressed, otherwise false + bool touch_pressed; ///< True if touchpad area is currently pressed, otherwise false }; |