327{
328 auto* win =
static_cast<GlfwWindow*
>(glfwGetWindowUserPointer(window));
329 if (!win)
330 return;
331
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.