canvi de pc
treballant en enter name
This commit is contained in:
@@ -22,7 +22,7 @@ void EnterName::init()
|
|||||||
// Pone la lista de indices para que refleje el nombre
|
// Pone la lista de indices para que refleje el nombre
|
||||||
updateCharacterIndex();
|
updateCharacterIndex();
|
||||||
|
|
||||||
// Actualiza el nombre para que ocupe 8 espacios
|
// Actualiza el nombre para que ocupe todos los espacios
|
||||||
updateName();
|
updateName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ void EnterName::init()
|
|||||||
void EnterName::incPosition()
|
void EnterName::incPosition()
|
||||||
{
|
{
|
||||||
position_++;
|
position_++;
|
||||||
position_ = std::min(position_, NAME_LENGHT - 1);
|
position_ = std::min(position_, NAME_LENGHT);
|
||||||
checkIfPositionHasBeenUsed();
|
checkIfPositionHasBeenUsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +118,9 @@ void EnterName::checkIfPositionHasBeenUsed()
|
|||||||
auto used = position_has_been_used_[position_];
|
auto used = position_has_been_used_[position_];
|
||||||
|
|
||||||
if (!used && position_ > 0)
|
if (!used && position_ > 0)
|
||||||
|
{
|
||||||
character_index_[position_] = character_index_[position_ - 1];
|
character_index_[position_] = character_index_[position_ - 1];
|
||||||
|
}
|
||||||
|
|
||||||
position_has_been_used_[position_] = true;
|
position_has_been_used_[position_] = true;
|
||||||
updateName();
|
updateName();
|
||||||
|
|||||||
@@ -1635,7 +1635,7 @@ void Game::handlePlayerContinue(const std::shared_ptr<Player> &player)
|
|||||||
input_->checkInput(InputType::FIRE_CENTER, INPUT_DO_NOT_ALLOW_REPEAT, options.controllers[controllerIndex].type, options.controllers[controllerIndex].index) ||
|
input_->checkInput(InputType::FIRE_CENTER, INPUT_DO_NOT_ALLOW_REPEAT, options.controllers[controllerIndex].type, options.controllers[controllerIndex].index) ||
|
||||||
input_->checkInput(InputType::FIRE_RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, options.controllers[controllerIndex].type, options.controllers[controllerIndex].index))
|
input_->checkInput(InputType::FIRE_RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, options.controllers[controllerIndex].type, options.controllers[controllerIndex].index))
|
||||||
{
|
{
|
||||||
if (player->getContinueCounter() < 8)
|
if (player->getContinueCounter() < 7)
|
||||||
{
|
{
|
||||||
player->decContinueCounter();
|
player->decContinueCounter();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ void ManageHiScoreTable::clear()
|
|||||||
table_.clear();
|
table_.clear();
|
||||||
|
|
||||||
// Añade 10 entradas predefinidas
|
// Añade 10 entradas predefinidas
|
||||||
table_.push_back(HiScoreEntry("BRY", 1000000));
|
table_.push_back(HiScoreEntry("BRIBON", 1000000));
|
||||||
table_.push_back(HiScoreEntry("USUFON", 500000));
|
table_.push_back(HiScoreEntry("USUFON", 500000));
|
||||||
table_.push_back(HiScoreEntry("GLUCAS", 100000));
|
table_.push_back(HiScoreEntry("GLUCAS", 100000));
|
||||||
table_.push_back(HiScoreEntry("PDLGAT", 50000));
|
table_.push_back(HiScoreEntry("PDLGAT", 50000));
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ struct HiScoreEntry
|
|||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
explicit HiScoreEntry(const std::string &n = "", int s = 0, bool occ = false)
|
explicit HiScoreEntry(const std::string &n = "", int s = 0, bool occ = false)
|
||||||
: name(n.substr(0, 5)), score(s), one_credit_complete(occ) {}
|
: name(n.substr(0, 6)), score(s), one_credit_complete(occ) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Clase ManageHiScoreTable
|
// Clase ManageHiScoreTable
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ public:
|
|||||||
int getPosX() const { return static_cast<int>(pos_x_); }
|
int getPosX() const { return static_cast<int>(pos_x_); }
|
||||||
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_->getName(); }
|
std::string getRecordName() const { return enter_name_->getName().substr(0, getRecordNamePos()); }
|
||||||
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_; }
|
||||||
|
|||||||
@@ -86,11 +86,11 @@ Scoreboard::~Scoreboard()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transforma un valor numérico en una cadena de 6 cifras
|
// Transforma un valor numérico en una cadena de 7 cifras
|
||||||
std::string Scoreboard::updateScoreText(int num)
|
std::string Scoreboard::updateScoreText(int num)
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << std::setw(8) << std::setfill('0') << num;
|
oss << std::setw(7) << std::setfill('0') << num;
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ void Scoreboard::fillPanelTextures()
|
|||||||
// Guarda a donde apunta actualmente el renderizador
|
// Guarda a donde apunta actualmente el renderizador
|
||||||
auto temp = SDL_GetRenderTarget(renderer_);
|
auto temp = SDL_GetRenderTarget(renderer_);
|
||||||
|
|
||||||
// Genera el contenidoi de cada panel_
|
// Genera el contenido de cada panel_
|
||||||
for (size_t i = 0; i < SCOREBOARD_MAX_PANELS; ++i)
|
for (size_t i = 0; i < SCOREBOARD_MAX_PANELS; ++i)
|
||||||
{
|
{
|
||||||
// Cambia el destino del renderizador
|
// Cambia el destino del renderizador
|
||||||
@@ -253,18 +253,31 @@ void Scoreboard::fillPanelTextures()
|
|||||||
text_scoreboard_->writeCentered(slot4_2_.x, slot4_2_.y, updateScoreText(score_[i]));
|
text_scoreboard_->writeCentered(slot4_2_.x, slot4_2_.y, updateScoreText(score_[i]));
|
||||||
|
|
||||||
// ENTER NAME
|
// ENTER NAME
|
||||||
|
{
|
||||||
text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText(106));
|
text_scoreboard_->writeCentered(slot4_3_.x, slot4_3_.y, lang::getText(106));
|
||||||
SDL_Rect rect = {enter_name_pos_.x, enter_name_pos_.y, 5, 7};
|
SDL_Rect rect = {enter_name_pos_.x, enter_name_pos_.y, 5, 7};
|
||||||
SDL_SetRenderDrawColor(renderer_, 0xFF, 0xFF, 0xEB, 255);
|
|
||||||
|
// Recorre el nombre
|
||||||
for (size_t j = 0; j < record_name_[i].size(); ++j)
|
for (size_t j = 0; j < record_name_[i].size(); ++j)
|
||||||
{
|
{
|
||||||
|
// Selecciona el color
|
||||||
|
const Color color = j < selector_pos_[i] ? orange_soft_color.lighten() : Color(0xFF, 0xFF, 0xEB);
|
||||||
|
|
||||||
if (j != selector_pos_[i] || counter_ % 3 == 0)
|
if (j != selector_pos_[i] || counter_ % 3 == 0)
|
||||||
{
|
{
|
||||||
|
// Dibuja la linea
|
||||||
|
if (j >= selector_pos_[i])
|
||||||
|
{
|
||||||
|
SDL_SetRenderDrawColor(renderer_, color.r, color.g, color.b, 255);
|
||||||
SDL_RenderDrawLine(renderer_, rect.x, rect.y + rect.h, rect.x + rect.w, rect.y + rect.h);
|
SDL_RenderDrawLine(renderer_, rect.x, rect.y + rect.h, rect.x + rect.w, rect.y + rect.h);
|
||||||
text_scoreboard_->write(rect.x, rect.y, record_name_[i].substr(j, 1));
|
}
|
||||||
|
|
||||||
|
// Dibuja la letra
|
||||||
|
text_scoreboard_->writeColored(rect.x, rect.y, record_name_[i].substr(j, 1), color);
|
||||||
}
|
}
|
||||||
rect.x += 7;
|
rect.x += 7;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ScoreboardMode::GAME_COMPLETED:
|
case ScoreboardMode::GAME_COMPLETED:
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ private:
|
|||||||
// Recalcula las anclas de los elementos
|
// Recalcula las anclas de los elementos
|
||||||
void recalculateAnchors();
|
void recalculateAnchors();
|
||||||
|
|
||||||
// Transforma un valor numérico en una cadena de 6 cifras
|
// Transforma un valor numérico en una cadena de 7 cifras
|
||||||
std::string updateScoreText(int num);
|
std::string updateScoreText(int num);
|
||||||
|
|
||||||
// Crea la textura de fondo
|
// Crea la textura de fondo
|
||||||
|
|||||||
Reference in New Issue
Block a user