From 99bbc24265f9579de32127d87dbf4f92e2223bee Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Tue, 7 Jul 2026 19:03:08 +0200 Subject: [PATCH] Remove global g_xres and x_yres Instead query g_VideoMode where needed. As both g_xres and g_yres aren't global anymore remove static from UpdateRenderer. While at it use more desicriptive names: GetXRes -> GetWindowWidth, GetYRes -> GetWindowHeight. This reduces the amount of variables tracking width and height by one each. Signed-off-by: Ralph Sennhauser --- source/graphics/CameraController.cpp | 11 +++++------ source/gui/CGUI.cpp | 2 +- source/gui/CGUIText.cpp | 4 +--- source/ps/CConsole.cpp | 4 ++-- source/ps/GameSetup/Config.cpp | 2 -- source/ps/GameSetup/Config.h | 4 +--- source/ps/GameSetup/HWDetect.cpp | 2 +- source/ps/TouchInput.cpp | 9 ++++----- source/ps/VideoMode.cpp | 15 ++++++--------- source/ps/VideoMode.h | 6 +++--- source/renderer/Renderer.cpp | 14 +++++++------- source/renderer/SilhouetteRenderer.cpp | 9 ++++----- .../scripting/JSInterface_Simulation.cpp | 9 ++++++--- source/tools/atlas/GameInterface/ActorViewer.cpp | 4 +--- .../Handlers/GraphicsSetupHandlers.cpp | 4 ++-- .../atlas/GameInterface/Handlers/MiscHandlers.cpp | 8 ++++---- source/tools/atlas/GameInterface/View.cpp | 6 ++---- 17 files changed, 50 insertions(+), 63 deletions(-) diff --git a/source/graphics/CameraController.cpp b/source/graphics/CameraController.cpp index f93a19b1bd..5ce83fe56b 100644 --- a/source/graphics/CameraController.cpp +++ b/source/graphics/CameraController.cpp @@ -32,6 +32,7 @@ #include "ps/Game.h" #include "ps/Globals.h" #include "ps/Hotkey.h" +#include "ps/VideoMode.h" #include "ps/World.h" #include "renderer/Renderer.h" #include "renderer/SceneRenderer.h" @@ -47,8 +48,6 @@ #include #include -extern int g_xres, g_yres; - // Maximum distance outside the edge of the map that the camera's // focus point can be moved static const float CAMERA_EDGE_MARGIN = 2.0f * TERRAIN_TILE_SIZE; @@ -105,8 +104,8 @@ CCameraController::CCameraController(CCamera& camera) SViewPort vp; vp.m_X = 0; vp.m_Y = 0; - vp.m_Width = g_xres; - vp.m_Height = g_yres; + vp.m_Width = g_VideoMode.GetWindowWidth(); + vp.m_Height = g_VideoMode.GetWindowHeight(); m_Camera.SetViewPort(vp); SetCameraProjection(); @@ -206,12 +205,12 @@ void CCameraController::Update(const float deltaRealTime) if (g_mouse_active && m_ViewScrollMouseDetectDistance > 0) { - if (g_mouse_x >= g_xres - m_ViewScrollMouseDetectDistance && g_mouse_x < g_xres) + if (g_mouse_x >= g_VideoMode.GetWindowWidth() - m_ViewScrollMouseDetectDistance && g_mouse_x < g_VideoMode.GetWindowWidth()) moveRightward += m_ViewScrollSpeed * deltaRealTime; else if (g_mouse_x < m_ViewScrollMouseDetectDistance && g_mouse_x >= 0) moveRightward -= m_ViewScrollSpeed * deltaRealTime; - if (g_mouse_y >= g_yres - m_ViewScrollMouseDetectDistance && g_mouse_y < g_yres) + if (g_mouse_y >= g_VideoMode.GetWindowHeight() - m_ViewScrollMouseDetectDistance && g_mouse_y < g_VideoMode.GetWindowHeight()) moveForward -= m_ViewScrollSpeed * deltaRealTime; else if (g_mouse_y < m_ViewScrollMouseDetectDistance && g_mouse_y >= 0) moveForward += m_ViewScrollSpeed * deltaRealTime; diff --git a/source/gui/CGUI.cpp b/source/gui/CGUI.cpp index 97c2979efb..0f607cdc14 100644 --- a/source/gui/CGUI.cpp +++ b/source/gui/CGUI.cpp @@ -461,7 +461,7 @@ IGUIObject* CGUI::FindObjectUnderMouse() CSize2D CGUI::GetWindowSize() const { - return CSize2D{static_cast(g_xres) / g_VideoMode.GetScale(), static_cast(g_yres) / g_VideoMode.GetScale() }; + return CSize2D{static_cast(g_VideoMode.GetWindowWidth()) / g_VideoMode.GetScale(), static_cast(g_VideoMode.GetWindowHeight()) / g_VideoMode.GetScale() }; } void CGUI::SendFocusMessage(EGUIMessageType msgType) diff --git a/source/gui/CGUIText.cpp b/source/gui/CGUIText.cpp index c5dc51ffc9..04ce400fde 100644 --- a/source/gui/CGUIText.cpp +++ b/source/gui/CGUIText.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -34,8 +34,6 @@ #include #include -extern int g_xres, g_yres; - // TODO Gee: CRect => CPoint ? void SGenerateTextImage::SetupSpriteCall( const bool left, CGUIText::SSpriteCall& spriteCall, const float width, const float y, diff --git a/source/ps/CConsole.cpp b/source/ps/CConsole.cpp index 840013b504..fe2bac0346 100644 --- a/source/ps/CConsole.cpp +++ b/source/ps/CConsole.cpp @@ -152,13 +152,13 @@ void CConsole::Init() m_HistoryFile = L"config/console.txt"; LoadHistory(); - UpdateScreenSize(g_xres, g_yres); + UpdateScreenSize(g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight()); // Calculate and store the line spacing. const CFontMetrics font{CStrIntern(m_consoleFont)}; m_FontHeight = font.GetHeight(); m_FontWidth = font.GetCharacterWidth(L'C'); - m_CharsPerPage = static_cast(g_xres / m_FontWidth); + m_CharsPerPage = static_cast(g_VideoMode.GetWindowWidth() / m_FontWidth); // Fonts constains two dimensions: the full height, and the cap height. // We are adding some offset to move the text up a bit, so it looks better in the console. m_FontOffset = font.GetCapHeight() / 2.f; diff --git a/source/ps/GameSetup/Config.cpp b/source/ps/GameSetup/Config.cpp index 146cc1b647..6fde072a5e 100644 --- a/source/ps/GameSetup/Config.cpp +++ b/source/ps/GameSetup/Config.cpp @@ -30,8 +30,6 @@ // (these variables are documented in the header.) bool g_PauseOnFocusLoss = false; -int g_xres, g_yres; - bool g_Quickstart = false; bool g_DisableAudio = false; diff --git a/source/ps/GameSetup/Config.h b/source/ps/GameSetup/Config.h index 091e22dc7b..3100128c33 100644 --- a/source/ps/GameSetup/Config.h +++ b/source/ps/GameSetup/Config.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -21,8 +21,6 @@ // flag to pause the game on window focus loss extern bool g_PauseOnFocusLoss; -extern int g_xres, g_yres; - extern bool g_Quickstart; extern bool g_DisableAudio; diff --git a/source/ps/GameSetup/HWDetect.cpp b/source/ps/GameSetup/HWDetect.cpp index 9920638a94..df7ed9c0f9 100644 --- a/source/ps/GameSetup/HWDetect.cpp +++ b/source/ps/GameSetup/HWDetect.cpp @@ -285,7 +285,7 @@ void WriteSystemInfo(Renderer::Backend::IDevice* device, const utsname& un) // graphics fprintf(f, "Video Card : %s\n", device->GetName().c_str()); fprintf(f, "Video Driver : %s\n", device->GetDriverInformation().c_str()); - fprintf(f, "Video Mode : %dx%d:%d\n", g_VideoMode.GetXRes(), g_VideoMode.GetYRes(), g_VideoMode.GetBPP()); + fprintf(f, "Video Mode : %dx%d:%d\n", g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight(), g_VideoMode.GetBPP()); #if CONFIG2_AUDIO if (g_SoundManager) diff --git a/source/ps/TouchInput.cpp b/source/ps/TouchInput.cpp index eb50859a8c..4619c62390 100644 --- a/source/ps/TouchInput.cpp +++ b/source/ps/TouchInput.cpp @@ -27,6 +27,7 @@ #include "lib/timer.h" #include "maths/Matrix3D.h" #include "ps/Game.h" +#include "ps/VideoMode.h" #include #include @@ -39,8 +40,6 @@ // Same with right-click for finger 1. #define EMULATE_FINGERS_WITH_MOUSE 0 -extern int g_xres, g_yres; - // NOTE: All this code is currently just a basic prototype for testing; // it might need significant redesigning for proper usage. @@ -279,11 +278,11 @@ Input::Reaction CTouchInput::HandleEvent(const SDL_Event& ev) ev.tfinger.x, ev.tfinger.y, ev.tfinger.dx, ev.tfinger.dy, ev.tfinger.pressure); if (ev.type == SDL_FINGERDOWN) - OnFingerDown(ev.tfinger.fingerId, g_xres * ev.tfinger.x, g_yres * ev.tfinger.y); + OnFingerDown(ev.tfinger.fingerId, g_VideoMode.GetWindowWidth() * ev.tfinger.x, g_VideoMode.GetWindowHeight() * ev.tfinger.y); else if (ev.type == SDL_FINGERUP) - OnFingerUp(ev.tfinger.fingerId, g_xres * ev.tfinger.x, g_yres * ev.tfinger.y); + OnFingerUp(ev.tfinger.fingerId, g_VideoMode.GetWindowWidth() * ev.tfinger.x, g_VideoMode.GetWindowHeight() * ev.tfinger.y); else if (ev.type == SDL_FINGERMOTION) - OnFingerMotion(ev.tfinger.fingerId, g_xres * ev.tfinger.x, g_yres * ev.tfinger.y); + OnFingerMotion(ev.tfinger.fingerId, g_VideoMode.GetWindowWidth() * ev.tfinger.x, g_VideoMode.GetWindowHeight() * ev.tfinger.y); return Input::Reaction::HANDLED; } } diff --git a/source/ps/VideoMode.cpp b/source/ps/VideoMode.cpp index 27756796ab..5d5b4d8755 100644 --- a/source/ps/VideoMode.cpp +++ b/source/ps/VideoMode.cpp @@ -550,9 +550,6 @@ bool CVideoMode::SetVideoMode(int w, int h, int bpp, bool fullscreen) m_IsFullscreen = fullscreen; - g_xres = m_CurrentW; - g_yres = m_CurrentH; - return true; } @@ -733,9 +730,9 @@ void CVideoMode::RecreateSwapChain() if (m_BackendDevice) { char nameBuffer[64]; - snprintf(nameBuffer, std::size(nameBuffer), "SwapChain: %dx%d", g_xres, g_yres); + snprintf(nameBuffer, std::size(nameBuffer), "SwapChain: %dx%d", m_CurrentW, m_CurrentH); m_SwapChain = m_BackendDevice->CreateSwapChain( - nameBuffer, m_Window, g_xres, g_yres, m_ConfigVSync, std::move(m_SwapChain)); + nameBuffer, m_Window, m_CurrentW, m_CurrentH, m_ConfigVSync, std::move(m_SwapChain)); } } @@ -876,8 +873,8 @@ void CVideoMode::UpdateRenderer(int w, int h) if (w < 2) w = 2; // avoid GL errors caused by invalid sizes if (h < 2) h = 2; - g_xres = w; - g_yres = h; + m_CurrentW = w; + m_CurrentH = h; SViewPort vp = { 0, 0, w, h }; @@ -915,13 +912,13 @@ int CVideoMode::GetBestBPP() return 32; } -int CVideoMode::GetXRes() const +int CVideoMode::GetWindowWidth() const { ENSURE(m_IsInitialised); return m_CurrentW; } -int CVideoMode::GetYRes() const +int CVideoMode::GetWindowHeight() const { ENSURE(m_IsInitialised); return m_CurrentH; diff --git a/source/ps/VideoMode.h b/source/ps/VideoMode.h index 2d54c84529..db1c82b3d3 100644 --- a/source/ps/VideoMode.h +++ b/source/ps/VideoMode.h @@ -88,10 +88,10 @@ public: * This should be called after the GL context has been resized. * This can also be used when the GL context is managed externally, not via SDL. */ - static void UpdateRenderer(int w, int h); + void UpdateRenderer(int windowWidth, int windowHeight); - int GetXRes() const; - int GetYRes() const; + int GetWindowWidth() const; + int GetWindowHeight() const; int GetBPP() const; bool IsVSyncEnabled() const; diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp index 09aadf8ea1..b27aaffb59 100644 --- a/source/renderer/Renderer.cpp +++ b/source/renderer/Renderer.cpp @@ -447,7 +447,7 @@ CRenderer::CRenderer(Renderer::Backend::IDevice* device) // Create terrain related stuff. new CTerrainTextureManager(device); - Open(g_xres, g_yres); + Open(g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight()); // Setup lighting environment. Since the Renderer accesses the // lighting environment through a pointer, this has to be done before @@ -697,7 +697,7 @@ void CRenderer::RenderFrameImpl( void CRenderer::RenderFrame2D(const bool renderGUI, const bool renderLogger) { - CCanvas2D canvas(g_xres, g_yres, g_VideoMode.GetScale(), m->deviceCommandContext.get()); + CCanvas2D canvas(g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight(), g_VideoMode.GetScale(), m->deviceCommandContext.get()); m->sceneRenderer.RenderTextOverlays(canvas); @@ -745,7 +745,7 @@ void CRenderer::RenderScreenShot(const bool needsPresent) VfsPath filename; vfs::NextNumberedFilename(g_VFS, filenameFormat, g_NextScreenShotNumber, filename); - const size_t width = static_cast(g_xres), height = static_cast(g_yres); + const size_t width = static_cast(g_VideoMode.GetWindowWidth()), height = static_cast(g_VideoMode.GetWindowHeight()); const size_t bpp = 24; const size_t img_size = width * height * bpp / 8; @@ -804,12 +804,12 @@ void CRenderer::RenderBigScreenShot(const bool needsPresent) return; } - if (g_xres < tileWidth && g_yres < tileHeight) + if (g_VideoMode.GetWindowWidth() < tileWidth && g_VideoMode.GetWindowHeight() < tileHeight) { LOGWARNING( "The window size is too small for a big screenshot, increase the" " window size %dx%d or decrease the tile size %dx%d", - g_xres, g_yres, tileWidth, tileHeight); + g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight(), tileWidth, tileHeight); return; } @@ -897,8 +897,8 @@ void CRenderer::RenderBigScreenShot(const bool needsPresent) // Restore the viewport settings { - g_Renderer.Resize(g_xres, g_yres); - SViewPort vp = { 0, 0, g_xres, g_yres }; + g_Renderer.Resize(g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight()); + SViewPort vp = { 0, 0, g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight() }; g_Game->GetView()->SetViewport(vp); g_Game->GetView()->SetCamera(oldCamera); } diff --git a/source/renderer/SilhouetteRenderer.cpp b/source/renderer/SilhouetteRenderer.cpp index ec20bb8ef3..93dacab547 100644 --- a/source/renderer/SilhouetteRenderer.cpp +++ b/source/renderer/SilhouetteRenderer.cpp @@ -38,6 +38,7 @@ #include "ps/CStrIntern.h" #include "ps/CStrInternStatic.h" #include "ps/Profile.h" +#include "ps/VideoMode.h" #include "renderer/DebugRenderer.h" #include "renderer/Renderer.h" #include "renderer/Scene.h" @@ -53,8 +54,6 @@ #include #include -extern int g_xres, g_yres; - // For debugging static const bool g_DisablePreciseIntersections = false; @@ -258,9 +257,9 @@ void SilhouetteRenderer::ComputeSubmissions(const CCamera& camera) #if 0 // For debugging ray-patch intersections - casts a ton of rays and draws // a sphere where they intersect - for (int y = 0; y < g_yres; y += 8) + for (int y = 0; y < g_VideoMode.GetWindowHeight(); y += 8) { - for (int x = 0; x < g_xres; x += 8) + for (int x = 0; x < g_VideoMode.GetWindowWidth(); x += 8) { SOverlaySphere sphere; sphere.m_Color = CColor(1, 0, 0, 1); @@ -483,7 +482,7 @@ void SilhouetteRenderer::RenderDebugOverlays( CMatrix3D m; m.SetIdentity(); m.Scale(1.0f, -1.f, 1.0f); - m.Translate(0.0f, (float)g_yres, -1000.0f); + m.Translate(0.0f, static_cast(g_VideoMode.GetWindowHeight()), -1000.0f); CMatrix3D proj; proj.SetOrtho(0.f, g_MaxCoord, 0.f, g_MaxCoord, -1.f, 1000.f); diff --git a/source/simulation2/scripting/JSInterface_Simulation.cpp b/source/simulation2/scripting/JSInterface_Simulation.cpp index 62a1c45071..2cd1c051e9 100644 --- a/source/simulation2/scripting/JSInterface_Simulation.cpp +++ b/source/simulation2/scripting/JSInterface_Simulation.cpp @@ -30,6 +30,7 @@ #include "ps/Game.h" #include "ps/GameSetup/Config.h" #include "ps/Pyrogenesis.h" +#include "ps/VideoMode.h" #include "scriptinterface/FunctionWrapper.h" #include "scriptinterface/Object.h" #include "scriptinterface/Request.h" @@ -118,12 +119,12 @@ std::vector PickPlayerEntitiesInRect(int x0, int y0, int x1, int y1 std::vector PickPlayerEntitiesOnScreen(int player) { - return EntitySelection::PickEntitiesInRect(*g_Game->GetSimulation2(), g_Game->GetView()->GetCamera(), 0, 0, g_xres, g_yres, player, false); + return EntitySelection::PickEntitiesInRect(*g_Game->GetSimulation2(), g_Game->GetView()->GetCamera(), 0, 0, g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight(), player, false); } std::vector PickNonGaiaEntitiesOnScreen() { - return EntitySelection::PickNonGaiaEntitiesInRect(*g_Game->GetSimulation2(), g_Game->GetView()->GetCamera(), 0, 0, g_xres, g_yres, false); + return EntitySelection::PickNonGaiaEntitiesInRect(*g_Game->GetSimulation2(), g_Game->GetView()->GetCamera(), 0, 0, g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight(), false); } std::vector GetEntitiesWithStaticObstructionOnScreen() @@ -136,7 +137,9 @@ std::vector GetEntitiesWithStaticObstructionOnScreen() return cmpObstruction->GetObstructionType() == ICmpObstruction::STATIC; } }; - return EntitySelection::GetEntitiesWithComponentInRect(*g_Game->GetSimulation2(), IID_Obstruction, g_Game->GetView()->GetCamera(), 0, 0, g_xres, g_yres); + return EntitySelection::GetEntitiesWithComponentInRect(*g_Game->GetSimulation2(), + IID_Obstruction, g_Game->GetView()->GetCamera(), 0, 0, + g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight()); } JS::Value GetEdgesOfStaticObstructionsOnScreenNearTo(const Script::Interface& scriptInterface, entity_pos_t x, entity_pos_t z) diff --git a/source/tools/atlas/GameInterface/ActorViewer.cpp b/source/tools/atlas/GameInterface/ActorViewer.cpp index e8086988ac..f5e795c7a9 100644 --- a/source/tools/atlas/GameInterface/ActorViewer.cpp +++ b/source/tools/atlas/GameInterface/ActorViewer.cpp @@ -81,8 +81,6 @@ class CTerrainTextureEntry; -extern int g_xres, g_yres; - struct ActorViewerImpl : public Scene { NONCOPYABLE(ActorViewerImpl); @@ -578,7 +576,7 @@ void ActorViewer::Render() sceneRenderer.RenderSceneOverlays(deviceCommandContext); { - CCanvas2D canvas(g_xres, g_yres, g_VideoMode.GetScale(), deviceCommandContext); + CCanvas2D canvas(g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight(), g_VideoMode.GetScale(), deviceCommandContext); g_Logger->Render(canvas); g_ProfileViewer.RenderProfile(canvas); } diff --git a/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp index f15be0b097..1e653c29ca 100644 --- a/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp +++ b/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp @@ -215,7 +215,7 @@ MESSAGEHANDLER(SetCanvas) { // Need to set the canvas size before possibly doing any rendering, // else we'll get GL errors when trying to render to 0x0 - CVideoMode::UpdateRenderer(msg->width, msg->height); + g_VideoMode.UpdateRenderer(msg->width, msg->height); g_AtlasGameLoop->glCanvas = msg->canvas; Atlas_GLSetCurrent(const_cast(g_AtlasGameLoop->glCanvas)); @@ -224,7 +224,7 @@ MESSAGEHANDLER(SetCanvas) MESSAGEHANDLER(ResizeScreen) { - CVideoMode::UpdateRenderer(msg->width, msg->height); + g_VideoMode.UpdateRenderer(msg->width, msg->height); #if OS_MACOSX // OS X seems to require this to update the GL canvas diff --git a/source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp index 1523344f21..ea01c8cb5b 100644 --- a/source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp +++ b/source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp @@ -125,8 +125,8 @@ MESSAGEHANDLER(GuiMouseButtonEvent) ev.button.clicks = msg->clicks; float x, y; msg->pos->GetScreenSpace(x, y); - ev.button.x = static_cast(Clamp(x, 0, g_xres)); - ev.button.y = static_cast(Clamp(y, 0, g_yres)); + ev.button.x = static_cast(Clamp(x, 0, g_VideoMode.GetWindowWidth())); + ev.button.y = static_cast(Clamp(y, 0, g_VideoMode.GetWindowHeight())); g_VideoMode.m_InputManager.DispatchEvent(ev); } @@ -136,8 +136,8 @@ MESSAGEHANDLER(GuiMouseMotionEvent) ev.type = SDL_MOUSEMOTION; float x, y; msg->pos->GetScreenSpace(x, y); - ev.motion.x = static_cast(Clamp(x, 0, g_xres)); - ev.motion.y = static_cast(Clamp(y, 0, g_yres)); + ev.motion.x = static_cast(Clamp(x, 0, g_VideoMode.GetWindowWidth())); + ev.motion.y = static_cast(Clamp(y, 0, g_VideoMode.GetWindowHeight())); g_VideoMode.m_InputManager.DispatchEvent(ev); } diff --git a/source/tools/atlas/GameInterface/View.cpp b/source/tools/atlas/GameInterface/View.cpp index 371ca8eea6..e01785b39c 100644 --- a/source/tools/atlas/GameInterface/View.cpp +++ b/source/tools/atlas/GameInterface/View.cpp @@ -54,8 +54,6 @@ extern void (*Atlas_GLSwapBuffers)(void* context); -extern int g_xres, g_yres; - ////////////////////////////////////////////////////////////////////////// void AtlasView::SetParam(const std::wstring& /*name*/, bool /*value*/) @@ -93,7 +91,7 @@ void AtlasViewActor::Update(float realFrameLength) void AtlasViewActor::Render() { - SViewPort vp = { 0, 0, g_xres, g_yres }; + SViewPort vp = { 0, 0, g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight() }; CCamera camera{GetCamera()}; camera.SetViewPort(vp); camera.SetPerspectiveProjection(2.f, 512.f, DEGTORAD(20.f)); @@ -246,7 +244,7 @@ void AtlasViewGame::Render() if (!swapChain || !swapChain->IsValid() || !swapChain->AcquireNextBackbuffer()) return; - SViewPort vp = { 0, 0, g_xres, g_yres }; + SViewPort vp = { 0, 0, g_VideoMode.GetWindowWidth(), g_VideoMode.GetWindowHeight() }; CCamera camera{GetCamera()}; camera.SetViewPort(vp); camera.SetProjectionFromCamera(g_Game->GetView()->GetCamera());