Просмотр исходного кода

testbed: fixed logical size for simplicity

skypjack 22 часов назад
Родитель
Сommit
17c609c3d9
2 измененных файлов с 9 добавлено и 4 удалено
  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=(context &&) = delete;
 
+    static constexpr auto logical_width() noexcept {
+        return 1920;
+    }
+
+    static constexpr auto logical_height() noexcept {
+        return 1080;
+    }
+
     SDL_Window *window() const noexcept;
     SDL_Renderer *renderer() const noexcept;
 

+ 1 - 4
testbed/system/rendering_system.cpp

@@ -9,10 +9,7 @@
 namespace testbed {
 
 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_RenderClear(ctx);