From e428509e0a3d7d84866cf629003737da5130f523 Mon Sep 17 00:00:00 2001 From: Pedro Gimeno Date: Mon, 20 Jul 2020 15:59:41 +0200 Subject: [PATCH] Make some constants float to prevent extra casting work --- source/client/states/PauseMenuState.cpp | 4 ++-- source/client/states/SettingsMenuState.cpp | 6 +++--- source/client/states/TitleScreenState.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/client/states/PauseMenuState.cpp b/source/client/states/PauseMenuState.cpp index 562b6b77..9fc210fb 100644 --- a/source/client/states/PauseMenuState.cpp +++ b/source/client/states/PauseMenuState.cpp @@ -118,8 +118,8 @@ void PauseMenuState::onGuiScaleChanged(const GuiScaleChangedEvent &event) { void PauseMenuState::updateWidgetPosition() { m_menuWidget.setPosition( - roundf(Config::screenWidth / 2.0 - m_menuWidget.getGlobalBounds().sizeX / 2.0), - roundf(Config::screenHeight / 2.0 - m_menuWidget.getGlobalBounds().sizeY / 2.0) + roundf(Config::screenWidth / 2.0f - m_menuWidget.getGlobalBounds().sizeX / 2.0f), + roundf(Config::screenHeight / 2.0f - m_menuWidget.getGlobalBounds().sizeY / 2.0f) ); } diff --git a/source/client/states/SettingsMenuState.cpp b/source/client/states/SettingsMenuState.cpp index 4fe907e7..f0b4da5c 100644 --- a/source/client/states/SettingsMenuState.cpp +++ b/source/client/states/SettingsMenuState.cpp @@ -127,12 +127,12 @@ void SettingsMenuState::updateWidgetPosition() { m_doneButton.setPosition( roundf(Config::screenWidth / 2.0f - m_doneButton.getGlobalBounds().sizeX / 2.0f), - roundf(Config::screenHeight - bottomBorderSize / 2.0f - m_doneButton.getGlobalBounds().sizeY / 2.0) + roundf(Config::screenHeight - bottomBorderSize / 2.0f - m_doneButton.getGlobalBounds().sizeY / 2.0f) ); m_menuWidget.setPosition( - roundf(Config::screenWidth / 2.0 - m_menuWidget.getGlobalBounds().sizeX / 2.0), - roundf(topBorderSize + 5 * Config::guiScale) + roundf(Config::screenWidth / 2.0f - m_menuWidget.getGlobalBounds().sizeX / 2.0f), + roundf(topBorderSize + 5.0f * Config::guiScale) ); } diff --git a/source/client/states/TitleScreenState.cpp b/source/client/states/TitleScreenState.cpp index b70c26ef..d3e4205c 100644 --- a/source/client/states/TitleScreenState.cpp +++ b/source/client/states/TitleScreenState.cpp @@ -164,7 +164,7 @@ void TitleScreenState::updateWidgetPosition() { m_titleText.setPosition( roundf(Config::screenWidth / 2.0f - m_titleText.getSize().x * m_titleText.getScale().x / 2.0f), - roundf(0.04 * Config::screenHeight * Config::guiScale) + roundf(0.04f * Config::screenHeight * Config::guiScale) ); m_versionText.setPosition(Config::guiScale, Config::screenHeight - m_versionText.getSize().y * Config::guiScale); m_copyrightText.setPosition(