neki
This commit is contained in:
@@ -17,7 +17,6 @@ namespace Game {
|
||||
using clock = std::chrono::steady_clock;
|
||||
|
||||
enum class GameStateEnum {
|
||||
MENU,
|
||||
RUNNING,
|
||||
PAUSED,
|
||||
STOPPED
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user