332{
333 auto* win =
static_cast<GlfwWindow*
>(glfwGetWindowUserPointer(window));
334 if (!win)
335 return;
336
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.