This commit is contained in:
2026-05-13 07:58:59 +02:00
parent d9769bdbbb
commit 892d8f22eb
18 changed files with 242 additions and 77 deletions

View File

@@ -57,7 +57,10 @@ namespace Game::AGame {
mSeaTex->setTiled(true);
}
mTiledScale = 0.5f;
SDL_GetWindowSizeInPixels(Window::Window::getSDLWindowBackend(), &mW, &mH);
// Use logical world dimensions (1280×720) not actual screen size
mW = 1280;
mH = 720;
// Land boundary: left 1/3 of map in centered coordinates
// For 1280px window: -640 (left) + 426.67 (1/3) = -213.33
@@ -128,9 +131,11 @@ namespace Game::AGame {
const float viewBottom = mH / 2.f;
Object::Transform tS;
tS.x = 0.f;
tS.y = 0.f;
tS.rotation = 0.f;
tS.scaleX = 6.f;
tS.scaleY = 6.f;
tS.scaleX = 4.0f;
tS.scaleY = 4.0f;
const float halfFriendlyW = mFriendlyTex->getWidth() * tS.adjustedScaleX() / 2.f;
const float halfFriendlyH = mFriendlyTex->getHeight() * tS.adjustedScaleY() / 2.f;
@@ -194,8 +199,8 @@ namespace Game::AGame {
Object::Transform tS;
tS.rotation = 0.f;
tS.scaleX = 7.f;
tS.scaleY = 7.f;
tS.scaleX = 4.7f;
tS.scaleY = 4.7f;
const float halfEnemyW = mEnemyTex->getWidth() * tS.adjustedScaleX() / 2.f;
const float halfEnemyH = mEnemyTex->getHeight() * tS.adjustedScaleY() / 2.f;
for (int i = 0; i < enemyCount; ++i) {
@@ -268,9 +273,11 @@ namespace Game::AGame {
const bool spawnSea = sideRoll < static_cast<int>(seaProb * 100.f);
Object::Transform tS;
tS.x = 0.f;
tS.y = 0.f;
tS.rotation = 0.f;
tS.scaleX = 6.f;
tS.scaleY = 6.f;
tS.scaleX = 4.0f;
tS.scaleY = 4.0f;
const float viewLeft = -mW / 2.f;
const float viewRight = mW / 2.f;
const float viewTop = -mH / 2.f;
@@ -320,7 +327,8 @@ namespace Game::AGame {
}
void Background::onWindowResized(int newWidth, int newHeight) {
mW = newWidth;
mH = newHeight;
// Always maintain logical world dimensions (1280×720)
mW = 1280;
mH = 720;
}
}