This commit is contained in:
2025-10-27 13:01:11 +01:00
parent 5d8811026d
commit cdb9bde6aa
23 changed files with 392 additions and 392 deletions

View File

@@ -304,28 +304,28 @@ void Ending2::updateTexts() {
// Dibuja los sprites
void Ending2::renderSprites() {
const Uint8 colorA = static_cast<Uint8>(PaletteColor::RED);
const Uint8 COLOR_A = static_cast<Uint8>(PaletteColor::RED);
for (auto sprite : sprites_) {
const bool A = sprite->getRect().y + sprite->getRect().h > 0;
const bool B = sprite->getRect().y < Options::game.height;
if (A && B) {
sprite->render(1, colorA);
sprite->render(1, COLOR_A);
}
}
// Pinta el ultimo elemento de otro color
const Uint8 colorB = static_cast<Uint8>(PaletteColor::WHITE);
sprites_.back()->render(1, colorB);
const Uint8 COLOR_B = static_cast<Uint8>(PaletteColor::WHITE);
sprites_.back()->render(1, COLOR_B);
}
// Dibuja los sprites con el texto
void Ending2::renderSpriteTexts() {
const Uint8 color = static_cast<Uint8>(PaletteColor::WHITE);
const Uint8 COLOR = static_cast<Uint8>(PaletteColor::WHITE);
for (auto sprite : sprite_texts_) {
const bool A = sprite->getRect().y + sprite->getRect().h > 0;
const bool B = sprite->getRect().y < Options::game.height;
if (A && B) {
sprite->render(1, color);
sprite->render(1, COLOR);
}
}
}
@@ -345,7 +345,7 @@ void Ending2::renderTexts() {
void Ending2::placeSprites() {
for (int i = 0; i < static_cast<int>(sprites_.size()); ++i) {
const float X = i % 2 == 0 ? FIRST_COL : SECOND_COL;
const float Y = (i / 1) * (sprite_max_height_ + DIST_SPRITE_TEXT + Resource::get()->getText("smb2")->getCharacterSize() + DIST_SPRITE_SPRITE) + Options::game.height + 40;
const float Y = ((i / 1) * (sprite_max_height_ + DIST_SPRITE_TEXT + Resource::get()->getText("smb2")->getCharacterSize() + DIST_SPRITE_SPRITE)) + Options::game.height + 40;
const float W = sprites_.at(i)->getWidth();
const float H = sprites_.at(i)->getHeight();
const float DX = -(W / 2);
@@ -357,7 +357,7 @@ void Ending2::placeSprites() {
// Recoloca el sprite del jugador, que es el último de la lista
const float X = (Options::game.width - sprites_.back()->getWidth()) / 2;
const float Y = sprites_.back()->getPosY() + sprite_max_height_ * 2;
const float Y = sprites_.back()->getPosY() + (sprite_max_height_ * 2);
sprites_.back()->setPos(X, Y);
sprites_.back()->setCurrentAnimation("walk");
}
@@ -433,7 +433,7 @@ void Ending2::createTexts() {
// Crea los últimos textos
// El primer texto va a continuación del ultimo spriteText
const int START = sprite_texts_.back()->getPosY() + text->getCharacterSize() * 15;
const int START = sprite_texts_.back()->getPosY() + (text->getCharacterSize() * 15);
list.clear();
list.push_back("THANK YOU");
list.push_back("FOR PLAYING!");
@@ -469,7 +469,7 @@ void Ending2::updateFinalFade() {
}
// Actualiza el volumen de la musica
void Ending2::updateMusicVolume() {
void Ending2::updateMusicVolume() const {
// Constante para la duración en milisegundos
constexpr Uint32 VOLUME_FADE_DURATION = 3000;

View File

@@ -81,10 +81,10 @@ class Ending2 {
void render();
// Comprueba el manejador de eventos
void checkEvents();
static void checkEvents();
// Comprueba las entradas
void checkInput();
static void checkInput();
// Actualiza el estado
void updateState();
@@ -126,7 +126,7 @@ class Ending2 {
void updateFinalFade();
// Actualiza el volumen de la musica
void updateMusicVolume();
void updateMusicVolume() const;
public:
// Constructor

View File

@@ -180,9 +180,9 @@ void Game::render() {
#ifdef _DEBUG
// Pasa la información de debug
void Game::updateDebugInfo() {
Debug::get()->add("X = " + std::to_string(static_cast<int>(player_->x_)) + ", Y = " + std::to_string(static_cast<int>(player_->y_)));
Debug::get()->add("VX = " + std::to_string(player_->vx_).substr(0, 4) + ", VY = " + std::to_string(player_->vy_).substr(0, 4));
Debug::get()->add("STATE = " + std::to_string(static_cast<int>(player_->state_)));
//Debug::get()->add("X = " + std::to_string(static_cast<int>(player_->x_)) + ", Y = " + std::to_string(static_cast<int>(player_->y_)));
//Debug::get()->add("VX = " + std::to_string(player_->vx_).substr(0, 4) + ", VY = " + std::to_string(player_->vy_).substr(0, 4));
//Debug::get()->add("STATE = " + std::to_string(static_cast<int>(player_->state_)));
}
// Pone la información de debug en pantalla
@@ -216,7 +216,7 @@ void Game::renderDebugInfo() {
// Comprueba los eventos
void Game::checkDebugEvents(const SDL_Event& event) {
if (event.type == SDL_EVENT_KEY_DOWN && event.key.repeat == 0) {
if (event.type == SDL_EVENT_KEY_DOWN && static_cast<int>(event.key.repeat) == 0) {
switch (event.key.key) {
case SDL_SCANCODE_G:
Debug::get()->toggleEnabled();

View File

@@ -79,7 +79,7 @@ class Game {
void updateDebugInfo();
// Pone la información de debug en pantalla
void renderDebugInfo();
static void renderDebugInfo();
// Comprueba los eventos
void checkDebugEvents(const SDL_Event& event);