Treballant en la intro

This commit is contained in:
2025-03-14 20:28:04 +01:00
parent c757886430
commit ff4e356013
8 changed files with 140 additions and 49 deletions

View File

@@ -19,19 +19,22 @@ TiledBG::TiledBG(SDL_Rect pos, TiledBGMode mode)
// Rellena la textura con el contenido
fillTexture();
mode_ = TiledBGMode::DIAGONAL;
switch (mode)
// Inicializa variables
switch (mode_)
{
case TiledBGMode::STATIC:
window_ = {0, 0, pos_.w, pos_.h};
speed_ = 0.0f;
break;
case TiledBGMode::DIAGONAL:
window_ = {0, 0, pos_.w, pos_.h};
break;
window_ = {0, 0, pos_.w, pos_.h};
break;
case TiledBGMode::CIRCLE:
window_ = {128, 96, pos_.w, pos_.h};
break;
window_ = {128, 128, pos_.w, pos_.h};
speed_ = 0.8f;
break;
default:
window_ = {0, 0, pos_.w, pos_.h};
break;
}
@@ -104,7 +107,7 @@ void TiledBG::update()
const int INDEX = static_cast<int>(desp_) % 360;
window_.x = 128 + (static_cast<int>(sin_[(INDEX + 270) % 360] * 128));
window_.y = 96 + (static_cast<int>(sin_[(360 - INDEX) % 360] * 96));
window_.y = 128 + (static_cast<int>(sin_[(360 - INDEX) % 360] * 96));
break;
}
default: