From c0e96216ae6f2b5e223304548fdd5de7a31a7690 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 12 Apr 2025 13:48:24 -0500 Subject: [PATCH] [turbine] Make accessor functions take const ref to Context --- src/olympic/turbine/include/turbine/gfx.hpp | 8 ++++---- src/olympic/turbine/src/gba/gfx.cpp | 8 ++++---- src/olympic/turbine/src/glfw/gfx.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/olympic/turbine/include/turbine/gfx.hpp b/src/olympic/turbine/include/turbine/gfx.hpp index 4dfa1713..52c15563 100644 --- a/src/olympic/turbine/include/turbine/gfx.hpp +++ b/src/olympic/turbine/include/turbine/gfx.hpp @@ -33,15 +33,15 @@ void setWindowTitle(Context &ctx, ox::StringViewCR title) noexcept; void focusWindow(Context &ctx) noexcept; [[nodiscard]] -int getScreenWidth(Context &ctx) noexcept; +int getScreenWidth(Context const &ctx) noexcept; [[nodiscard]] -int getScreenHeight(Context &ctx) noexcept; +int getScreenHeight(Context const &ctx) noexcept; [[nodiscard]] -ox::Size getScreenSize(Context &ctx) noexcept; +ox::Size getScreenSize(Context const &ctx) noexcept; -ox::Bounds getWindowBounds(Context &ctx) noexcept; +ox::Bounds getWindowBounds(Context const &ctx) noexcept; ox::Error setWindowBounds(Context &ctx, ox::Bounds const&bnds) noexcept; diff --git a/src/olympic/turbine/src/gba/gfx.cpp b/src/olympic/turbine/src/gba/gfx.cpp index 393cb745..3d0bf448 100644 --- a/src/olympic/turbine/src/gba/gfx.cpp +++ b/src/olympic/turbine/src/gba/gfx.cpp @@ -27,19 +27,19 @@ ox::Error initGfx(Context&) noexcept { void setWindowTitle(Context&, ox::StringViewCR) noexcept { } -int getScreenWidth(Context&) noexcept { +int getScreenWidth(Context const&) noexcept { return 240; } -int getScreenHeight(Context&) noexcept { +int getScreenHeight(Context const&) noexcept { return 160; } -ox::Size getScreenSize(Context&) noexcept { +ox::Size getScreenSize(Context const&) noexcept { return {240, 160}; } -ox::Bounds getWindowBounds(Context&) noexcept { +ox::Bounds getWindowBounds(Context const&) noexcept { return {0, 0, 240, 160}; } diff --git a/src/olympic/turbine/src/glfw/gfx.cpp b/src/olympic/turbine/src/glfw/gfx.cpp index 6de8a52e..66761585 100644 --- a/src/olympic/turbine/src/glfw/gfx.cpp +++ b/src/olympic/turbine/src/glfw/gfx.cpp @@ -272,25 +272,25 @@ void focusWindow(Context &ctx) noexcept { glfwFocusWindow(ctx.window); } -int getScreenWidth(Context &ctx) noexcept { +int getScreenWidth(Context const &ctx) noexcept { int w = 0, h = 0; glfwGetFramebufferSize(ctx.window, &w, &h); return w; } -int getScreenHeight(Context &ctx) noexcept { +int getScreenHeight(Context const &ctx) noexcept { int w = 0, h = 0; glfwGetFramebufferSize(ctx.window, &w, &h); return h; } -ox::Size getScreenSize(Context &ctx) noexcept { +ox::Size getScreenSize(Context const &ctx) noexcept { int w = 0, h = 0; glfwGetFramebufferSize(ctx.window, &w, &h); return {w, h}; } -ox::Bounds getWindowBounds(Context &ctx) noexcept { +ox::Bounds getWindowBounds(Context const &ctx) noexcept { ox::Bounds bnds; glfwGetWindowPos(ctx.window, &bnds.x, &bnds.y); glfwGetWindowSize(ctx.window, &bnds.width, &bnds.height);