git repos / saland

commit cd46bf95

Poul Sander · 2025-11-25 18:09
cd46bf951ba379518f6020abf41ef3c5078660a6 patch · browse files
parent 1f786e5e81eb4c3d976c3ecdddfd585539b05aa5

Use the logical coordinates to decide what to draw

Changed files

M src/saland/Game.cpp before
M src/saland/GameDraw.cpp before
diff --git a/src/saland/Game.cpp b/src/saland/Game.cpp index 34b129d..2256cc8 100644 --- a/src/saland/Game.cpp +++ b/src/saland/Game.cpp
@@ -440,6 +440,7 @@ void Game::Draw(SDL_Renderer* target) {
// Draw black bars where globalData.logicalResize suggests that the physical area ends.
// This covers the letterboxing/pillarboxing margins to ensure only the game area is visible.
+ #if 1
int topMargin = globalData.logicalResize.GetTopMargin();
int leftMargin = globalData.logicalResize.GetLeftMargin();
@@ -464,6 +465,7 @@ void Game::Draw(SDL_Renderer* target) {
SDL_SetRenderDrawColor(target, 0, 0, 0, 255);
SDL_RenderFillRect(target, &rightBar);
}
+ #endif
if (data->consoleActive && data->console) {
data->console->Draw(target);
diff --git a/src/saland/GameDraw.cpp b/src/saland/GameDraw.cpp index e617b12..fc9081e 100644 --- a/src/saland/GameDraw.cpp +++ b/src/saland/GameDraw.cpp
@@ -122,8 +122,8 @@ void DrawLayer(SDL_Renderer* renderer, sago::SagoSpriteHolder* sHolder, const sa
startY = 0;
}
// Use logical size for drawing range
- int viewWidth = resize ? 1920 : globalData.xsize;
- int viewHeight = resize ? 1080 : globalData.ysize;
+ int viewWidth = 1280;
+ int viewHeight = 720;
for (int i = startX; i < tm.width && i < (topx+viewWidth)/32+1; ++i) {
for (int j = startY; j < tm.height && j < (topy+viewHeight)/32+1; ++j) {
uint32_t gid = sago::tiled::getTileFromLayer(tm, tm.layers.at(layer), i, j);