// Handles windowing, input, and native surface creation. #pragma once // Forward declare GLFWwindow to avoid including the full header here. struct GLFWwindow; struct PlatformState { GLFWwindow* window = nullptr; int width = 1280; int height = 720; bool is_fullscreen = false; // Store windowed geometry for fullscreen toggle int windowed_x = 0, windowed_y = 0, windowed_w = 0, windowed_h = 0; }; void platform_init(PlatformState* state, bool fullscreen, int* width_ptr, int* height_ptr); void platform_shutdown(PlatformState* state); void platform_poll(PlatformState* state); bool platform_should_close(PlatformState* state); void platform_toggle_fullscreen(PlatformState* state); // Inline getters for direct access inline GLFWwindow* platform_get_window(PlatformState* state) { return state->window; } inline int platform_get_width(PlatformState* state) { return state->width; } inline int platform_get_height(PlatformState* state) { return state->height; } inline float platform_get_aspect_ratio(PlatformState* state) { if (state->height == 0) return 1.0f; return (float)state->width / (float)state->height; } // glfwGetTime is a simple global query, so it doesn't need the state struct. // Include the header directly to get the proper linkage. #include inline double platform_get_time() { return glfwGetTime(); } // WebGPU specific surface creation #if defined(DEMO_CROSS_COMPILE_WIN32) #include #else #include #endif WGPUSurface platform_create_wgpu_surface(WGPUInstance instance, PlatformState* state);