Canviats defines per constexpr i enum class
Canviats punters a unique_ptr Afegit const a alguns metodes de classse fix: el segon jugador no podia unirse a la partida new: Quan els dos jugadors han decidit no continuar, ja no poden continuar i el marcador així ho reflectix fix: al posar el nom per segona vegada en la mateixa partida, no es reseteja la posició del selector fix: el fade venetian no netejava la textura i de vegades eixien gràfics corruptes fix: ara grava a disco cada vegada que es posa nom al morir
This commit is contained in:
@@ -37,9 +37,9 @@ Scoreboard::Scoreboard(SDL_Renderer *renderer)
|
||||
hiScoreName = "";
|
||||
color = {0, 0, 0};
|
||||
rect = {0, 0, 320, 40};
|
||||
panel[SCOREBOARD_LEFT_PANEL].mode = SCOREBOARD_MODE_SCORE;
|
||||
panel[SCOREBOARD_RIGHT_PANEL].mode = SCOREBOARD_MODE_SCORE;
|
||||
panel[SCOREBOARD_CENTER_PANEL].mode = SCOREBOARD_MODE_STAGE_INFO;
|
||||
panel[SCOREBOARD_LEFT_PANEL].mode = scoreboardMode::SCORE;
|
||||
panel[SCOREBOARD_RIGHT_PANEL].mode = scoreboardMode::SCORE;
|
||||
panel[SCOREBOARD_CENTER_PANEL].mode = scoreboardMode::STAGE_INFO;
|
||||
ticks = SDL_GetTicks();
|
||||
counter = 0;
|
||||
|
||||
@@ -248,7 +248,8 @@ void Scoreboard::fillPanelTextures()
|
||||
|
||||
switch (panel[i].mode)
|
||||
{
|
||||
case SCOREBOARD_MODE_SCORE:
|
||||
case scoreboardMode::SCORE:
|
||||
{
|
||||
// SCORE
|
||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, name[i]);
|
||||
textScoreBoard->writeCentered(slot4_2.x, slot4_2.y, updateScoreText(score[i]));
|
||||
@@ -257,26 +258,45 @@ void Scoreboard::fillPanelTextures()
|
||||
textScoreBoard->writeCentered(slot4_3.x, slot4_3.y, lang::getText(55));
|
||||
textScoreBoard->writeCentered(slot4_4.x, slot4_4.y, std::to_string(mult[i]).substr(0, 3));
|
||||
break;
|
||||
}
|
||||
|
||||
case SCOREBOARD_MODE_DEMO:
|
||||
case scoreboardMode::DEMO:
|
||||
{
|
||||
// DEMO MODE
|
||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, lang::getText(101));
|
||||
|
||||
// PRESS START TO PLAY
|
||||
if (counter % 10 < 8)
|
||||
{
|
||||
textScoreBoard->writeCentered(slot4_3.x, slot4_3.y - 2, lang::getText(103));
|
||||
textScoreBoard->writeCentered(slot4_4.x, slot4_4.y - 2, lang::getText(104));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCOREBOARD_MODE_GAME_OVER:
|
||||
case scoreboardMode::WAITING:
|
||||
{
|
||||
// GAME OVER
|
||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, lang::getText(102));
|
||||
|
||||
// PRESS START TO PLAY
|
||||
if (counter % 10 < 8)
|
||||
{
|
||||
textScoreBoard->writeCentered(slot4_3.x, slot4_3.y - 2, lang::getText(103));
|
||||
textScoreBoard->writeCentered(slot4_4.x, slot4_4.y - 2, lang::getText(104));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCOREBOARD_MODE_STAGE_INFO:
|
||||
case scoreboardMode::GAME_OVER:
|
||||
{
|
||||
// GAME OVER
|
||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y + 4, lang::getText(102));
|
||||
break;
|
||||
}
|
||||
|
||||
case scoreboardMode::STAGE_INFO:
|
||||
{
|
||||
// STAGE
|
||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, lang::getText(57) + std::to_string(stage));
|
||||
|
||||
@@ -290,8 +310,10 @@ void Scoreboard::fillPanelTextures()
|
||||
textScoreBoard->writeCentered(slot4_3.x, slot4_3.y, lang::getText(56));
|
||||
textScoreBoard->writeCentered(slot4_4.x, slot4_4.y, hiScoreName + " - " + updateScoreText(hiScore));
|
||||
break;
|
||||
}
|
||||
|
||||
case SCOREBOARD_MODE_CONTINUE:
|
||||
case scoreboardMode::CONTINUE:
|
||||
{
|
||||
// SCORE
|
||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, name[i]);
|
||||
textScoreBoard->writeCentered(slot4_2.x, slot4_2.y, updateScoreText(score[i]));
|
||||
@@ -300,8 +322,9 @@ void Scoreboard::fillPanelTextures()
|
||||
textScoreBoard->writeCentered(slot4_3.x, slot4_3.y, lang::getText(105));
|
||||
textScoreBoard->writeCentered(slot4_4.x, slot4_4.y, std::to_string(continueCounter[i]));
|
||||
break;
|
||||
}
|
||||
|
||||
case SCOREBOARD_MODE_ENTER_NAME:
|
||||
case scoreboardMode::ENTER_NAME:
|
||||
{
|
||||
// SCORE
|
||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, name[i]);
|
||||
@@ -314,7 +337,7 @@ void Scoreboard::fillPanelTextures()
|
||||
for (int j = 0; j < (int)recordName[i].size(); ++j)
|
||||
{
|
||||
if (j == selectorPos[i])
|
||||
{// La letra seleccionada se pinta de forma intermitente
|
||||
{ // La letra seleccionada se pinta de forma intermitente
|
||||
if (counter % 3 > 0)
|
||||
{
|
||||
SDL_RenderDrawLine(renderer, rect.x, rect.y + rect.h, rect.x + rect.w, rect.y + rect.h);
|
||||
@@ -413,7 +436,7 @@ void Scoreboard::recalculateAnchors()
|
||||
}
|
||||
|
||||
// Establece el modo del marcador
|
||||
void Scoreboard::setMode(int index, scoreboard_modes_e mode)
|
||||
void Scoreboard::setMode(int index, scoreboardMode mode)
|
||||
{
|
||||
panel[index].mode = mode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user