migrat a SDL3
This commit is contained in:
+5
-5
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user