MayaFlux 0.2.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 326 of file GlfwWindow.cpp.

327{
328 auto* win = static_cast<GlfwWindow*>(glfwGetWindowUserPointer(window));
329 if (!win)
330 return;
331
332 WindowEventType type {};
333 switch (action) {
334 case GLFW_PRESS:
336 break;
337 case GLFW_RELEASE:
339 break;
340 case GLFW_REPEAT:
342 break;
343 default:
344 return;
345 }
346
347 WindowEvent event;
348 event.type = type;
349 event.timestamp = glfwGetTime();
350 event.data = WindowEvent::KeyData {
351 .key = key,
352 .scancode = scancode,
353 .mods = mods
354 };
355
356 win->m_event_source.signal(event);
357
358 if (win->m_event_callback) {
359 win->m_event_callback(event);
360 }
361}
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: