jugant amb clang-tidy
This commit is contained in:
@@ -44,13 +44,13 @@ Item::Item(ItemType type, float x, float y, SDL_FRect &play_area, std::shared_pt
|
||||
}
|
||||
|
||||
void Item::alignTo(int x) {
|
||||
const float min_x = param.game.play_area.rect.x + 1;
|
||||
const float max_x = play_area_.w - width_ - 1;
|
||||
const float MIN_X = param.game.play_area.rect.x + 1;
|
||||
const float MAX_X = play_area_.w - width_ - 1;
|
||||
|
||||
pos_x_ = x - (width_ / 2);
|
||||
|
||||
// Ajusta para que no quede fuera de la zona de juego
|
||||
pos_x_ = std::clamp(pos_x_, min_x, max_x);
|
||||
pos_x_ = std::clamp(pos_x_, MIN_X, MAX_X);
|
||||
|
||||
// Actualiza el sprite
|
||||
shiftSprite();
|
||||
|
||||
Reference in New Issue
Block a user