renomena tipus _t/_e a CamelCase (Circle, Color, Section, ...)

This commit is contained in:
2026-05-14 22:16:36 +02:00
parent 9a2da460cc
commit 0bc55f5732
37 changed files with 209 additions and 209 deletions
+3 -3
View File
@@ -105,6 +105,6 @@ constexpr int SUBSECTION_TITLE_INSTRUCTIONS = 6;
constexpr int NO_KIND = 0;
// Colores
const color_t bgColor = {0x27, 0x27, 0x36};
const color_t noColor = {0xFF, 0xFF, 0xFF};
const color_t shdwTxtColor = {0x43, 0x43, 0x4F};
const Color bgColor = {0x27, 0x27, 0x36};
const Color noColor = {0xFF, 0xFF, 0xFF};
const Color shdwTxtColor = {0x43, 0x43, 0x4F};
+1 -1
View File
@@ -719,7 +719,7 @@ auto Balloon::getScore() const -> Uint16 {
}
// Obtiene el circulo de colisión
auto Balloon::getCollider() -> circle_t & {
auto Balloon::getCollider() -> Circle & {
return collider;
}
+3 -3
View File
@@ -5,7 +5,7 @@
#include <string> // for string
#include <vector> // for vector
#include "utils/utils.h" // for circle_t
#include "utils/utils.h" // for Circle
class AnimatedSprite;
class Texture;
@@ -104,7 +104,7 @@ class Balloon {
bool popping; // Indica si el globo está explotando
bool stopped; // Indica si el globo está parado
bool visible; // Indica si el globo es visible
circle_t collider; // Circulo de colisión del objeto
Circle collider; // Circulo de colisión del objeto
Uint16 creationCounter; // Temporizador para controlar el estado "creandose"
Uint16 creationCounterIni; // Valor inicial para el temporizador para controlar el estado "creandose"
Uint16 score; // Puntos que da el globo al ser destruido
@@ -243,7 +243,7 @@ class Balloon {
[[nodiscard]] auto getScore() const -> Uint16;
// Obtiene el circulo de colisión
auto getCollider() -> circle_t &;
auto getCollider() -> Circle &;
// Obtiene le valor de la variable
[[nodiscard]] auto getMenace() const -> Uint8;
+1 -1
View File
@@ -169,7 +169,7 @@ auto Bullet::getOwner() const -> int {
}
// Obtiene el circulo de colisión
auto Bullet::getCollider() -> circle_t & {
auto Bullet::getCollider() -> Circle & {
return collider;
}
+3 -3
View File
@@ -3,7 +3,7 @@
#include <SDL3/SDL.h>
#include <cstdint> // for uint8_t
#include "utils/utils.h" // for circle_t
#include "utils/utils.h" // for Circle
class Sprite;
class Texture;
@@ -35,7 +35,7 @@ class Bullet {
int velY; // Velocidad en el eje Y
BulletKind kind; // Tipo de objeto
int owner; // Identificador del dueño del objeto
circle_t collider; // Circulo de colisión del objeto
Circle collider; // Circulo de colisión del objeto
// Alinea el circulo de colisión con el objeto
void shiftColliders();
@@ -84,5 +84,5 @@ class Bullet {
[[nodiscard]] auto getOwner() const -> int;
// Obtiene el circulo de colisión
auto getCollider() -> circle_t &;
auto getCollider() -> Circle &;
};
+1 -1
View File
@@ -180,7 +180,7 @@ auto Item::isEnabled() const -> bool {
}
// Obtiene el circulo de colisión
auto Item::getCollider() -> circle_t & {
auto Item::getCollider() -> Circle & {
return collider;
}
+3 -3
View File
@@ -5,7 +5,7 @@
#include <string> // for string
#include <vector> // for vector
#include "utils/utils.h" // for circle_t
#include "utils/utils.h" // for Circle
class AnimatedSprite;
class Texture;
@@ -35,7 +35,7 @@ class Item {
bool floorCollision; // Indica si el objeto colisiona con el suelo
Uint8 kind; // Especifica el tipo de objeto que es
bool enabled; // Especifica si el objeto está habilitado
circle_t collider; // Circulo de colisión del objeto
Circle collider; // Circulo de colisión del objeto
// Alinea el circulo de colisión con la posición del objeto
void shiftColliders();
@@ -92,7 +92,7 @@ class Item {
[[nodiscard]] auto isEnabled() const -> bool;
// Obtiene el circulo de colisión
auto getCollider() -> circle_t &;
auto getCollider() -> Circle &;
// Informa si el objeto ha colisionado con el suelo
[[nodiscard]] auto isOnFloor() const -> bool;
+2 -2
View File
@@ -3,7 +3,7 @@
#include <algorithm>
#include <cstdlib> // for rand
#include "core/input/input.h" // for inputs_e
#include "core/input/input.h" // for InputAction
#include "core/rendering/animatedsprite.h" // for AnimatedSprite
#include "core/rendering/texture.h" // for Texture
#include "game/defaults.hpp" // for PLAY_AREA_LEFT, PLAY_AREA_RIGHT
@@ -469,7 +469,7 @@ auto Player::getCoffees() const -> Uint8 {
}
// Obtiene el circulo de colisión
auto Player::getCollider() -> circle_t & {
auto Player::getCollider() -> Circle & {
return collider;
}
+3 -3
View File
@@ -5,7 +5,7 @@
#include <string> // for string
#include <vector> // for vector
#include "utils/utils.h" // for circle_t
#include "utils/utils.h" // for Circle
class AnimatedSprite;
class Texture;
@@ -65,7 +65,7 @@ class Player {
bool powerUp; // Indica si el jugador tiene activo el modo PowerUp
Uint16 powerUpCounter; // Temporizador para el modo PowerUp
bool input; // Indica si puede recibir ordenes de entrada
circle_t collider; // Circulo de colisión del jugador
Circle collider; // Circulo de colisión del jugador
// Actualiza el circulo de colisión a la posición del jugador
void shiftColliders();
@@ -210,7 +210,7 @@ class Player {
[[nodiscard]] auto getCoffees() const -> Uint8;
// Obtiene el circulo de colisión
auto getCollider() -> circle_t &;
auto getCollider() -> Circle &;
// Obtiene el puntero a la textura con los gráficos de la animación de morir
auto getDeadTexture() -> Texture *;
+5 -5
View File
@@ -10,7 +10,7 @@
#include "core/audio/audio.hpp" // for Audio
#include "core/input/global_inputs.hpp" // for GlobalInputs::handle
#include "core/input/input.h" // for inputs_e, Input, REPEAT_TRUE, REPEAT_FALSE
#include "core/input/input.h" // for InputAction, Input, REPEAT_TRUE, REPEAT_FALSE
#include "core/locale/lang.h" // for Lang
#include "core/rendering/fade.h" // for Fade, FADE_CENTER
#include "core/rendering/movingsprite.h" // for MovingSprite
@@ -31,7 +31,7 @@
struct JA_Sound_t;
// Constructor
Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, bool demo, section_t *section)
Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, bool demo, Section *section)
: lastStageReached(currentStage) {
// Copia los punteros
this->renderer = renderer;
@@ -502,10 +502,10 @@ auto Game::loadScoreFile() -> bool {
auto Game::loadDemoFile() -> bool {
// Lee los datos de la demo desde Resource (precargados al arrancar).
const auto &bytes = Resource::get()->getDemoBytes();
const size_t expected = sizeof(demoKeys_t) * TOTAL_DEMO_DATA;
const size_t expected = sizeof(DemoKeys) * TOTAL_DEMO_DATA;
if (bytes.size() >= expected) {
for (int i = 0; i < TOTAL_DEMO_DATA; ++i) {
memcpy(&demo.dataFile[i], bytes.data() + (i * sizeof(demoKeys_t)), sizeof(demoKeys_t));
memcpy(&demo.dataFile[i], bytes.data() + (i * sizeof(DemoKeys)), sizeof(DemoKeys));
}
if (Options::settings.console) {
std::cout << "Demo data loaded (" << bytes.size() << " bytes)" << '\n';
@@ -564,7 +564,7 @@ auto Game::saveDemoFile() -> bool {
if (file != nullptr) {
// Guardamos los datos
for (auto &i : demo.dataFile) {
SDL_WriteIO(file, &i, sizeof(demoKeys_t));
SDL_WriteIO(file, &i, sizeof(DemoKeys));
}
if (Options::settings.console) {
+6 -6
View File
@@ -7,7 +7,7 @@
#include <vector> // for vector
#include "game/entities/bullet.h" // for BulletKind (signatura de createBullet)
#include "utils/utils.h" // for demoKeys_t, color_t
#include "utils/utils.h" // for DemoKeys, Color
class Balloon;
class Bullet;
class Fade;
@@ -123,13 +123,13 @@ class Game {
bool enabled; // Indica si está activo el modo demo
bool recording; // Indica si está activado el modo para grabar la demo
Uint16 counter; // Contador para el modo demo
demoKeys_t keys; // Variable con las pulsaciones de teclas del modo demo
demoKeys_t dataFile[TOTAL_DEMO_DATA]; // Datos del fichero con los movimientos para la demo
DemoKeys keys; // Variable con las pulsaciones de teclas del modo demo
DemoKeys dataFile[TOTAL_DEMO_DATA]; // Datos del fichero con los movimientos para la demo
};
// Objetos y punteros
SDL_Renderer *renderer; // El renderizador de la ventana
section_t *section; // Seccion actual dentro del juego
Section *section; // Seccion actual dentro del juego
std::vector<Player *> players; // Vector con los jugadores
std::vector<Balloon *> balloons; // Vector con los globos
@@ -238,7 +238,7 @@ class Game {
int gameCompletedCounter; // Contador para el tramo final, cuando se ha completado la partida y ya no aparecen más enemigos
Uint8 difficulty; // Dificultad del juego
float difficultyScoreMultiplier; // Multiplicador de puntos en función de la dificultad
color_t difficultyColor; // Color asociado a la dificultad
Color difficultyColor; // Color asociado a la dificultad
Uint8 onePlayerControl; // Variable para almacenar el valor de las opciones
enemyFormation_t enemyFormation[NUMBER_OF_ENEMY_FORMATIONS]; // Vector con todas las formaciones enemigas
enemyPool_t enemyPool[10]; // Variable con los diferentes conjuntos de formaciones enemigas
@@ -521,7 +521,7 @@ class Game {
public:
// Constructor
Game(int numPlayers, int currentStage, SDL_Renderer *renderer, bool demo, section_t *section);
Game(int numPlayers, int currentStage, SDL_Renderer *renderer, bool demo, Section *section);
// Destructor
~Game();
+3 -3
View File
@@ -20,7 +20,7 @@ namespace Options {
Audio audio;
Loading loading;
Settings settings;
std::vector<input_t> inputs;
std::vector<InputDevice> inputs;
std::vector<PostFXPreset> postfx_presets;
std::string postfx_file_path;
@@ -197,13 +197,13 @@ namespace Options {
// Dispositius d'entrada per defecte
inputs.clear();
input_t kb;
InputDevice kb;
kb.id = 0;
kb.name = "KEYBOARD";
kb.deviceType = INPUT_USE_KEYBOARD;
inputs.push_back(kb);
input_t gc;
InputDevice gc;
gc.id = 0;
gc.name = "GAME CONTROLLER";
gc.deviceType = INPUT_USE_GAMECONTROLLER;
+2 -2
View File
@@ -7,7 +7,7 @@
#include "core/rendering/shader_backend.hpp" // for Rendering::ShaderType
#include "game/defaults.hpp"
#include "utils/utils.h" // for input_t
#include "utils/utils.h" // for InputDevice
// =============================================================================
// Opciones del programa, alineades amb coffee_crisis_arcade_edition.
@@ -125,7 +125,7 @@ namespace Options {
extern Audio audio;
extern Loading loading;
extern Settings settings;
extern std::vector<input_t> inputs; // [0]=KEYBOARD, [1]=GAMECONTROLLER per defecte
extern std::vector<InputDevice> inputs; // [0]=KEYBOARD, [1]=GAMECONTROLLER per defecte
// Presets de shaders (carregats de postfx.yaml / crtpi.yaml al config folder)
extern std::vector<PostFXPreset> postfx_presets;
+6 -6
View File
@@ -8,7 +8,7 @@
#include "core/audio/audio.hpp" // for Audio::update
#include "core/input/global_inputs.hpp" // for GlobalInputs::handle
#include "core/input/input.h" // for Input, REPEAT_FALSE, inputs_e
#include "core/input/input.h" // for Input, REPEAT_FALSE, InputAction
#include "core/locale/lang.h" // for Lang
#include "core/rendering/screen.h" // for Screen
#include "core/rendering/sprite.h" // for Sprite
@@ -16,10 +16,10 @@
#include "core/rendering/texture.h" // for Texture
#include "core/resources/resource.h"
#include "game/defaults.hpp" // for shdwTxtColor, GAMECANVAS_CENTER_X, GAME...
#include "utils/utils.h" // for color_t, section_t
#include "utils/utils.h" // for Color, Section
// Constructor
Instructions::Instructions(SDL_Renderer *renderer, section_t *section) {
Instructions::Instructions(SDL_Renderer *renderer, Section *section) {
// Copia los punteros
this->renderer = renderer;
this->section = section;
@@ -103,7 +103,7 @@ void Instructions::render() {
SDL_Rect window = {0, 0, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT};
SDL_Rect srcRect = {0, 0, 16, 16};
const color_t orangeColor = {0xFF, 0x7A, 0x00};
const Color orangeColor = {0xFF, 0x7A, 0x00};
const SDL_Rect destRect1 = {60, 88 + (16 * 0), 16, 16}; // Disquito
const SDL_Rect destRect2 = {60, 88 + (16 * 1), 16, 16}; // Gavineixon
@@ -231,7 +231,7 @@ void Instructions::checkInput() {
}
// Bucle para la pantalla de instrucciones (compatibilidad)
void Instructions::run(mode_e mode) {
void Instructions::run(InstructionsMode mode) {
start(mode);
while (!finished) {
@@ -250,7 +250,7 @@ void Instructions::run(mode_e mode) {
}
// Inicia las instrucciones (sin bucle)
void Instructions::start(mode_e mode) {
void Instructions::start(InstructionsMode mode) {
this->mode = mode;
finished = false;
quitRequested = false;
+7 -7
View File
@@ -7,9 +7,9 @@
class Sprite;
class Text;
class Texture;
struct section_t;
struct Section;
enum mode_e : std::uint8_t {
enum InstructionsMode : std::uint8_t {
m_manual,
m_auto
};
@@ -24,7 +24,7 @@ class Instructions {
SDL_Texture *backbuffer; // Textura para usar como backbuffer
Sprite *sprite; // Sprite con la textura de las instrucciones
Text *text; // Objeto para escribir texto
section_t *section; // Estado del bucle principal para saber si continua o se sale
Section *section; // Estado del bucle principal para saber si continua o se sale
// Variables
Uint16 counter; // Contador
@@ -32,7 +32,7 @@ class Instructions {
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
bool manualQuit; // Indica si se quiere salir del modo manual
mode_e mode{m_auto}; // Modo en el que se van a ejecutar las instrucciones
InstructionsMode mode{m_auto}; // Modo en el que se van a ejecutar las instrucciones
bool finished; // Indica si las instrucciones han terminado
bool quitRequested; // Indica si se ha solicitado salir de la aplicación
@@ -41,7 +41,7 @@ class Instructions {
public:
// Constructor
Instructions(SDL_Renderer *renderer, section_t *section);
Instructions(SDL_Renderer *renderer, Section *section);
// Destructor
~Instructions();
@@ -50,10 +50,10 @@ class Instructions {
auto operator=(const Instructions &) -> Instructions & = delete;
// Bucle principal
void run(mode_e mode);
void run(InstructionsMode mode);
// Inicia las instrucciones (sin bucle)
void start(mode_e mode);
void start(InstructionsMode mode);
// Actualiza las variables
void update();
+3 -3
View File
@@ -6,7 +6,7 @@
#include "core/audio/audio.hpp" // for Audio::get, Audio::update
#include "core/input/global_inputs.hpp" // for GlobalInputs::handle
#include "core/input/input.h" // for Input, REPEAT_FALSE, inputs_e
#include "core/input/input.h" // for Input, REPEAT_FALSE, InputAction
#include "core/locale/lang.h" // for Lang
#include "core/rendering/screen.h" // for Screen
#include "core/rendering/smartsprite.h" // for SmartSprite
@@ -15,10 +15,10 @@
#include "core/rendering/writer.h" // for Writer
#include "core/resources/resource.h"
#include "game/defaults.hpp" // for GAMECANVAS_CENTER_X, GAMECANVAS_FIRST_QU...
#include "utils/utils.h" // for section_t, color_t
#include "utils/utils.h" // for Section, Color
// Constructor
Intro::Intro(SDL_Renderer *renderer, section_t *section) {
Intro::Intro(SDL_Renderer *renderer, Section *section) {
// Copia los punteros
this->renderer = renderer;
this->section = section;
+3 -3
View File
@@ -8,7 +8,7 @@ class Text;
class Texture;
class Writer;
struct JA_Music_t;
struct section_t;
struct Section;
// Clase Intro
class Intro {
@@ -20,7 +20,7 @@ class Intro {
std::vector<SmartSprite *> bitmaps; // Vector con los sprites inteligentes para los dibujos de la intro
std::vector<Writer *> texts; // Textos de la intro
Text *text; // Textos de la intro
section_t *section; // Estado del bucle principal para saber si continua o se sale
Section *section; // Estado del bucle principal para saber si continua o se sale
// Variables
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
@@ -42,7 +42,7 @@ class Intro {
public:
// Constructor
Intro(SDL_Renderer *renderer, section_t *section);
Intro(SDL_Renderer *renderer, Section *section);
// Destructor
~Intro();
+3 -3
View File
@@ -7,21 +7,21 @@
#include "core/audio/audio.hpp" // for Audio::get, Audio::update
#include "core/input/global_inputs.hpp" // for GlobalInputs::handle
#include "core/input/input.h" // for Input, REPEAT_FALSE, inputs_e
#include "core/input/input.h" // for Input, REPEAT_FALSE, InputAction
#include "core/rendering/screen.h" // for Screen
#include "core/rendering/sprite.h" // for Sprite
#include "core/rendering/texture.h" // for Texture
#include "core/resources/asset.h" // for Asset
#include "core/resources/resource.h"
#include "game/defaults.hpp" // for bgColor, SECTION_PROG_LOGO, SECTION_PROG...
#include "utils/utils.h" // for section_t, color_t
#include "utils/utils.h" // for Section, Color
// Valores de inicialización y fin
constexpr int INIT_FADE = 100;
constexpr int END_LOGO = 200;
// Constructor
Logo::Logo(SDL_Renderer *renderer, section_t *section) {
Logo::Logo(SDL_Renderer *renderer, Section *section) {
// Copia la dirección de los objetos
this->renderer = renderer;
this->section = section;
+3 -3
View File
@@ -3,7 +3,7 @@
#include <SDL3/SDL.h>
class Sprite;
class Texture;
struct section_t;
struct Section;
// Clase Logo
class Logo {
@@ -13,7 +13,7 @@ class Logo {
Texture *texture; // Textura con los graficos
SDL_Event *eventHandler; // Manejador de eventos
Sprite *sprite; // Sprite con la textura del logo
section_t *section; // Estado del bucle principal para saber si continua o se sale
Section *section; // Estado del bucle principal para saber si continua o se sale
// Variables
Uint32 ticks; // Contador de ticks para ajustar la velocidad del programa
@@ -37,7 +37,7 @@ class Logo {
public:
// Constructor
Logo(SDL_Renderer *renderer, section_t *section);
Logo(SDL_Renderer *renderer, Section *section);
// Destructor
~Logo();
+4 -4
View File
@@ -25,7 +25,7 @@
#include "game/ui/menu.h" // for Menu
// Constructor
Title::Title(SDL_Renderer *renderer, section_t *section) {
Title::Title(SDL_Renderer *renderer, Section *section) {
// Copia las direcciones de los punteros
this->renderer = renderer;
this->section = section;
@@ -112,7 +112,7 @@ void Title::init() {
// Pone valores por defecto a las opciones de control
Options::inputs.clear();
input_t inp;
InputDevice inp;
inp.id = 0;
inp.name = "KEYBOARD";
inp.deviceType = INPUT_USE_KEYBOARD;
@@ -929,7 +929,7 @@ void Title::run() {
}
// Inicia la parte donde se muestran las instrucciones
void Title::runInstructions(mode_e mode) {
void Title::runInstructions(InstructionsMode mode) {
instructions = new Instructions(renderer, section);
instructions->start(mode);
instructionsActive = true;
@@ -1046,7 +1046,7 @@ void Title::checkInputDevices() {
}
const int numControllers = Input::get()->getNumControllers();
availableInputDevices.clear();
input_t temp;
InputDevice temp;
// Añade todos los mandos
if (numControllers > 0) {
+9 -9
View File
@@ -5,8 +5,8 @@
#include <vector> // for vector
#include "game/options.hpp" // for Options::Video, Options::Window (per snapshot cancel)
#include "game/scenes/instructions.h" // for mode_e
#include "utils/utils.h" // for input_t, section_t
#include "game/scenes/instructions.h" // for InstructionsMode
#include "utils/utils.h" // for InputDevice, Section
class AnimatedSprite;
class Fade;
class Game;
@@ -42,7 +42,7 @@ class Title {
Instructions *instructions{nullptr}; // Objeto para la sección de las instrucciones
Game *demoGame{nullptr}; // Objeto para lanzar la demo del juego
SDL_Event *eventHandler; // Manejador de eventos
section_t *section; // Indicador para el bucle del titulo
Section *section; // Indicador para el bucle del titulo
Texture *dustTexture; // Textura con los graficos del polvo
Texture *coffeeTexture; // Textura con los graficos de la palabra coffee
@@ -74,7 +74,7 @@ class Title {
float sin[360]; // Vector con los valores del seno precalculados
bool menuVisible; // Indicador para saber si se muestra el menu del titulo o la frase intermitente
bool demo; // Indica si el modo demo estará activo
section_t nextSection; // Indica cual es la siguiente sección a cargar cuando termine el contador del titulo
Section nextSection; // Indica cual es la siguiente sección a cargar cuando termine el contador del titulo
Uint32 ticksSpeed; // Velocidad a la que se repiten los bucles del programa
Uint8 postFade; // Opción a realizar cuando termina el fundido
menu_t menu; // Variable con todos los objetos menus y sus variables
@@ -82,8 +82,8 @@ class Title {
Options::Video prevVideo;
Options::Window prevWindow;
Options::Settings prevSettings;
std::vector<input_t> prevInputs;
std::vector<input_t> availableInputDevices; // Vector con todos los metodos de control disponibles
std::vector<InputDevice> prevInputs;
std::vector<InputDevice> availableInputDevices; // Vector con todos los metodos de control disponibles
std::vector<int> deviceIndex; // Indice para el jugador [i] del vector de dispositivos de entrada disponibles
// Variables para la vibración del título (SUBSECTION_TITLE_2)
@@ -95,7 +95,7 @@ class Title {
// Variables para sub-estados delegados (instrucciones y demo)
bool instructionsActive; // Indica si las instrucciones están activas
bool demoGameActive; // Indica si el juego demo está activo
mode_e instructionsMode{m_auto}; // Modo de las instrucciones activas
InstructionsMode instructionsMode{m_auto}; // Modo de las instrucciones activas
bool demoThenInstructions; // Indica si tras la demo hay que mostrar instrucciones
// Inicializa los valores
@@ -123,7 +123,7 @@ class Title {
void applyOptions();
// Ejecuta la parte donde se muestran las instrucciones
void runInstructions(mode_e mode);
void runInstructions(InstructionsMode mode);
// Ejecuta el juego en modo demo
void runDemoGame();
@@ -142,7 +142,7 @@ class Title {
public:
// Constructor
Title(SDL_Renderer *renderer, section_t *section);
Title(SDL_Renderer *renderer, Section *section);
// Destructor
~Title();
+10 -10
View File
@@ -7,7 +7,7 @@
#include "core/audio/audio.hpp" // for Audio::get (playSound)
#include "core/audio/jail_audio.hpp" // for JA_LoadSound, JA_DeleteSound (propietat local)
#include "core/input/input.h" // for Input, REPEAT_FALSE, inputs_e
#include "core/input/input.h" // for Input, REPEAT_FALSE, InputAction
#include "core/rendering/text.h" // for Text
#include "core/resources/asset.h" // for Asset
#include "core/resources/resource_helper.h"
@@ -581,7 +581,7 @@ void Menu::render() {
}
// Crea una linea por si hay que dibujarla entre los items
h_line_t line;
HorizontalLine line;
line.x1 = selector.rect.x + (selector.rect.w / 6);
line.x2 = line.x1 + ((selector.rect.w / 6) * 4);
@@ -601,12 +601,12 @@ void Menu::render() {
}
else if (i == selector.index) { // A continuación si tiene el indice
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
const Color color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color);
}
else if (i == selector.previousIndex) { // O si lo ha tenido
const color_t color = {selector.previousItemColor.r, selector.previousItemColor.g, selector.previousItemColor.b};
const Color color = {selector.previousItemColor.r, selector.previousItemColor.g, selector.previousItemColor.b};
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color);
}
@@ -616,7 +616,7 @@ void Menu::render() {
else { // Si no es seleccionable
if ((item[i].linkedUp) && (i == selector.index + 1)) { // Si el elemento está enlazado con el elemento superior se pinta del color del selector
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
const Color color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color);
} else { // Si no está enlazado con el elemento superior se pinta con el color normal
text->write(item[i].rect.x, item[i].rect.y, item[i].label);
@@ -662,19 +662,19 @@ void Menu::setRectSize(int w, int h) {
}
// Establece el color del rectangulo de fondo
void Menu::setBackgroundColor(color_t color, int alpha) {
void Menu::setBackgroundColor(Color color, int alpha) {
rectBG.color = color;
rectBG.a = alpha;
}
// Establece el color del rectangulo del selector
void Menu::setSelectorColor(color_t color, int alpha) {
void Menu::setSelectorColor(Color color, int alpha) {
selector.color = color;
selector.a = alpha;
}
// Establece el color del texto del selector
void Menu::setSelectorTextColor(color_t color) {
void Menu::setSelectorTextColor(Color color) {
selector.itemColor = color;
}
@@ -878,8 +878,8 @@ void Menu::setText(const std::string &font_png, const std::string &font_txt) {
// Calcula los colores del selector para el degradado
void Menu::setSelectorItemColors() {
const color_t colorFrom = {255, 255, 255};
const color_t colorTo = selector.itemColor;
const Color colorFrom = {255, 255, 255};
const Color colorTo = selector.itemColor;
for (int i = 0; i < selector.numJumps; ++i) {
const float step = ((float)i / (selector.numJumps - 1));
+10 -10
View File
@@ -6,7 +6,7 @@
#include <string> // for string, basic_string
#include <vector> // for vector
#include "utils/utils.h" // for color_t
#include "utils/utils.h" // for Color
class Text;
struct JA_Sound_t;
@@ -27,7 +27,7 @@ class Menu {
private:
struct rectangle_t {
SDL_Rect rect; // Rectangulo
color_t color; // Color
Color color; // Color
int a; // Transparencia
};
@@ -57,11 +57,11 @@ class Menu {
int numJumps; // Numero de pasos preestablecido para llegar al destino
int index; // Elemento del menu que tiene el foco
int previousIndex; // Elemento que tenia el foco previamente
color_t previousItemColor; // Color del item nque tenia el foco previamente
Color previousItemColor; // Color del item nque tenia el foco previamente
SDL_Rect rect; // Rectangulo del selector
color_t color; // Color del selector
color_t itemColor; // Color del item
color_t jumpItemColors[8]; // Transición de colores para el item seleccionado
Color color; // Color del selector
Color itemColor; // Color del item
Color jumpItemColors[8]; // Transición de colores para el item seleccionado
int itemColorIndex; // Indice del color de transición para el item seleccionado
int a; // Cantidad de transparencia para el rectangulo del selector
};
@@ -88,7 +88,7 @@ class Menu {
JA_Sound_t *soundAccept; // Sonido al aceptar o elegir una opción del menu
JA_Sound_t *soundCancel; // Sonido al cancelar el menu
JA_Sound_t *soundMove; // Sonido al mover el selector
color_t colorGreyed; // Color para los elementos agrisados
Color colorGreyed; // Color para los elementos agrisados
rectangle_t rectBG; // Rectangulo de fondo del menu
std::vector<item_t> item; // Estructura para cada elemento del menu
selector_t selector; // Variables para pintar el selector del menu
@@ -172,13 +172,13 @@ class Menu {
void render();
// Establece el color del rectangulo de fondo
void setBackgroundColor(color_t color, int alpha);
void setBackgroundColor(Color color, int alpha);
// Establece el color del rectangulo del selector
void setSelectorColor(color_t color, int alpha);
void setSelectorColor(Color color, int alpha);
// Establece el color del texto del selector
void setSelectorTextColor(color_t color);
void setSelectorTextColor(Color color);
// Centra el menu respecto a un punto en el eje X
void centerMenuOnX(int value = 0);