#pragma once #include namespace radiantwave { // Design resolution every page lays out against. The renderer's logical // presentation (LETTERBOX) scales this fixed space onto whatever // window/backbuffer the display actually provides. inline constexpr int kDesignWidth = 1920; inline constexpr int kDesignHeight = 1080; // Returns the size pages should lay out against: the renderer's logical size // when presentation is active, otherwise the real window size. The output // params are always written — design constants are the last-resort fallback. inline void getLayoutSize(SDL_Renderer *renderer, int *w, int *h) { if (!w || !h) return; *w = kDesignWidth; *h = kDesignHeight; if (!renderer) return; SDL_RendererLogicalPresentation mode = SDL_LOGICAL_PRESENTATION_DISABLED; int logicalW = 0; int logicalH = 0; if (SDL_GetRenderLogicalPresentation(renderer, &logicalW, &logicalH, &mode) && mode != SDL_LOGICAL_PRESENTATION_DISABLED && logicalW > 0 && logicalH > 0) { *w = logicalW; *h = logicalH; return; } SDL_Window *window = SDL_GetRenderWindow(renderer); if (!window) return; int windowW = 0; int windowH = 0; SDL_GetWindowSize(window, &windowW, &windowH); if (windowW > 0 && windowH > 0) { *w = windowW; *h = windowH; } } } // namespace radiantwave