ja es poden passar les dades del jugador per a cada panell
This commit is contained in:
@@ -18,12 +18,12 @@ Scoreboard::Scoreboard(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lan
|
|||||||
|
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
stage = 1;
|
stage = 1;
|
||||||
score1 = 0;
|
for (int i = 0; i< SCOREBOARD_MAX_PANELS; ++i)
|
||||||
score2 = 0;
|
{
|
||||||
mult1 = 1;
|
score[i] = 0;
|
||||||
mult2 = 1;
|
mult[i] = 0;
|
||||||
continue1 = 0;
|
continueCounter[i] = 0;
|
||||||
continue2 = 0;
|
}
|
||||||
hiScore = 0;
|
hiScore = 0;
|
||||||
power = 0;
|
power = 0;
|
||||||
hiScoreName = "";
|
hiScoreName = "";
|
||||||
@@ -138,39 +138,21 @@ void Scoreboard::render()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void Scoreboard::setScore1(int score)
|
void Scoreboard::setScore(int panel, int score)
|
||||||
{
|
{
|
||||||
score1 = score;
|
this->score[panel] = score;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void Scoreboard::setScore2(int score)
|
void Scoreboard::setMult(int panel, float mult)
|
||||||
{
|
{
|
||||||
score2 = score;
|
this->mult[panel] = mult;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void Scoreboard::setMult1(float mult)
|
void Scoreboard::setContinue(int panel, int value)
|
||||||
{
|
{
|
||||||
mult1 = mult;
|
continueCounter[panel] = value;
|
||||||
}
|
|
||||||
|
|
||||||
// Establece el valor de la variable
|
|
||||||
void Scoreboard::setMult2(float mult)
|
|
||||||
{
|
|
||||||
mult2 = mult;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Establece el valor de la variable
|
|
||||||
void Scoreboard::setContinue1(int value)
|
|
||||||
{
|
|
||||||
continue1 = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Establece el valor de la variable
|
|
||||||
void Scoreboard::setContinue2(int value)
|
|
||||||
{
|
|
||||||
continue2 = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
@@ -243,11 +225,11 @@ void Scoreboard::fillPanelTextures()
|
|||||||
case SCOREBOARD_MODE_SCORE:
|
case SCOREBOARD_MODE_SCORE:
|
||||||
// SCORE
|
// SCORE
|
||||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, lang->getText(53));
|
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, lang->getText(53));
|
||||||
textScoreBoard->writeCentered(slot4_2.x, slot4_2.y, updateScoreText(score1));
|
textScoreBoard->writeCentered(slot4_2.x, slot4_2.y, updateScoreText(score[i]));
|
||||||
|
|
||||||
// MULT
|
// MULT
|
||||||
textScoreBoard->writeCentered(slot4_3.x, slot4_3.y, lang->getText(55));
|
textScoreBoard->writeCentered(slot4_3.x, slot4_3.y, lang->getText(55));
|
||||||
textScoreBoard->writeCentered(slot4_4.x, slot4_4.y, std::to_string(mult1).substr(0, 3));
|
textScoreBoard->writeCentered(slot4_4.x, slot4_4.y, std::to_string(mult[i]).substr(0, 3));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCOREBOARD_MODE_DEMO:
|
case SCOREBOARD_MODE_DEMO:
|
||||||
@@ -286,11 +268,11 @@ void Scoreboard::fillPanelTextures()
|
|||||||
case SCOREBOARD_MODE_CONTINUE:
|
case SCOREBOARD_MODE_CONTINUE:
|
||||||
// SCORE
|
// SCORE
|
||||||
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, lang->getText(53));
|
textScoreBoard->writeCentered(slot4_1.x, slot4_1.y, lang->getText(53));
|
||||||
textScoreBoard->writeCentered(slot4_2.x, slot4_2.y, updateScoreText(score1));
|
textScoreBoard->writeCentered(slot4_2.x, slot4_2.y, updateScoreText(score[i]));
|
||||||
|
|
||||||
// CONTINUE
|
// CONTINUE
|
||||||
textScoreBoard->writeCentered(slot4_3.x, slot4_3.y, "Continuar?");
|
textScoreBoard->writeCentered(slot4_3.x, slot4_3.y, "Continuar?");
|
||||||
textScoreBoard->writeCentered(slot4_4.x, slot4_4.y, std::to_string(continue1));
|
textScoreBoard->writeCentered(slot4_4.x, slot4_4.y, std::to_string(continueCounter[i]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -10,11 +10,10 @@
|
|||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
|
|
||||||
// Defines
|
// Defines
|
||||||
#define SCOREBOARD_MAX_PANELS 3
|
|
||||||
|
|
||||||
#define SCOREBOARD_LEFT_PANEL 0
|
#define SCOREBOARD_LEFT_PANEL 0
|
||||||
#define SCOREBOARD_CENTER_PANEL 1
|
#define SCOREBOARD_CENTER_PANEL 1
|
||||||
#define SCOREBOARD_RIGHT_PANEL 2
|
#define SCOREBOARD_RIGHT_PANEL 2
|
||||||
|
#define SCOREBOARD_MAX_PANELS 3
|
||||||
|
|
||||||
#define SCOREBOARD_TICK_SPEED 100
|
#define SCOREBOARD_TICK_SPEED 100
|
||||||
|
|
||||||
@@ -52,22 +51,19 @@ private:
|
|||||||
std::vector<SDL_Texture *> panelTexture; // Texturas para dibujar cada panel;
|
std::vector<SDL_Texture *> panelTexture; // Texturas para dibujar cada panel;
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
struct options_t *options; // Variable con todas las variables de las opciones del programa
|
struct options_t *options; // Variable con todas las variables de las opciones del programa
|
||||||
int stage; // Número de fase actual
|
int stage; // Número de fase actual
|
||||||
int score1; // Puntuación del jugador 1
|
int score[SCOREBOARD_MAX_PANELS]; // Puntuación de los jugadores
|
||||||
int score2; // Puntuación del jugador 2
|
float mult[SCOREBOARD_MAX_PANELS]; // Multiplicador de los jugadores
|
||||||
float mult1; // Multiplicador del jugador 1
|
int continueCounter[SCOREBOARD_MAX_PANELS]; // Tiempo para continuar de los jugadores
|
||||||
float mult2; // Multiplicador del jugador 2
|
int hiScore; // Máxima puntuación
|
||||||
int continue1; // Tiempo para continuar del jugador 1
|
float power; // Poder actual de la fase
|
||||||
int continue2; // Tiempo para continuar del jugador 2
|
std::string hiScoreName; // Nombre del jugador con la máxima puntuación
|
||||||
int hiScore; // Máxima puntuación
|
color_t color; // Color del marcador
|
||||||
float power; // Poder actual de la fase
|
SDL_Rect rect; // Posición y dimensiones del marcador
|
||||||
std::string hiScoreName; // Nombre del jugador con la máxima puntuación
|
panel_t panel[SCOREBOARD_MAX_PANELS]; // Lista con todos los paneles del marcador
|
||||||
color_t color; // Color del marcador
|
Uint32 ticks; // Variable donde almacenar el valor de SDL_GetTiks()
|
||||||
SDL_Rect rect; // Posición y dimensiones del marcador
|
int counter; // Contador
|
||||||
panel_t panel[SCOREBOARD_MAX_PANELS]; // Lista con todos los paneles del marcador
|
|
||||||
Uint32 ticks; // Variable donde almacenar el valor de SDL_GetTiks()
|
|
||||||
int counter; // Contador
|
|
||||||
|
|
||||||
// Puntos predefinidos para colocar elementos en los paneles
|
// Puntos predefinidos para colocar elementos en los paneles
|
||||||
SDL_Point slot4_1, slot4_2, slot4_3, slot4_4;
|
SDL_Point slot4_1, slot4_2, slot4_3, slot4_4;
|
||||||
@@ -108,22 +104,13 @@ public:
|
|||||||
void render();
|
void render();
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void setScore1(int score);
|
void setScore(int panel, int score);
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void setScore2(int score);
|
void setMult(int panel, float mult);
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void setMult1(float mult);
|
void setContinue(int panel, int score);
|
||||||
|
|
||||||
// Establece el valor de la variable
|
|
||||||
void setMult2(float mult);
|
|
||||||
|
|
||||||
// Establece el valor de la variable
|
|
||||||
void setContinue1(int score);
|
|
||||||
|
|
||||||
// Establece el valor de la variable
|
|
||||||
void setContinue2(int score);
|
|
||||||
|
|
||||||
// Establece el valor de la variable
|
// Establece el valor de la variable
|
||||||
void setStage(int stage);
|
void setStage(int stage);
|
||||||
|
|||||||
Reference in New Issue
Block a user