diff options
| author | 2015-03-08 21:45:45 -0400 | |
|---|---|---|
| committer | 2015-03-10 18:05:20 -0400 | |
| commit | 953e09ddb5cab8f4d8606966020e8eefa20e04ce (patch) | |
| tree | 9c128bb200272f233f6a4859640a74e34ba84b70 /src | |
| parent | HID: Cleanup how `next_touch_index` is calculated for Pad and touch. (diff) | |
| download | yuzu-953e09ddb5cab8f4d8606966020e8eefa20e04ce.tar.gz yuzu-953e09ddb5cab8f4d8606966020e8eefa20e04ce.tar.xz yuzu-953e09ddb5cab8f4d8606966020e8eefa20e04ce.zip | |
EmuWindow: Made pad/touch functions non-static.
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) { | |||
| 16 | return static_cast<EmuWindow_GLFW*>(glfwGetWindowUserPointer(win)); | 16 | return static_cast<EmuWindow_GLFW*>(glfwGetWindowUserPointer(win)); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | void EmuWindow_GLFW::OnMouseButtonEvent(GLFWwindow* window, int button, int action, int mods) { | 19 | void EmuWindow_GLFW::OnMouseButtonEvent(GLFWwindow* win, int button, int action, int mods) { |
| 20 | if (button == GLFW_MOUSE_BUTTON_LEFT) { | 20 | if (button == GLFW_MOUSE_BUTTON_LEFT) { |
| 21 | auto layout = GetEmuWindow(window)->GetFramebufferLayout(); | 21 | auto emu_window = GetEmuWindow(win); |
| 22 | auto layout = emu_window->GetFramebufferLayout(); | ||
| 22 | double x, y; | 23 | double x, y; |
| 23 | glfwGetCursorPos(window, &x, &y); | 24 | glfwGetCursorPos(win, &x, &y); |
| 24 | 25 | ||
| 25 | if (action == GLFW_PRESS) { | 26 | if (action == GLFW_PRESS) { |
| 26 | EmuWindow::TouchPressed(layout, static_cast<u16>(x), static_cast<u16>(y)); | 27 | emu_window->TouchPressed(layout, static_cast<u16>(x), static_cast<u16>(y)); |
| 27 | } else if (action == GLFW_RELEASE) { | 28 | } else if (action == GLFW_RELEASE) { |
| 28 | EmuWindow::TouchReleased(layout, static_cast<u16>(x), static_cast<u16>(y)); | 29 | emu_window->TouchReleased(layout, static_cast<u16>(x), static_cast<u16>(y)); |
| 29 | } | 30 | } |
| 30 | } | 31 | } |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | void EmuWindow_GLFW::OnCursorPosEvent(GLFWwindow* window, double x, double y) { | 34 | void EmuWindow_GLFW::OnCursorPosEvent(GLFWwindow* win, double x, double y) { |
| 34 | 35 | auto emu_window = GetEmuWindow(win); | |
| 35 | auto layout = GetEmuWindow(window)->GetFramebufferLayout(); | 36 | auto layout = emu_window->GetFramebufferLayout(); |
| 36 | EmuWindow::TouchMoved(layout, static_cast<u16>(x), static_cast<u16>(y)); | 37 | emu_window->TouchMoved(layout, static_cast<u16>(x), static_cast<u16>(y)); |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | /// Called by GLFW when a key event occurs | 40 | /// Called by GLFW when a key event occurs |
| 40 | void EmuWindow_GLFW::OnKeyEvent(GLFWwindow* win, int key, int scancode, int action, int mods) { | 41 | void EmuWindow_GLFW::OnKeyEvent(GLFWwindow* win, int key, int scancode, int action, int mods) { |
| 41 | 42 | auto emu_window = GetEmuWindow(win); | |
| 42 | int keyboard_id = GetEmuWindow(win)->keyboard_id; | 43 | int keyboard_id = emu_window->keyboard_id; |
| 43 | 44 | ||
| 44 | if (action == GLFW_PRESS) { | 45 | if (action == GLFW_PRESS) { |
| 45 | EmuWindow::KeyPressed({key, keyboard_id}); | 46 | emu_window->KeyPressed({key, keyboard_id}); |
| 46 | } else if (action == GLFW_RELEASE) { | 47 | } else if (action == GLFW_RELEASE) { |
| 47 | EmuWindow::KeyReleased({key, keyboard_id}); | 48 | emu_window->KeyReleased({ key, keyboard_id }); |
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | Service::HID::PadUpdateComplete(); | 51 | 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 @@ | |||
| 5 | #include "emu_window.h" | 5 | #include "emu_window.h" |
| 6 | #include "video_core/video_core.h" | 6 | #include "video_core/video_core.h" |
| 7 | 7 | ||
| 8 | bool EmuWindow::touch_pressed = false; | ||
| 9 | |||
| 10 | void EmuWindow::KeyPressed(KeyMap::HostDeviceKey key) { | 8 | void EmuWindow::KeyPressed(KeyMap::HostDeviceKey key) { |
| 11 | Service::HID::PadState mapped_key = KeyMap::GetPadKey(key); | 9 | Service::HID::PadState mapped_key = KeyMap::GetPadKey(key); |
| 12 | 10 | ||
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: | |||
| 71 | virtual void ReloadSetKeymaps() = 0; | 71 | virtual void ReloadSetKeymaps() = 0; |
| 72 | 72 | ||
| 73 | /// Signals a key press action to the HID module | 73 | /// Signals a key press action to the HID module |
| 74 | static void KeyPressed(KeyMap::HostDeviceKey key); | 74 | void KeyPressed(KeyMap::HostDeviceKey key); |
| 75 | 75 | ||
| 76 | /// Signals a key release action to the HID module | 76 | /// Signals a key release action to the HID module |
| 77 | static void KeyReleased(KeyMap::HostDeviceKey key); | 77 | void KeyReleased(KeyMap::HostDeviceKey key); |
| 78 | 78 | ||
| 79 | /** | 79 | /** |
| 80 | * Signal that a touch pressed event has occurred (e.g. mouse click pressed) | 80 | * Signal that a touch pressed event has occurred (e.g. mouse click pressed) |
| @@ -82,8 +82,7 @@ public: | |||
| 82 | * @param framebuffer_x Framebuffer x-coordinate that was pressed | 82 | * @param framebuffer_x Framebuffer x-coordinate that was pressed |
| 83 | * @param framebuffer_y Framebuffer y-coordinate that was pressed | 83 | * @param framebuffer_y Framebuffer y-coordinate that was pressed |
| 84 | */ | 84 | */ |
| 85 | static void TouchPressed(const FramebufferLayout& layout, unsigned framebuffer_x, | 85 | void TouchPressed(const FramebufferLayout& layout, unsigned framebuffer_x, unsigned framebuffer_y); |
| 86 | unsigned framebuffer_y); | ||
| 87 | 86 | ||
| 88 | /** | 87 | /** |
| 89 | * Signal that a touch released event has occurred (e.g. mouse click released) | 88 | * Signal that a touch released event has occurred (e.g. mouse click released) |
| @@ -91,8 +90,7 @@ public: | |||
| 91 | * @param framebuffer_x Framebuffer x-coordinate that was released | 90 | * @param framebuffer_x Framebuffer x-coordinate that was released |
| 92 | * @param framebuffer_y Framebuffer y-coordinate that was released | 91 | * @param framebuffer_y Framebuffer y-coordinate that was released |
| 93 | */ | 92 | */ |
| 94 | static void TouchReleased(const FramebufferLayout& layout, unsigned framebuffer_x, | 93 | void TouchReleased(const FramebufferLayout& layout, unsigned framebuffer_x, unsigned framebuffer_y); |
| 95 | unsigned framebuffer_y); | ||
| 96 | 94 | ||
| 97 | /** | 95 | /** |
| 98 | * Signal that a touch movement event has occurred (e.g. mouse was moved over the emu window) | 96 | * Signal that a touch movement event has occurred (e.g. mouse was moved over the emu window) |
| @@ -100,8 +98,7 @@ public: | |||
| 100 | * @param framebuffer_x Framebuffer x-coordinate | 98 | * @param framebuffer_x Framebuffer x-coordinate |
| 101 | * @param framebuffer_y Framebuffer y-coordinate | 99 | * @param framebuffer_y Framebuffer y-coordinate |
| 102 | */ | 100 | */ |
| 103 | static void TouchMoved(const FramebufferLayout& layout, unsigned framebuffer_x, | 101 | void TouchMoved(const FramebufferLayout& layout, unsigned framebuffer_x, unsigned framebuffer_y); |
| 104 | unsigned framebuffer_y); | ||
| 105 | 102 | ||
| 106 | /** | 103 | /** |
| 107 | * Returns currently active configuration. | 104 | * Returns currently active configuration. |
| @@ -196,5 +193,5 @@ private: | |||
| 196 | WindowConfig config; ///< Internal configuration (changes pending for being applied in ProcessConfigurationChanges) | 193 | WindowConfig config; ///< Internal configuration (changes pending for being applied in ProcessConfigurationChanges) |
| 197 | WindowConfig active_config; ///< Internal active configuration | 194 | WindowConfig active_config; ///< Internal active configuration |
| 198 | 195 | ||
| 199 | static bool touch_pressed; ///< True if touchpad area is currently pressed, otherwise false | 196 | bool touch_pressed; ///< True if touchpad area is currently pressed, otherwise false |
| 200 | }; | 197 | }; |