This commit is contained in:
2026-05-13 08:06:15 +02:00
parent 892d8f22eb
commit 8ff3e29374
3 changed files with 8 additions and 7 deletions

View File

@@ -17,7 +17,6 @@ namespace Game {
using clock = std::chrono::steady_clock;
enum class GameStateEnum {
MENU,
RUNNING,
PAUSED,
STOPPED

View File

@@ -2,7 +2,7 @@
#include <algorithm>
namespace Game {
GameStateEnum GameManager::mCurrentGameState = GameStateEnum::MENU;
GameStateEnum GameManager::mCurrentGameState = GameStateEnum::RUNNING;
void GameManager::run(std::stop_token stopToken) {
using namespace std::chrono_literals;

View File

@@ -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<float>(mTex->getWidth()) * mTransform.adjustedScaleX();
mBoxHeight = static_cast<float>(mTex->getHeight()) * mTransform.adjustedScaleY();
// Compute visual box size first (respecting min sizes and scale), then center the box
mBoxWidth = static_cast<float>(mTex ? mTex->getWidth() : 0.f) * mTransform.adjustedScaleX();
mBoxHeight = static_cast<float>(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();
}