git repos / blockattack-game

commit 5df3e7f5

Poul Sander · 2025-09-17 20:02
5df3e7f59fa671b61be75530341d28a99ffc4b56 patch · browse files
parent a600fc3bc1c641526826d322bc75bc399893a9da

Fixed tiling backgrounds in high resolution.

Changed files

M source/code/main.cpp before
diff --git a/source/code/main.cpp b/source/code/main.cpp index f8c4312..18adb4c 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp
@@ -292,12 +292,12 @@ void DrawBackground(SDL_Renderer* target) {
if (globalData.theme.background.tileMoveSpeedX) {
nextX -= (ticks/globalData.theme.background.tileMoveSpeedX)%background.GetWidth();
}
- while (nextX < globalData.xsize) {
+ while (nextX < w) {
int nextY = 0;
if (globalData.theme.background.tileMoveSpeedY) {
nextY -= (ticks/globalData.theme.background.tileMoveSpeedY)%background.GetWidth();
}
- while (nextY < globalData.ysize) {
+ while (nextY < h ) {
background.Draw(target, ticks, nextX, nextY);
nextY += background.GetHeight();
}