Compare commits

...

2 Commits

Author SHA1 Message Date
b359a73d50 He tornat a deixar el progres del fondo que fa tope en la ultima fase, no en el final del joc 2025-08-17 08:20:38 +02:00
142603db71 hi_score_table: faltava posar el fondo en modo manual
game: redefinides les prioritats de dibuixat -> jugadors altra volta al front
2025-08-17 08:08:48 +02:00
6 changed files with 23 additions and 8 deletions

View File

@@ -84,8 +84,8 @@ service_menu.window_message.title_color 6496C8FF # Color del tít
service_menu.window_message.text_color DCDCDCFF # Color del texto en ventanas de mensaje (RGBA hexadecimal)
service_menu.window_message.padding 15.0f # Espaciado interno de ventanas de mensaje (píxeles)
service_menu.window_message.line_spacing 5.0f # Espaciado entre líneas de texto (píxeles)
service_menu.window_message.title_separator_spacing 10.0f # Espaciado entre título y contenido (píxeles)
service_menu.window_message.min_width 250.0f # Ancho mínimo de ventanas de mensaje (píxeles)
service_menu.window_message.title_separator_spacing 20.0f # Espaciado entre título y contenido (píxeles)
service_menu.window_message.min_width 200.0f # Ancho mínimo de ventanas de mensaje (píxeles)
service_menu.window_message.min_height 32.0f # Alto mínimo de ventanas de mensaje (píxeles)
service_menu.window_message.max_width_ratio 0.8f # Ratio máximo de ancho respecto a pantalla (0.0-1.0)
service_menu.window_message.max_height_ratio 0.8f # Ratio máximo de alto respecto a pantalla (0.0-1.0)

View File

@@ -41,7 +41,7 @@ Director::Director(int argc, std::span<char *> argv) {
Section::name = Section::Name::GAME;
Section::options = Section::Options::GAME_PLAY_1P;
#elif _DEBUG
Section::name = Section::Name::LOGO;
Section::name = Section::Name::GAME;
Section::options = Section::Options::GAME_PLAY_1P;
#else // NORMAL GAME
Section::name = Section::Name::LOGO;

View File

@@ -56,7 +56,7 @@ Game::Game(Player::Id player_id, int current_stage, bool demo)
pause_manager_(std::make_unique<PauseManager>([this](bool is_paused) { onPauseStateChanged(is_paused); })),
stage_manager_(std::make_unique<StageManager>()),
balloon_manager_(std::make_unique<BalloonManager>(stage_manager_.get())),
background_(std::make_unique<Background>(stage_manager_->getTotalPowerNeededToCompleteGame())),
background_(std::make_unique<Background>(stage_manager_->getPowerNeededToReachStage(stage_manager_->getTotalStages() - 1))),
fade_in_(std::make_unique<Fade>()),
fade_out_(std::make_unique<Fade>()),
tabe_(std::make_unique<Tabe>()),
@@ -986,12 +986,14 @@ void Game::fillCanvas() {
// Dibuja los objetos
background_->render();
renderPlayers();
renderSmartSprites();
renderItems();
balloon_manager_->render();
renderSmartSprites(); // El cafe que sale cuando te golpean
renderItems();
tabe_->render();
renderBullets();
renderPlayers();
renderPathSprites();
// Deja el renderizador apuntando donde estaba

View File

@@ -33,7 +33,6 @@ HiScoreTable::HiScoreTable()
backbuffer_(SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
fade_(std::make_unique<Fade>()),
background_(std::make_unique<Background>()),
ticks_(0),
view_area_(SDL_FRect{0, 0, param.game.width, param.game.height}),
fade_mode_(Fade::Mode::IN),
@@ -280,6 +279,7 @@ void HiScoreTable::initFade() {
// Inicializa el fondo
void HiScoreTable::initBackground() {
background_->setManualMode(true);
background_->setPos(param.game.game_area.rect);
background_->setCloudsSpeed(-0.1F);

View File

@@ -243,6 +243,18 @@ auto StageManager::getTotalPowerNeededToCompleteGame() const -> int {
return total_power_needed;
}
auto StageManager::getPowerNeededToReachStage(size_t target_stage_index) const -> int {
if (!validateStageIndex(target_stage_index)) {
return 0;
}
int power_needed = 0;
for (size_t i = 0; i < target_stage_index; ++i) {
power_needed += stages_[i].getPowerToComplete();
}
return power_needed;
}
// Implementación de la interfaz IStageInfo
auto StageManager::canCollectPower() const -> bool {
return power_collection_state_ == PowerCollectionState::ENABLED;

View File

@@ -75,6 +75,7 @@ class StageManager : public IStageInfo {
[[nodiscard]] auto getCurrentPower() const -> int { return current_power_; } // Obtiene el poder actual
[[nodiscard]] auto getTotalPower() const -> int { return total_power_; } // Obtiene el poder total acumulado
[[nodiscard]] auto getTotalPowerNeededToCompleteGame() const -> int; // Poder total necesario para completar el juego
[[nodiscard]] auto getPowerNeededToReachStage(size_t target_stage_index) const -> int; // Poder necesario para llegar a la fase X
[[nodiscard]] auto getTotalStages() const -> size_t { return stages_.size(); } // Obtiene el número total de fases
// --- Seguimiento de progreso ---