Añadida la clase scoreboard
This commit is contained in:
@@ -16,7 +16,7 @@ Director::Director(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
section = new section_t();
|
section = new section_t();
|
||||||
section->name = SECTION_PROG_LOGO;
|
section->name = SECTION_PROG_GAME;
|
||||||
|
|
||||||
// Inicializa las opciones del programa
|
// Inicializa las opciones del programa
|
||||||
initOptions();
|
initOptions();
|
||||||
|
|||||||
124
source/game.cpp
124
source/game.cpp
@@ -27,6 +27,7 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr
|
|||||||
// Crea los objetos
|
// Crea los objetos
|
||||||
fade = new Fade(renderer);
|
fade = new Fade(renderer);
|
||||||
eventHandler = new SDL_Event();
|
eventHandler = new SDL_Event();
|
||||||
|
scoreboard = new Scoreboard(renderer, screen, asset, lang, options);
|
||||||
|
|
||||||
// Carga los recursos
|
// Carga los recursos
|
||||||
loadMedia();
|
loadMedia();
|
||||||
@@ -147,6 +148,8 @@ Game::~Game()
|
|||||||
}
|
}
|
||||||
balloonTextures.clear();
|
balloonTextures.clear();
|
||||||
|
|
||||||
|
delete scoreboard;
|
||||||
|
|
||||||
delete text;
|
delete text;
|
||||||
delete textBig;
|
delete textBig;
|
||||||
delete textScoreBoard;
|
delete textScoreBoard;
|
||||||
@@ -401,7 +404,6 @@ void Game::loadMedia()
|
|||||||
gameBuildingsTexture = new Texture(renderer, asset->get("game_buildings.png"));
|
gameBuildingsTexture = new Texture(renderer, asset->get("game_buildings.png"));
|
||||||
gameCloudsTexture = new Texture(renderer, asset->get("game_clouds.png"));
|
gameCloudsTexture = new Texture(renderer, asset->get("game_clouds.png"));
|
||||||
gameGrassTexture = new Texture(renderer, asset->get("game_grass.png"));
|
gameGrassTexture = new Texture(renderer, asset->get("game_grass.png"));
|
||||||
gamePowerMeterTexture = new Texture(renderer, asset->get("game_power_meter.png"));
|
|
||||||
gameSkyColorsTexture = new Texture(renderer, asset->get("game_sky_colors.png"));
|
gameSkyColorsTexture = new Texture(renderer, asset->get("game_sky_colors.png"));
|
||||||
gameTextTexture = new Texture(renderer, asset->get("game_text.png"));
|
gameTextTexture = new Texture(renderer, asset->get("game_text.png"));
|
||||||
gameOverTexture = new Texture(renderer, asset->get("menu_game_over.png"));
|
gameOverTexture = new Texture(renderer, asset->get("menu_game_over.png"));
|
||||||
@@ -1599,120 +1601,6 @@ void Game::updateHiScore()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transforma un valor numérico en una cadena de 6 cifras
|
|
||||||
std::string Game::updateScoreText(Uint32 num)
|
|
||||||
{
|
|
||||||
if ((num >= 0) && (num <= 9))
|
|
||||||
{
|
|
||||||
return ("000000" + std::to_string(num));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((num >= 10) && (num <= 99))
|
|
||||||
{
|
|
||||||
return ("00000" + std::to_string(num));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((num >= 100) && (num <= 999))
|
|
||||||
{
|
|
||||||
return ("0000" + std::to_string(num));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((num >= 1000) && (num <= 9999))
|
|
||||||
{
|
|
||||||
return ("000" + std::to_string(num));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((num >= 010000) && (num <= 99999))
|
|
||||||
{
|
|
||||||
return ("00" + std::to_string(num));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((num >= 100000) && (num <= 999999))
|
|
||||||
{
|
|
||||||
return ("0" + std::to_string(num));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((num >= 1000000) && (num <= 9999999))
|
|
||||||
{
|
|
||||||
return (std::to_string(num));
|
|
||||||
}
|
|
||||||
|
|
||||||
return (std::to_string(num));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pinta el marcador en pantalla usando un objeto texto
|
|
||||||
void Game::renderScoreBoard()
|
|
||||||
{
|
|
||||||
// Dibuja el fondo del marcador
|
|
||||||
if (difficulty == DIFFICULTY_NORMAL)
|
|
||||||
{ // Pone el color gris de siempre
|
|
||||||
SDL_SetRenderDrawColor(renderer, 46, 63, 71, 255);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Pinta el fondo del marcador del color de la dificultad
|
|
||||||
SDL_SetRenderDrawColor(renderer, difficultyColor.r, difficultyColor.g, difficultyColor.b, 255);
|
|
||||||
}
|
|
||||||
SDL_Rect rect = {0, 160, 256, 32};
|
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
|
||||||
|
|
||||||
// Dibuja la linea que separa el marcador de la zona de juego
|
|
||||||
SDL_SetRenderDrawColor(renderer, 13, 26, 43, 255);
|
|
||||||
SDL_RenderDrawLine(renderer, 0, 160, 255, 160);
|
|
||||||
|
|
||||||
// Anclas para los elementos
|
|
||||||
const int offset1 = 162;
|
|
||||||
const int offset2 = offset1 + 7;
|
|
||||||
const int offset3 = offset2 + 7;
|
|
||||||
const int offset4 = offset3 + 7;
|
|
||||||
|
|
||||||
const int offsetLeft = PLAY_AREA_LEFT + 45;
|
|
||||||
const int offsetRight = PLAY_AREA_RIGHT - 45;
|
|
||||||
|
|
||||||
// PLAYER1 - SCORE
|
|
||||||
textScoreBoard->writeCentered(offsetLeft, offset1, lang->getText(53));
|
|
||||||
textScoreBoard->writeCentered(offsetLeft, offset2, updateScoreText(players[0]->getScore()));
|
|
||||||
|
|
||||||
// PLAYER1 - MULT
|
|
||||||
textScoreBoard->writeCentered(offsetLeft, offset3, lang->getText(55));
|
|
||||||
textScoreBoard->writeCentered(offsetLeft, offset4, std::to_string(players[0]->getScoreMultiplier()).substr(0, 3));
|
|
||||||
|
|
||||||
if (numPlayers == 2)
|
|
||||||
{
|
|
||||||
// PLAYER2 - SCORE
|
|
||||||
textScoreBoard->writeCentered(offsetRight, offset1, lang->getText(54));
|
|
||||||
textScoreBoard->writeCentered(offsetRight, offset2, updateScoreText(players[1]->getScore()));
|
|
||||||
|
|
||||||
// PLAYER2 - MULT
|
|
||||||
textScoreBoard->writeCentered(offsetRight, offset3, lang->getText(55));
|
|
||||||
textScoreBoard->writeCentered(offsetRight, offset4, std::to_string(players[1]->getScoreMultiplier()).substr(0, 3));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// PLAYER2 - SCORE
|
|
||||||
textScoreBoard->writeCentered(offsetRight, offset1, lang->getText(54));
|
|
||||||
textScoreBoard->writeCentered(offsetRight, offset2, "0000000");
|
|
||||||
|
|
||||||
// PLAYER2 - MULT
|
|
||||||
textScoreBoard->writeCentered(offsetRight, offset3, lang->getText(55));
|
|
||||||
textScoreBoard->writeCentered(offsetRight, offset4, "1.0");
|
|
||||||
}
|
|
||||||
|
|
||||||
// STAGE
|
|
||||||
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset1, lang->getText(57) + std::to_string(stage[currentStage].number));
|
|
||||||
|
|
||||||
// POWERMETER
|
|
||||||
powerMeterSprite->setPosY(offset2);
|
|
||||||
powerMeterSprite->setSpriteClip(0, 0, 40, 7);
|
|
||||||
powerMeterSprite->render();
|
|
||||||
const float percent = (stage[currentStage].currentPower * 40.0f) / stage[currentStage].powerToComplete;
|
|
||||||
powerMeterSprite->setSpriteClip(40, 0, (int)percent, 7);
|
|
||||||
powerMeterSprite->render();
|
|
||||||
|
|
||||||
// HI-SCORE
|
|
||||||
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset3, lang->getText(56));
|
|
||||||
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, hiScoreName + updateScoreText(hiScore));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actualiza las variables del jugador
|
// Actualiza las variables del jugador
|
||||||
void Game::updatePlayers()
|
void Game::updatePlayers()
|
||||||
{
|
{
|
||||||
@@ -2928,7 +2816,7 @@ void Game::render()
|
|||||||
renderMessages();
|
renderMessages();
|
||||||
renderItems();
|
renderItems();
|
||||||
renderSmartSprites();
|
renderSmartSprites();
|
||||||
renderScoreBoard();
|
scoreboard->render();
|
||||||
renderPlayers();
|
renderPlayers();
|
||||||
|
|
||||||
if ((deathCounter <= 150) && !players[0]->isAlive())
|
if ((deathCounter <= 150) && !players[0]->isAlive())
|
||||||
@@ -3292,7 +3180,7 @@ void Game::shakeScreen()
|
|||||||
renderBullets();
|
renderBullets();
|
||||||
renderItems();
|
renderItems();
|
||||||
renderPlayers();
|
renderPlayers();
|
||||||
renderScoreBoard();
|
scoreboard->render();
|
||||||
|
|
||||||
// Vuelca el contenido del renderizador en pantalla
|
// Vuelca el contenido del renderizador en pantalla
|
||||||
screen->blit();
|
screen->blit();
|
||||||
@@ -3433,7 +3321,7 @@ void Game::renderPausedGame()
|
|||||||
renderMessages();
|
renderMessages();
|
||||||
renderItems();
|
renderItems();
|
||||||
renderSmartSprites();
|
renderSmartSprites();
|
||||||
renderScoreBoard();
|
scoreboard->render();
|
||||||
renderPlayers();
|
renderPlayers();
|
||||||
|
|
||||||
if ((deathCounter <= 150) && !players[0]->isAlive())
|
if ((deathCounter <= 150) && !players[0]->isAlive())
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "fade.h"
|
#include "fade.h"
|
||||||
#include "item.h"
|
#include "item.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
#include "scoreboard.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#ifndef GAME_H
|
#ifndef GAME_H
|
||||||
@@ -121,6 +122,7 @@ private:
|
|||||||
Lang *lang; // Objeto para gestionar los textos en diferentes idiomas
|
Lang *lang; // Objeto para gestionar los textos en diferentes idiomas
|
||||||
Input *input; // Manejador de entrada
|
Input *input; // Manejador de entrada
|
||||||
section_t *section; // Seccion actual dentro del juego
|
section_t *section; // Seccion actual dentro del juego
|
||||||
|
Scoreboard *scoreboard; // Objeto para dibujar el marcador
|
||||||
|
|
||||||
std::vector<Player *> players; // Vector con los jugadores
|
std::vector<Player *> players; // Vector con los jugadores
|
||||||
std::vector<Balloon *> balloons; // Vector con los globos
|
std::vector<Balloon *> balloons; // Vector con los globos
|
||||||
@@ -138,7 +140,6 @@ private:
|
|||||||
Texture *gameBuildingsTexture; // Textura con los edificios de fondo
|
Texture *gameBuildingsTexture; // Textura con los edificios de fondo
|
||||||
Texture *gameCloudsTexture; // Textura con las nubes de fondo
|
Texture *gameCloudsTexture; // Textura con las nubes de fondo
|
||||||
Texture *gameGrassTexture; // Textura con la hierba del suelo
|
Texture *gameGrassTexture; // Textura con la hierba del suelo
|
||||||
Texture *gamePowerMeterTexture; // Textura con el marcador de poder de la fase
|
|
||||||
Texture *gameSkyColorsTexture; // Textura con los diferentes colores de fondo del juego
|
Texture *gameSkyColorsTexture; // Textura con los diferentes colores de fondo del juego
|
||||||
Texture *gameTextTexture; // Textura para los sprites con textos
|
Texture *gameTextTexture; // Textura para los sprites con textos
|
||||||
Texture *gameOverTexture; // Textura para la pantalla de game over
|
Texture *gameOverTexture; // Textura para la pantalla de game over
|
||||||
@@ -150,7 +151,6 @@ private:
|
|||||||
|
|
||||||
Text *text; // Fuente para los textos del juego
|
Text *text; // Fuente para los textos del juego
|
||||||
Text *textBig; // Fuente de texto grande
|
Text *textBig; // Fuente de texto grande
|
||||||
Text *textScoreBoard; // Fuente para el marcador del juego
|
|
||||||
Text *textNokia2; // Otra fuente de texto para mensajes
|
Text *textNokia2; // Otra fuente de texto para mensajes
|
||||||
Text *textNokiaBig2; // Y la versión en grande
|
Text *textNokiaBig2; // Y la versión en grande
|
||||||
|
|
||||||
@@ -171,7 +171,6 @@ private:
|
|||||||
Sprite *buildingsSprite; // Sprite con los edificios de fondo
|
Sprite *buildingsSprite; // Sprite con los edificios de fondo
|
||||||
Sprite *skyColorsSprite; // Sprite con los graficos del degradado de color de fondo
|
Sprite *skyColorsSprite; // Sprite con los graficos del degradado de color de fondo
|
||||||
Sprite *grassSprite; // Sprite para la hierba
|
Sprite *grassSprite; // Sprite para la hierba
|
||||||
Sprite *powerMeterSprite; // Sprite para el medidor de poder de la fase
|
|
||||||
Sprite *gameOverSprite; // Sprite para dibujar los graficos del game over
|
Sprite *gameOverSprite; // Sprite para dibujar los graficos del game over
|
||||||
Sprite *gameOverEndSprite; // Sprite para dibujar los graficos del game over de acabar el juego
|
Sprite *gameOverEndSprite; // Sprite para dibujar los graficos del game over de acabar el juego
|
||||||
|
|
||||||
@@ -287,12 +286,6 @@ private:
|
|||||||
// Actualiza el valor de HiScore en caso necesario
|
// Actualiza el valor de HiScore en caso necesario
|
||||||
void updateHiScore();
|
void updateHiScore();
|
||||||
|
|
||||||
// Transforma un valor numérico en una cadena de 6 cifras
|
|
||||||
std::string updateScoreText(Uint32 num);
|
|
||||||
|
|
||||||
// Pinta el marcador en pantalla usando un objeto texto
|
|
||||||
void renderScoreBoard();
|
|
||||||
|
|
||||||
// Actualiza las variables del jugador
|
// Actualiza las variables del jugador
|
||||||
void updatePlayers();
|
void updatePlayers();
|
||||||
|
|
||||||
|
|||||||
131
source/scoreboard.cpp
Normal file
131
source/scoreboard.cpp
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
#include "scoreboard.h"
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
Scoreboard::Scoreboard(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang, options_t *options)
|
||||||
|
{
|
||||||
|
// Copia los punteros
|
||||||
|
this->renderer = renderer;
|
||||||
|
this->screen = screen;
|
||||||
|
this->asset = asset;
|
||||||
|
this->lang = lang;
|
||||||
|
this->options = options;
|
||||||
|
|
||||||
|
// Crea objetos
|
||||||
|
gamePowerMeterTexture = new Texture(renderer, asset->get("game_power_meter.png"));
|
||||||
|
powerMeterSprite = new Sprite(PLAY_AREA_CENTER_X - 20, 170, 40, 7, gamePowerMeterTexture, renderer);
|
||||||
|
textScoreBoard = new Text(asset->get("8bithud.png"), asset->get("8bithud.txt"), renderer);
|
||||||
|
|
||||||
|
// Inicializa variables
|
||||||
|
stage = 0;
|
||||||
|
score1 = 0;
|
||||||
|
score2 = 0;
|
||||||
|
mult1 = 0;
|
||||||
|
mult2 = 0;
|
||||||
|
hiScore = 0;
|
||||||
|
power = 0;
|
||||||
|
hiScoreName = "";
|
||||||
|
color = {255, 0, 0};
|
||||||
|
}
|
||||||
|
|
||||||
|
Scoreboard::~Scoreboard()
|
||||||
|
{
|
||||||
|
gamePowerMeterTexture->unload();
|
||||||
|
delete gamePowerMeterTexture;
|
||||||
|
delete powerMeterSprite;
|
||||||
|
delete textScoreBoard;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transforma un valor numérico en una cadena de 6 cifras
|
||||||
|
std::string Scoreboard::updateScoreText(Uint32 num)
|
||||||
|
{
|
||||||
|
if ((num >= 0) && (num <= 9))
|
||||||
|
{
|
||||||
|
return ("000000" + std::to_string(num));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((num >= 10) && (num <= 99))
|
||||||
|
{
|
||||||
|
return ("00000" + std::to_string(num));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((num >= 100) && (num <= 999))
|
||||||
|
{
|
||||||
|
return ("0000" + std::to_string(num));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((num >= 1000) && (num <= 9999))
|
||||||
|
{
|
||||||
|
return ("000" + std::to_string(num));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((num >= 010000) && (num <= 99999))
|
||||||
|
{
|
||||||
|
return ("00" + std::to_string(num));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((num >= 100000) && (num <= 999999))
|
||||||
|
{
|
||||||
|
return ("0" + std::to_string(num));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((num >= 1000000) && (num <= 9999999))
|
||||||
|
{
|
||||||
|
return (std::to_string(num));
|
||||||
|
}
|
||||||
|
|
||||||
|
return (std::to_string(num));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pinta el marcador
|
||||||
|
void Scoreboard::render()
|
||||||
|
{
|
||||||
|
// Dibuja el fondo del marcador
|
||||||
|
SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 255);
|
||||||
|
SDL_Rect rect = {0, 160, 256, 32};
|
||||||
|
SDL_RenderFillRect(renderer, &rect);
|
||||||
|
|
||||||
|
// Dibuja la linea que separa el marcador de la zona de juego
|
||||||
|
SDL_SetRenderDrawColor(renderer, 13, 26, 43, 255);
|
||||||
|
SDL_RenderDrawLine(renderer, 0, 160, 255, 160);
|
||||||
|
|
||||||
|
// Anclas para los elementos
|
||||||
|
const int offset1 = 162;
|
||||||
|
const int offset2 = offset1 + 7;
|
||||||
|
const int offset3 = offset2 + 7;
|
||||||
|
const int offset4 = offset3 + 7;
|
||||||
|
|
||||||
|
const int offsetLeft = PLAY_AREA_LEFT + 45;
|
||||||
|
const int offsetRight = PLAY_AREA_RIGHT - 45;
|
||||||
|
|
||||||
|
// PLAYER1 - SCORE
|
||||||
|
textScoreBoard->writeCentered(offsetLeft, offset1, lang->getText(53));
|
||||||
|
textScoreBoard->writeCentered(offsetLeft, offset2, updateScoreText(score1));
|
||||||
|
|
||||||
|
// PLAYER1 - MULT
|
||||||
|
textScoreBoard->writeCentered(offsetLeft, offset3, lang->getText(55));
|
||||||
|
textScoreBoard->writeCentered(offsetLeft, offset4, std::to_string(mult1).substr(0, 3));
|
||||||
|
|
||||||
|
// PLAYER2 - SCORE
|
||||||
|
textScoreBoard->writeCentered(offsetRight, offset1, lang->getText(54));
|
||||||
|
textScoreBoard->writeCentered(offsetRight, offset2, updateScoreText(score2));
|
||||||
|
|
||||||
|
// PLAYER2 - MULT
|
||||||
|
textScoreBoard->writeCentered(offsetRight, offset3, lang->getText(55));
|
||||||
|
textScoreBoard->writeCentered(offsetRight, offset4, std::to_string(mult2).substr(0, 3));
|
||||||
|
|
||||||
|
// STAGE
|
||||||
|
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset1, lang->getText(57) + std::to_string(stage));
|
||||||
|
|
||||||
|
// POWERMETER
|
||||||
|
powerMeterSprite->setPosY(offset2);
|
||||||
|
powerMeterSprite->setSpriteClip(0, 0, 40, 7);
|
||||||
|
powerMeterSprite->render();
|
||||||
|
//const float percent = (stage[currentStage].currentPower * 40.0f) / stage[currentStage].powerToComplete;
|
||||||
|
const float percent = 0.5;
|
||||||
|
powerMeterSprite->setSpriteClip(40, 0, (int)percent, 7);
|
||||||
|
powerMeterSprite->render();
|
||||||
|
|
||||||
|
// HI-SCORE
|
||||||
|
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset3, lang->getText(56));
|
||||||
|
textScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, hiScoreName + updateScoreText(hiScore));
|
||||||
|
}
|
||||||
61
source/scoreboard.h
Normal file
61
source/scoreboard.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
#include "common/asset.h"
|
||||||
|
#include "common/input.h"
|
||||||
|
#include "common/jail_audio.h"
|
||||||
|
#include "common/menu.h"
|
||||||
|
#include "common/movingsprite.h"
|
||||||
|
#include "common/screen.h"
|
||||||
|
#include "common/smartsprite.h"
|
||||||
|
#include "common/sprite.h"
|
||||||
|
#include "common/text.h"
|
||||||
|
#include "common/utils.h"
|
||||||
|
#include "common/writer.h"
|
||||||
|
#include "const.h"
|
||||||
|
|
||||||
|
#ifndef SCOREBOARD_H
|
||||||
|
#define SCOREBOARD_H
|
||||||
|
|
||||||
|
// Clase Scoreboard
|
||||||
|
class Scoreboard
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// Objetos y punteros
|
||||||
|
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||||
|
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||||
|
Asset *asset; // Objeto que gestiona todos los ficheros de recursos
|
||||||
|
Lang *lang; // Objeto para gestionar los textos en diferentes idiomas
|
||||||
|
|
||||||
|
Texture *gamePowerMeterTexture; // Textura con el marcador de poder de la fase
|
||||||
|
Sprite *powerMeterSprite; // Sprite para el medidor de poder de la fase
|
||||||
|
Text *textScoreBoard; // Fuente para el marcador del juego
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
struct options_t *options; // Variable con todas las variables de las opciones del programa
|
||||||
|
int stage; // Numero de fase actual
|
||||||
|
int score1; // Puntuación del jugador 1
|
||||||
|
int score2; // Puntuación del jugador 2
|
||||||
|
int mult1; // Multiplicador del jugador 1
|
||||||
|
int mult2; // MUltiplicador del jugador 2
|
||||||
|
int hiScore; // Mäxima puntuación
|
||||||
|
int power; // Poder actual de la fase
|
||||||
|
std::string hiScoreName; // Nombre del jugador con la máxima puntuación
|
||||||
|
color_t color; // Color del marcador
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Constructor
|
||||||
|
Scoreboard(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lang, options_t *options);
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
~Scoreboard();
|
||||||
|
|
||||||
|
// Pinta el marcador
|
||||||
|
void render();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Transforma un valor numérico en una cadena de 6 cifras
|
||||||
|
std::string updateScoreText(Uint32 num);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user