#ifndef CORE_PLATFORM_H #define CORE_PLATFORM_H /* Window, OpenGL context, frame timing and asset lookup (SDL3). */ #include #include #include typedef struct { SDL_Window *window; SDL_GLContext gl_context; Uint64 last_ticks_ns; Uint64 frame_start_ns; /* (the frame cap: when the last frame was shown) */ bool sdl_ready; } Platform; bool Platform_init(Platform *p, const char *title, int width, int height); void Platform_shutdown(Platform *p); /* Seconds elapsed since the previous call (or since init). */ float Platform_frameDelta(Platform *p); /* Framebuffer size in pixels (HiDPI aware). */ void Platform_drawableSize(const Platform *p, int *width, int *height); /* Shows the frame: vsync, and never more than FRAME_CAP frames a second (the GPU gets to rest). */ #define FRAME_CAP 60 void Platform_swap(Platform *p); /* Window size in window coordinates (the mouse uses these). */ void Platform_windowSize(const Platform *p, int *width, int *height); /* Mouse captured for looking around (hidden), or a free pointer (menus). */ void Platform_captureMouse(const Platform *p, bool captured); /* * Builds the full path of an asset (e.g. "shaders/basic.vert"). * Looks next to the executable first ("/assets/"), * then in the install location (ASSET_DIR, set by the Makefile). */ bool Platform_assetPath(const char *relative, char *out, size_t out_size); /* Where the saves go (the user's data folder: e.g. ~/.local/share/entropie/entropie/saves). */ bool Platform_saveDir(char *out, size_t out_size); /* Typing text on / off (a save's name): letters come as Input.text, not as keys. */ void Platform_typing(const Platform *p, bool on); #endif /* CORE_PLATFORM_H */