fix: si deixaves el nom en blanc, t'asigna uno de un pool pero despres no arribava a la tabla
style: quan confirmes el nom, apareix centrat
This commit is contained in:
@@ -49,7 +49,7 @@ Director::Director(int argc, const char *argv[])
|
|||||||
Section::name = Section::Name::GAME;
|
Section::name = Section::Name::GAME;
|
||||||
Section::options = Section::Options::GAME_PLAY_1P;
|
Section::options = Section::Options::GAME_PLAY_1P;
|
||||||
#elif DEBUG
|
#elif DEBUG
|
||||||
Section::name = Section::Name::LOGO;
|
Section::name = Section::Name::GAME;
|
||||||
Section::options = Section::Options::GAME_PLAY_1P;
|
Section::options = Section::Options::GAME_PLAY_1P;
|
||||||
#else // NORMAL GAME
|
#else // NORMAL GAME
|
||||||
Section::name = Section::Name::LOGO;
|
Section::name = Section::Name::LOGO;
|
||||||
|
|||||||
@@ -1261,7 +1261,7 @@ void Game::pause(bool value)
|
|||||||
// Añade una puntuación a la tabla de records
|
// Añade una puntuación a la tabla de records
|
||||||
void Game::addScoreToScoreBoard(const std::shared_ptr<Player> &player)
|
void Game::addScoreToScoreBoard(const std::shared_ptr<Player> &player)
|
||||||
{
|
{
|
||||||
const auto entry = HiScoreEntry(trim(player->getRecordName()), player->getScore(), player->get1CC());
|
const auto entry = HiScoreEntry(trim(player->getLastEnterName()), player->getScore(), player->get1CC());
|
||||||
auto manager = std::make_unique<ManageHiScoreTable>(Options::settings.hi_score_table);
|
auto manager = std::make_unique<ManageHiScoreTable>(Options::settings.hi_score_table);
|
||||||
Options::settings.last_hi_score_entry.at(player->getId() - 1) = manager->add(entry);
|
Options::settings.last_hi_score_entry.at(player->getId() - 1) = manager->add(entry);
|
||||||
manager->saveToFile(Asset::get()->get("score.bin"));
|
manager->saveToFile(Asset::get()->get("score.bin"));
|
||||||
|
|||||||
@@ -362,15 +362,6 @@ void Intro::initSprites()
|
|||||||
SDL_RenderRect(Screen::get()->getRenderer(), &rect1);
|
SDL_RenderRect(Screen::get()->getRenderer(), &rect1);
|
||||||
SDL_RenderRect(Screen::get()->getRenderer(), &rect2);
|
SDL_RenderRect(Screen::get()->getRenderer(), &rect2);
|
||||||
|
|
||||||
// Copia la textura con el dibujo sobre la textura de color aplicando blend modes
|
|
||||||
// SDL_FRect rect = {BORDER / 2, BORDER / 2, SPRITE_WIDTH, SPRITE_HEIGHT};
|
|
||||||
// auto inner_texture = Resource::get()->getTexture(TEXTURE_LIST.at(i))->getSDLTexture();
|
|
||||||
// SDL_SetTextureBlendMode(inner_texture, SDL_BLENDMODE_BLEND);
|
|
||||||
// SDL_SetTextureAlphaMod(inner_texture, 64);
|
|
||||||
// SDL_RenderTexture(Screen::get()->getRenderer(), inner_texture, nullptr, &rect);
|
|
||||||
// SDL_SetTextureBlendMode(inner_texture, SDL_BLENDMODE_NONE);
|
|
||||||
// SDL_SetTextureAlphaMod(inner_texture, 255);
|
|
||||||
|
|
||||||
// Deja el renderizador como estaba y añade la textura a la lista
|
// Deja el renderizador como estaba y añade la textura a la lista
|
||||||
SDL_SetRenderTarget(Screen::get()->getRenderer(), temp);
|
SDL_SetRenderTarget(Screen::get()->getRenderer(), temp);
|
||||||
shadow_textures.push_back(shadow_texture);
|
shadow_textures.push_back(shadow_texture);
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include <vector> // Para vector
|
#include <vector> // Para vector
|
||||||
#include "animated_sprite.h" // Para AnimatedSprite
|
#include "animated_sprite.h" // Para AnimatedSprite
|
||||||
#include "enter_name.h" // Para EnterName
|
#include "enter_name.h" // Para EnterName
|
||||||
#include "manage_hiscore_table.h" // Para HiScoreEntry
|
|
||||||
#include "options.h" // Para Options, OptionsGame, options
|
#include "options.h" // Para Options, OptionsGame, options
|
||||||
#include "utils.h" // Para Circle
|
#include "utils.h" // Para Circle
|
||||||
|
|
||||||
@@ -15,35 +14,39 @@ class Texture;
|
|||||||
enum class InputAction : int;
|
enum class InputAction : int;
|
||||||
enum class ScoreboardMode;
|
enum class ScoreboardMode;
|
||||||
|
|
||||||
// --- Estados del jugador ---
|
// --- Estados posibles del jugador ---
|
||||||
enum class PlayerState
|
enum class PlayerState
|
||||||
{
|
{
|
||||||
WALKING_LEFT,
|
// Estados de movimiento
|
||||||
WALKING_RIGHT,
|
WALKING_LEFT, // Caminando hacia la izquierda
|
||||||
WALKING_STOP,
|
WALKING_RIGHT, // Caminando hacia la derecha
|
||||||
|
WALKING_STOP, // Parado, sin moverse
|
||||||
|
|
||||||
FIRING_UP,
|
// Estados de disparo
|
||||||
FIRING_LEFT,
|
FIRING_UP, // Disparando hacia arriba
|
||||||
FIRING_RIGHT,
|
FIRING_LEFT, // Disparando hacia la izquierda
|
||||||
FIRING_NONE,
|
FIRING_RIGHT, // Disparando hacia la derecha
|
||||||
|
FIRING_NONE, // No está disparando
|
||||||
|
|
||||||
COOLING_UP,
|
// Estados de enfriamiento tras disparar
|
||||||
COOLING_LEFT,
|
COOLING_UP, // Enfriando tras disparar hacia arriba
|
||||||
COOLING_RIGHT,
|
COOLING_LEFT, // Enfriando tras disparar hacia la izquierda
|
||||||
|
COOLING_RIGHT, // Enfriando tras disparar hacia la derecha
|
||||||
|
|
||||||
PLAYING, // Está jugando
|
// Estados generales de juego
|
||||||
CONTINUE, // Cuenta atrás para continuar
|
PLAYING, // Está jugando activamente
|
||||||
WAITING, // No está jugando pero puede entrar a jugar
|
CONTINUE, // Cuenta atrás para continuar tras perder
|
||||||
ENTERING_NAME, // Introduciendo nombre
|
WAITING, // Esperando para entrar a jugar
|
||||||
|
ENTERING_NAME, // Introduciendo nombre para la tabla de puntuaciones
|
||||||
SHOWING_NAME, // Mostrando el nombre introducido
|
SHOWING_NAME, // Mostrando el nombre introducido
|
||||||
DYING, // El cadáver está volando por ahí
|
DYING, // El jugador está muriendo (animación de muerte)
|
||||||
DIED, // El cadáver ha desaparecido por el fondo
|
DIED, // El jugador ha muerto y ha desaparecido
|
||||||
GAME_OVER, // No está jugando y no puede entrar a jugar
|
GAME_OVER, // Fin de la partida, no puede jugar
|
||||||
CELEBRATING, // Poniendo pose de victoria
|
CELEBRATING, // Celebrando victoria (pose de victoria)
|
||||||
ENTERING_NAME_GAME_COMPLETED, // Poniendo nombre en el tramo final del juego
|
ENTERING_NAME_GAME_COMPLETED, // Introduciendo nombre tras completar el juego
|
||||||
LEAVING_SCREEN, // Moviéndose fuera de la pantalla
|
LEAVING_SCREEN, // Saliendo de la pantalla (animación)
|
||||||
ENTERING_SCREEN, // Entrando a la pantalla
|
ENTERING_SCREEN, // Entrando a la pantalla (animación)
|
||||||
CREDITS, // Estado para los créditos del juego
|
CREDITS, // Estado para mostrar los créditos del juego
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- Clase Player ---
|
// --- Clase Player ---
|
||||||
@@ -123,6 +126,7 @@ public:
|
|||||||
int getPosY() const { return pos_y_; }
|
int getPosY() const { return pos_y_; }
|
||||||
int getPowerUpCounter() const { return power_up_counter_; }
|
int getPowerUpCounter() const { return power_up_counter_; }
|
||||||
std::string getRecordName() const { return enter_name_ ? enter_name_->getFinalName() : "xxx"; }
|
std::string getRecordName() const { return enter_name_ ? enter_name_->getFinalName() : "xxx"; }
|
||||||
|
std::string getLastEnterName() const { return last_enter_name_; }
|
||||||
int getScore() const { return score_; }
|
int getScore() const { return score_; }
|
||||||
int getScoreBoardPanel() const { return scoreboard_panel_; }
|
int getScoreBoardPanel() const { return scoreboard_panel_; }
|
||||||
int getWidth() const { return WIDTH_; }
|
int getWidth() const { return WIDTH_; }
|
||||||
@@ -200,7 +204,7 @@ private:
|
|||||||
void shiftSprite(); // Recoloca el sprite
|
void shiftSprite(); // Recoloca el sprite
|
||||||
void updateInvulnerable(); // Monitoriza el estado de invulnerabilidad
|
void updateInvulnerable(); // Monitoriza el estado de invulnerabilidad
|
||||||
void updateContinueCounter(); // Actualiza el contador de continue
|
void updateContinueCounter(); // Actualiza el contador de continue
|
||||||
void updateEnterNameCounter();// Actualiza el contador de entrar nombre
|
void updateEnterNameCounter(); // Actualiza el contador de entrar nombre
|
||||||
void updateShowingName(); // Actualiza el estado SHOWING_NAME
|
void updateShowingName(); // Actualiza el estado SHOWING_NAME
|
||||||
void decEnterNameCounter(); // Decrementa el contador de entrar nombre
|
void decEnterNameCounter(); // Decrementa el contador de entrar nombre
|
||||||
void updateScoreboard(); // Actualiza el panel del marcador
|
void updateScoreboard(); // Actualiza el panel del marcador
|
||||||
|
|||||||
@@ -300,11 +300,12 @@ void Scoreboard::fillPanelTextures()
|
|||||||
|
|
||||||
// NAME
|
// NAME
|
||||||
text_scoreboard_->writeDX(TEXT_CENTER | TEXT_COLOR, slot4_3_.x, slot4_3_.y, Lang::getText("[SCOREBOARD] 11"), 1, text_color1_);
|
text_scoreboard_->writeDX(TEXT_CENTER | TEXT_COLOR, slot4_3_.x, slot4_3_.y, Lang::getText("[SCOREBOARD] 11"), 1, text_color1_);
|
||||||
|
|
||||||
/* TEXTO CENTRADO */
|
/* TEXTO CENTRADO */
|
||||||
// text_scoreboard_->writeDX(TEXT_CENTER | TEXT_COLOR, slot4_4_.x, slot4_4_.y, record_name_[i], 1, getColorLikeKnightRider(name_colors_, loop_counter_ / 5));
|
text_scoreboard_->writeDX(TEXT_CENTER | TEXT_COLOR, slot4_4_.x, slot4_4_.y, record_name_[i], 1, getColorLikeKnightRider(name_colors_, loop_counter_ / 5));
|
||||||
|
|
||||||
/* TEXTO A LA IZQUIERDA */
|
/* TEXTO A LA IZQUIERDA */
|
||||||
text_scoreboard_->writeColored(enter_name_pos_.x, enter_name_pos_.y, record_name_[i], getColorLikeKnightRider(name_colors_, loop_counter_ / 5));
|
//text_scoreboard_->writeColored(enter_name_pos_.x, enter_name_pos_.y, record_name_[i], getColorLikeKnightRider(name_colors_, loop_counter_ / 5));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ScoreboardMode::GAME_COMPLETED:
|
case ScoreboardMode::GAME_COMPLETED:
|
||||||
|
|||||||
Reference in New Issue
Block a user