void EmuWindow_GLFW::OnClientAreaResizeEvent(GLFWwindow* win, int width, int height) { _dbg_assert_(GUI, width > 0); _dbg_assert_(GUI, height > 0); // NOTE: GLFW provides no proper way to set a minimal window size. // Hence, we just ignore the corresponding EmuWindow hint. GetEmuWindow(win)->NotifyClientAreaSizeChanged(std::pair<unsigned,unsigned>(width, height)); }
/// Called by GLFW when a key event occurs void EmuWindow_GLFW::OnKeyEvent(GLFWwindow* win, int key, int scancode, int action, int mods) { auto emu_window = GetEmuWindow(win); int keyboard_id = emu_window->keyboard_id; if (action == GLFW_PRESS) { emu_window->KeyPressed({key, keyboard_id}); } else if (action == GLFW_RELEASE) { emu_window->KeyReleased({key, keyboard_id}); } }
/// 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; if (action == GLFW_PRESS) { EmuWindow::KeyPressed({key, keyboard_id}); } else if (action == GLFW_RELEASE) { EmuWindow::KeyReleased({key, keyboard_id}); } HID_User::PadUpdateComplete(); }
void EmuWindow_GLFW::OnMouseButtonEvent(GLFWwindow* win, int button, int action, int mods) { if (button == GLFW_MOUSE_BUTTON_LEFT) { auto emu_window = GetEmuWindow(win); auto layout = emu_window->GetFramebufferLayout(); double x, y; glfwGetCursorPos(win, &x, &y); if (action == GLFW_PRESS) emu_window->TouchPressed(static_cast<unsigned>(x), static_cast<unsigned>(y)); else if (action == GLFW_RELEASE) emu_window->TouchReleased(); } }
void EmuWindow_GLFW::OnFramebufferResizeEvent(GLFWwindow* win, int width, int height) { _dbg_assert_(GUI, width > 0); _dbg_assert_(GUI, height > 0); GetEmuWindow(win)->NotifyFramebufferSizeChanged(std::pair<unsigned,unsigned>(width, height)); }
void EmuWindow_GLFW::OnFramebufferResizeEvent(GLFWwindow* win, int width, int height) { GetEmuWindow(win)->NotifyFramebufferLayoutChanged(EmuWindow::FramebufferLayout::DefaultScreenLayout(width, height)); }
void EmuWindow_GLFW::OnCursorPosEvent(GLFWwindow* win, double x, double y) { GetEmuWindow(win)->TouchMoved(static_cast<unsigned>(std::max(x, 0.0)), static_cast<unsigned>(std::max(y, 0.0))); }