Explorar o código

testbed: fixed logical size for simplicity

skypjack hai 1 día
pai
achega
17c609c3d9
Modificáronse 2 ficheiros con 9 adicións e 4 borrados
  1. 8 0
      testbed/application/context.h
  2. 1 4
      testbed/system/rendering_system.cpp

+ 8 - 0
testbed/application/context.h

@@ -15,6 +15,14 @@ struct context {
     context &operator=(const context &) = delete;
     context &operator=(const context &) = delete;
     context &operator=(context &&) = delete;
     context &operator=(context &&) = delete;
 
 
+    static constexpr auto logical_width() noexcept {
+        return 1920;
+    }
+
+    static constexpr auto logical_height() noexcept {
+        return 1080;
+    }
+
     SDL_Window *window() const noexcept;
     SDL_Window *window() const noexcept;
     SDL_Renderer *renderer() const noexcept;
     SDL_Renderer *renderer() const noexcept;
 
 

+ 1 - 4
testbed/system/rendering_system.cpp

@@ -9,10 +9,7 @@
 namespace testbed {
 namespace testbed {
 
 
 void rendering_system(entt::registry &registry, const context &ctx) {
 void rendering_system(entt::registry &registry, const context &ctx) {
-    constexpr int logical_width = 1920;
-    constexpr int logical_height = 1080;
-
-    SDL_SetRenderLogicalPresentation(ctx, logical_width, logical_height, SDL_LOGICAL_PRESENTATION_LETTERBOX);
+    SDL_SetRenderLogicalPresentation(ctx, ctx.logical_width(), ctx.logical_height(), SDL_LOGICAL_PRESENTATION_LETTERBOX);
     SDL_SetRenderDrawColor(ctx, 0u, 0u, 0u, SDL_ALPHA_OPAQUE);
     SDL_SetRenderDrawColor(ctx, 0u, 0u, 0u, SDL_ALPHA_OPAQUE);
     SDL_RenderClear(ctx);
     SDL_RenderClear(ctx);