317{
318 auto* win =
static_cast<GlfwWindow*
>(glfwGetWindowUserPointer(window));
319 if (!win)
320 return;
321
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.