From ef298780393a5755eb4a067f6085de0311056259 Mon Sep 17 00:00:00 2001 From: Petar Kukolj Date: Sat, 27 Oct 2018 03:01:14 +0200 Subject: [PATCH] Changed the names of methods for applying HUD scale --- rwengine/src/render/MapRenderer.cpp | 6 +++--- rwengine/src/render/MapRenderer.hpp | 4 ++-- rwgame/DrawUI.cpp | 2 +- rwgame/DrawUI.hpp | 2 +- rwgame/RWGame.cpp | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rwengine/src/render/MapRenderer.cpp b/rwengine/src/render/MapRenderer.cpp index 41bf66fc..a0d70dab 100644 --- a/rwengine/src/render/MapRenderer.cpp +++ b/rwengine/src/render/MapRenderer.cpp @@ -232,7 +232,7 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) { 1.0f // Note: Alpha is not controlled by blip ); - drawBlip(blippos, view, mi, colour, blip.size * otherBlipsScalingFactor * 2.0f); + drawBlip(blippos, view, mi, colour, blip.size * hudScale * 2.0f); } } @@ -290,8 +290,8 @@ void MapRenderer::drawBlip(const glm::vec2& coord, const glm::mat4& view, glDrawArrays(GL_LINE_LOOP, 0, 4); } -void MapRenderer::setHUDScale(const float scale) { +void MapRenderer::scaleHUD(const float scale) { defaultBlipSize *= scale; radarNorthBlipSize *= scale; - otherBlipsScalingFactor = scale; + hudScale = scale; } diff --git a/rwengine/src/render/MapRenderer.hpp b/rwengine/src/render/MapRenderer.hpp index ee8a29fe..15805907 100644 --- a/rwengine/src/render/MapRenderer.hpp +++ b/rwengine/src/render/MapRenderer.hpp @@ -39,7 +39,7 @@ public: MapRenderer(std::shared_ptr renderer, GameData* data); void draw(GameWorld* world, const MapInfo& mi); - void setHUDScale(const float scale); + void scaleHUD(const float scale); private: GameData* data; @@ -53,7 +53,7 @@ private: float radarNorthBlipSize = 24.f; float defaultBlipSize = 18.f; - float otherBlipsScalingFactor = 1.f; + float hudScale = 1.f; std::unique_ptr rectProg; diff --git a/rwgame/DrawUI.cpp b/rwgame/DrawUI.cpp index 1d6f70d2..1a269064 100644 --- a/rwgame/DrawUI.cpp +++ b/rwgame/DrawUI.cpp @@ -345,7 +345,7 @@ void drawOnScreenText(GameWorld* world, GameRenderer* renderer) { } } -void setHUDScale(const float scale) { +void scaleHUD(const float scale) { hudScale = scale; final_ui_textSize = ui_textSize * scale; final_ui_textHeight = ui_textHeight * scale; diff --git a/rwgame/DrawUI.hpp b/rwgame/DrawUI.hpp index 74969da3..b9d8029a 100644 --- a/rwgame/DrawUI.hpp +++ b/rwgame/DrawUI.hpp @@ -10,6 +10,6 @@ void drawHUD(ViewCamera& currentView, PlayerController* player, void drawOnScreenText(GameWorld* world, GameRenderer* renderer); -void setHUDScale(const float scale); +void scaleHUD(const float scale); #endif diff --git a/rwgame/RWGame.cpp b/rwgame/RWGame.cpp index de8656e9..db408304 100644 --- a/rwgame/RWGame.cpp +++ b/rwgame/RWGame.cpp @@ -75,6 +75,9 @@ RWGame::RWGame(Logger& log, int argc, char* argv[]) renderer.text.setFontTexture(FONT_PRICEDOWN, "font1"); renderer.text.setFontTexture(FONT_ARIAL, "font2"); + scaleHUD(config.getHUDScale()); + renderer.map.scaleHUD(config.getHUDScale()); + debug.setDebugMode(btIDebugDraw::DBG_DrawWireframe | btIDebugDraw::DBG_DrawConstraints | btIDebugDraw::DBG_DrawConstraintLimits); @@ -108,9 +111,6 @@ RWGame::RWGame(Logger& log, int argc, char* argv[]) } }); - setHUDScale(config.getHUDScale()); - renderer.map.setHUDScale(config.getHUDScale()); - log.info("Game", "Started"); RW_TIMELINE_LEAVE("Startup"); }