diff --git a/include/game/gamemanager.hpp b/include/game/gamemanager.hpp index 7b49afc..e12f438 100644 --- a/include/game/gamemanager.hpp +++ b/include/game/gamemanager.hpp @@ -17,7 +17,6 @@ namespace Game { using clock = std::chrono::steady_clock; enum class GameStateEnum { - MENU, RUNNING, PAUSED, STOPPED diff --git a/src/game/gamemanager.cpp b/src/game/gamemanager.cpp index 2cdbe28..e4b0a5d 100644 --- a/src/game/gamemanager.cpp +++ b/src/game/gamemanager.cpp @@ -2,7 +2,7 @@ #include namespace Game { - GameStateEnum GameManager::mCurrentGameState = GameStateEnum::MENU; + GameStateEnum GameManager::mCurrentGameState = GameStateEnum::RUNNING; void GameManager::run(std::stop_token stopToken) { using namespace std::chrono_literals; diff --git a/src/object/ui/uitextbox.cpp b/src/object/ui/uitextbox.cpp index e1ad491..abb8583 100644 --- a/src/object/ui/uitextbox.cpp +++ b/src/object/ui/uitextbox.cpp @@ -9,15 +9,17 @@ namespace Game::Object { : Entity(name, font, transform), mX(x), mY(y), mConfig(config) { } void UITextBox::start() { - mTransform.x = mX - mTex->getWidth() * mTransform.adjustedScaleX() / 2.f; - mTransform.y = mY - mTex->getHeight() * mTransform.adjustedScaleY() / 2.f; - - mBoxWidth = static_cast(mTex->getWidth()) * mTransform.adjustedScaleX(); - mBoxHeight = static_cast(mTex->getHeight()) * mTransform.adjustedScaleY(); + // Compute visual box size first (respecting min sizes and scale), then center the box + mBoxWidth = static_cast(mTex ? mTex->getWidth() : 0.f) * mTransform.adjustedScaleX(); + mBoxHeight = static_cast(mTex ? mTex->getHeight() : 0.f) * mTransform.adjustedScaleY(); if (mBoxWidth < mConfig.minWidth) mBoxWidth = mConfig.minWidth; if (mBoxHeight < mConfig.minHeight) mBoxHeight = mConfig.minHeight; + // Center using the computed box dimensions rather than raw texture size so padding/min sizes are respected + mTransform.x = mX - mBoxWidth / 2.f; + mTransform.y = mY - mBoxHeight / 2.f; + refreshVisualText(); }