clang-tidy
This commit is contained in:
@@ -53,20 +53,20 @@ TiledBG::~TiledBG() {
|
||||
// Rellena la textura con el contenido
|
||||
void TiledBG::fillTexture() {
|
||||
// Crea los objetos para pintar en la textura de fondo
|
||||
auto tile = std::make_unique<Sprite>(Resource::get()->getTexture("title_bg_tile.png"), (SDL_FRect){0, 0, TILE_WIDTH_, TILE_HEIGHT_});
|
||||
auto tile = std::make_unique<Sprite>(Resource::get()->getTexture("title_bg_tile.png"), (SDL_FRect){0, 0, TILE_WIDTH, TILE_HEIGHT});
|
||||
|
||||
// Prepara para dibujar sobre la textura
|
||||
auto temp = SDL_GetRenderTarget(renderer_);
|
||||
SDL_SetRenderTarget(renderer_, canvas_);
|
||||
|
||||
// Rellena la textura con el tile
|
||||
const auto I_MAX = pos_.w * 2 / TILE_WIDTH_;
|
||||
const auto J_MAX = pos_.h * 2 / TILE_HEIGHT_;
|
||||
tile->setSpriteClip(0, 0, TILE_WIDTH_, TILE_HEIGHT_);
|
||||
const auto I_MAX = pos_.w * 2 / TILE_WIDTH;
|
||||
const auto J_MAX = pos_.h * 2 / TILE_HEIGHT;
|
||||
tile->setSpriteClip(0, 0, TILE_WIDTH, TILE_HEIGHT);
|
||||
for (int i = 0; i < I_MAX; ++i) {
|
||||
for (int j = 0; j < J_MAX; ++j) {
|
||||
tile->setX(i * TILE_WIDTH_);
|
||||
tile->setY(j * TILE_HEIGHT_);
|
||||
tile->setX(i * TILE_WIDTH);
|
||||
tile->setY(j * TILE_HEIGHT);
|
||||
tile->render();
|
||||
}
|
||||
}
|
||||
@@ -88,8 +88,8 @@ void TiledBG::update() {
|
||||
switch (mode_) {
|
||||
case TiledBGMode::DIAGONAL: {
|
||||
// El tileado de fondo se desplaza en diagonal
|
||||
window_.x = static_cast<int>(desp_) % TILE_WIDTH_;
|
||||
window_.y = static_cast<int>(desp_) % TILE_HEIGHT_;
|
||||
window_.x = static_cast<int>(desp_) % TILE_WIDTH;
|
||||
window_.y = static_cast<int>(desp_) % TILE_HEIGHT;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ void TiledBG::updateStop() {
|
||||
const int UMBRAL = 20 * speed_; // Ajusta este valor según la precisión deseada
|
||||
|
||||
// Desacelerar si estamos cerca de completar el ciclo (ventana a punto de regresar a 0)
|
||||
if (window_.x >= TILE_WIDTH_ - UMBRAL) {
|
||||
if (window_.x >= TILE_WIDTH - UMBRAL) {
|
||||
speed_ /= 1.05f; // Reduce gradualmente la velocidad
|
||||
|
||||
// Asegura que no baje demasiado
|
||||
|
||||
Reference in New Issue
Block a user