migrat a SDL3

This commit is contained in:
2025-03-23 22:56:10 +01:00
parent 57db69d2a4
commit 45b763791a
10 changed files with 186 additions and 152 deletions
+5 -5
View File
@@ -12,7 +12,7 @@ Ball::Ball(int x, int y, int w, int h, int vx, int vy, Texture *texture)
sprite = new Sprite(texture);
sprite->setPos({x, y});
sprite->setSize(w, h);
sprite->setClip({0, 0, w, h});
sprite->setClip({0, 0, static_cast<float>(w), static_cast<float>(h)});
color = {(rand() % 192) + 32, (rand() % 192) + 32, (rand() % 192) + 32};
}
@@ -45,9 +45,9 @@ void Ball::update()
collision = true;
}
if (x + w > SCREEN_WIDTH)
if (x + w > DEMO_WIDTH)
{
x = SCREEN_WIDTH - w;
x = DEMO_WIDTH - w;
vx = -luckyX;
collision = true;
}
@@ -59,9 +59,9 @@ void Ball::update()
collision = true;
}
if (y + h > SCREEN_HEIGHT)
if (y + h > DEMO_HEIGHT)
{
y = SCREEN_HEIGHT - h;
y = DEMO_HEIGHT - h;
vy = -luckyY;
collision = true;
}