MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ glfw_key_callback()

void MayaFlux::Core::GlfwWindow::glfw_key_callback ( GLFWwindow *  window,
int  key,
int  scancode,
int  action,
int  mods 
)
staticprivate

Definition at line 316 of file GlfwWindow.cpp.

317{
318 auto* win = static_cast<GlfwWindow*>(glfwGetWindowUserPointer(window));
319 if (!win)
320 return;
321
322 WindowEventType type;
323 switch (action) {
324 case GLFW_PRESS:
326 break;
327 case GLFW_RELEASE:
329 break;
330 case GLFW_REPEAT:
332 break;
333 default:
334 return;
335 }
336
337 WindowEvent event;
338 event.type = type;
339 event.timestamp = glfwGetTime();
340 event.data = WindowEvent::KeyData {
341 .key = key,
342 .scancode = scancode,
343 .mods = mods
344 };
345
346 win->m_event_source.signal(event);
347
348 if (win->m_event_callback) {
349 win->m_event_callback(event);
350 }
351}
GlfwWindow(const WindowCreateInfo &create_info, const GraphicsSurfaceInfo &surface_info, GlobalGraphicsConfig::GraphicsApi api, GlfwPreInitConfig pre_init_config={})
Creates a window with the given configuration.
WindowEventType
Types of window and input events.

References MayaFlux::Core::WindowEvent::KeyData::key, MayaFlux::Core::KEY_PRESSED, MayaFlux::Core::KEY_RELEASED, MayaFlux::Core::KEY_REPEAT, and MayaFlux::Core::WindowEvent::type.

Referenced by setup_callbacks().

+ Here is the caller graph for this function: