summaryrefslogtreecommitdiff
path: root/src/citra/emu_window/emu_window_glfw.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra/emu_window/emu_window_glfw.cpp')
-rw-r--r--src/citra/emu_window/emu_window_glfw.cpp27
1 files changed, 14 insertions, 13 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
19void EmuWindow_GLFW::OnMouseButtonEvent(GLFWwindow* window, int button, int action, int mods) { 19void 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
33void EmuWindow_GLFW::OnCursorPosEvent(GLFWwindow* window, double x, double y) { 34void 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
40void EmuWindow_GLFW::OnKeyEvent(GLFWwindow* win, int key, int scancode, int action, int mods) { 41void 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();