MayaFlux 0.3.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 331 of file GlfwWindow.cpp.

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