modificacions en el flujo de globalInputs
afegida font aseprite canvis estetics en la info de debug moviment del cursor del ServiceMenu
This commit is contained in:
BIN
data/font/aseprite.png
Normal file
BIN
data/font/aseprite.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 678 B |
194
data/font/aseprite.txt
Normal file
194
data/font/aseprite.txt
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
# box width
|
||||||
|
8
|
||||||
|
# box height
|
||||||
|
8
|
||||||
|
# 32 espacio ( )
|
||||||
|
3
|
||||||
|
# 33 !
|
||||||
|
1
|
||||||
|
# 34 "
|
||||||
|
3
|
||||||
|
# 35 #
|
||||||
|
3
|
||||||
|
# 36 $
|
||||||
|
4
|
||||||
|
# 37 %
|
||||||
|
5
|
||||||
|
# 38 &
|
||||||
|
5
|
||||||
|
# 39 '
|
||||||
|
2
|
||||||
|
# 40 (
|
||||||
|
2
|
||||||
|
# 41 )
|
||||||
|
2
|
||||||
|
# 42 *
|
||||||
|
5
|
||||||
|
# 43 +
|
||||||
|
5
|
||||||
|
# 44 ,
|
||||||
|
3
|
||||||
|
# 45 -
|
||||||
|
3
|
||||||
|
# 46 .
|
||||||
|
1
|
||||||
|
# 47 /
|
||||||
|
4
|
||||||
|
# 48 0
|
||||||
|
4
|
||||||
|
# 49 1
|
||||||
|
2
|
||||||
|
# 50 2
|
||||||
|
4
|
||||||
|
# 51 3
|
||||||
|
4
|
||||||
|
# 52 4
|
||||||
|
4
|
||||||
|
# 53 5
|
||||||
|
4
|
||||||
|
# 54 6
|
||||||
|
4
|
||||||
|
# 55 7
|
||||||
|
4
|
||||||
|
# 56 8
|
||||||
|
4
|
||||||
|
# 57 9
|
||||||
|
4
|
||||||
|
# 58 :
|
||||||
|
1
|
||||||
|
# 59 ;
|
||||||
|
1
|
||||||
|
# 60 <
|
||||||
|
3
|
||||||
|
# 61 =
|
||||||
|
4
|
||||||
|
# 62 >
|
||||||
|
4
|
||||||
|
# 63 ?
|
||||||
|
4
|
||||||
|
# 64 @
|
||||||
|
7
|
||||||
|
# 65 A
|
||||||
|
4
|
||||||
|
# 66 B
|
||||||
|
4
|
||||||
|
# 67 C
|
||||||
|
4
|
||||||
|
# 68 D
|
||||||
|
4
|
||||||
|
# 69 E
|
||||||
|
4
|
||||||
|
# 70 F
|
||||||
|
4
|
||||||
|
# 71 G
|
||||||
|
4
|
||||||
|
# 72 H
|
||||||
|
4
|
||||||
|
# 73 I
|
||||||
|
2
|
||||||
|
# 74 J
|
||||||
|
2
|
||||||
|
# 75 K
|
||||||
|
4
|
||||||
|
# 76 L
|
||||||
|
4
|
||||||
|
# 77 M
|
||||||
|
5
|
||||||
|
# 78 N
|
||||||
|
4
|
||||||
|
# 79 O
|
||||||
|
5
|
||||||
|
# 80 P
|
||||||
|
4
|
||||||
|
# 81 Q
|
||||||
|
5
|
||||||
|
# 82 R
|
||||||
|
4
|
||||||
|
# 83 S
|
||||||
|
4
|
||||||
|
# 84 T
|
||||||
|
5
|
||||||
|
# 85 U
|
||||||
|
4
|
||||||
|
# 86 V
|
||||||
|
5
|
||||||
|
# 87 W
|
||||||
|
7
|
||||||
|
# 88 X
|
||||||
|
5
|
||||||
|
# 89 Y
|
||||||
|
5
|
||||||
|
# 90 Z
|
||||||
|
4
|
||||||
|
# 91 [
|
||||||
|
2
|
||||||
|
# 92 \
|
||||||
|
3
|
||||||
|
# 93 ]
|
||||||
|
2
|
||||||
|
# 94 ^
|
||||||
|
5
|
||||||
|
# 95 _
|
||||||
|
5
|
||||||
|
# 96 `
|
||||||
|
3
|
||||||
|
# 97 a
|
||||||
|
4
|
||||||
|
# 98 b
|
||||||
|
4
|
||||||
|
# 99 c
|
||||||
|
4
|
||||||
|
# 100 d
|
||||||
|
4
|
||||||
|
# 101 e
|
||||||
|
4
|
||||||
|
# 102 f
|
||||||
|
2
|
||||||
|
# 103 g
|
||||||
|
4
|
||||||
|
# 104 h
|
||||||
|
4
|
||||||
|
# 105 i
|
||||||
|
1
|
||||||
|
# 106 j
|
||||||
|
2
|
||||||
|
# 107 k
|
||||||
|
4
|
||||||
|
# 108 l
|
||||||
|
1
|
||||||
|
# 109 m
|
||||||
|
7
|
||||||
|
# 110 n
|
||||||
|
4
|
||||||
|
# 111 o
|
||||||
|
4
|
||||||
|
# 112 p
|
||||||
|
4
|
||||||
|
# 113 q
|
||||||
|
4
|
||||||
|
# 114 r
|
||||||
|
3
|
||||||
|
# 115 s
|
||||||
|
3
|
||||||
|
# 116 t
|
||||||
|
2
|
||||||
|
# 117 u
|
||||||
|
4
|
||||||
|
# 118 v
|
||||||
|
4
|
||||||
|
# 119 w
|
||||||
|
5
|
||||||
|
# 120 x
|
||||||
|
5
|
||||||
|
# 121 y
|
||||||
|
4
|
||||||
|
# 122 z
|
||||||
|
4
|
||||||
|
# 123 {
|
||||||
|
3
|
||||||
|
# 124 |
|
||||||
|
3
|
||||||
|
# 125 }
|
||||||
|
3
|
||||||
|
# 126 ~
|
||||||
|
5
|
||||||
@@ -442,6 +442,8 @@ void Director::setFileList()
|
|||||||
// Fuentes de texto
|
// Fuentes de texto
|
||||||
Asset::get()->add(prefix + "/data/font/8bithud.png", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/font/8bithud.png", AssetType::BITMAP);
|
||||||
Asset::get()->add(prefix + "/data/font/8bithud.txt", AssetType::FONT);
|
Asset::get()->add(prefix + "/data/font/8bithud.txt", AssetType::FONT);
|
||||||
|
Asset::get()->add(prefix + "/data/font/aseprite.png", AssetType::BITMAP);
|
||||||
|
Asset::get()->add(prefix + "/data/font/aseprite.txt", AssetType::FONT);
|
||||||
Asset::get()->add(prefix + "/data/font/smb2.gif", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/font/smb2.gif", AssetType::BITMAP);
|
||||||
Asset::get()->add(prefix + "/data/font/smb2_palette1.pal", AssetType::PALETTE);
|
Asset::get()->add(prefix + "/data/font/smb2_palette1.pal", AssetType::PALETTE);
|
||||||
Asset::get()->add(prefix + "/data/font/smb2.txt", AssetType::FONT);
|
Asset::get()->add(prefix + "/data/font/smb2.txt", AssetType::FONT);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "scoreboard.h" // Para Scoreboard, ScoreboardMode, SCOREB...
|
#include "scoreboard.h" // Para Scoreboard, ScoreboardMode, SCOREB...
|
||||||
#include "screen.h" // Para Screen
|
#include "screen.h" // Para Screen
|
||||||
#include "section.h" // Para Name, name, AttractMode, Options
|
#include "section.h" // Para Name, name, AttractMode, Options
|
||||||
|
#include "service_menu.h" // Para ServiceMenu
|
||||||
#include "smart_sprite.h" // Para SmartSprite
|
#include "smart_sprite.h" // Para SmartSprite
|
||||||
#include "stage.h" // Para number, get, Stage, total_power
|
#include "stage.h" // Para number, get, Stage, total_power
|
||||||
#include "tabe.h" // Para Tabe, TabeState
|
#include "tabe.h" // Para Tabe, TabeState
|
||||||
@@ -1334,10 +1335,18 @@ int Game::getController(int player_id)
|
|||||||
// Gestiona la entrada durante el juego
|
// Gestiona la entrada durante el juego
|
||||||
void Game::checkInput()
|
void Game::checkInput()
|
||||||
{
|
{
|
||||||
// Verifica si se debe pausar el juego.
|
// Comprueba las entradas si no está el menú de servicio activo
|
||||||
checkPauseInput();
|
if (!ServiceMenu::get()->isEnabled())
|
||||||
|
{
|
||||||
|
checkPauseInput();
|
||||||
|
demo_.enabled ? DEMO_handlePassInput() : handlePlayersInput();
|
||||||
|
}
|
||||||
|
|
||||||
demo_.enabled ? handleDemoMode() : handlePlayersInput();
|
// Mueve los jugadores en el modo demo
|
||||||
|
if (demo_.enabled)
|
||||||
|
{
|
||||||
|
DEMO_handleInput();
|
||||||
|
}
|
||||||
|
|
||||||
// Verifica los inputs globales.
|
// Verifica los inputs globales.
|
||||||
globalInputs::check();
|
globalInputs::check();
|
||||||
@@ -1365,8 +1374,19 @@ void Game::checkPauseInput()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gestiona las entradas de los jugadores en el modo demo para saltarse la demo.
|
||||||
|
void Game::DEMO_handlePassInput()
|
||||||
|
{
|
||||||
|
if (input_->checkAnyButtonPressed())
|
||||||
|
{
|
||||||
|
section::name = section::Name::TITLE; // Salir del modo demo y regresar al menú principal.
|
||||||
|
section::attract_mode = section::AttractMode::TITLE_TO_DEMO; // El juego volverá a mostrar la demo
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Gestiona las entradas de los jugadores en el modo demo, incluyendo movimientos y disparos automáticos.
|
// Gestiona las entradas de los jugadores en el modo demo, incluyendo movimientos y disparos automáticos.
|
||||||
void Game::handleDemoMode()
|
void Game::DEMO_handleInput()
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (const auto &player : players_)
|
for (const auto &player : players_)
|
||||||
@@ -1374,21 +1394,14 @@ void Game::handleDemoMode()
|
|||||||
if (player->isPlaying())
|
if (player->isPlaying())
|
||||||
{
|
{
|
||||||
// Maneja el input específico del jugador en modo demo.
|
// Maneja el input específico del jugador en modo demo.
|
||||||
handleDemoPlayerInput(player, index);
|
DEMO_handlePlayerInput(player, index);
|
||||||
}
|
|
||||||
|
|
||||||
if (input_->checkAnyButtonPressed())
|
|
||||||
{
|
|
||||||
section::name = section::Name::TITLE; // Salir del modo demo y regresar al menú principal.
|
|
||||||
section::attract_mode = section::AttractMode::TITLE_TO_DEMO; // El juego volverá a mostrar la demo
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Procesa las entradas para un jugador específico durante el modo demo.
|
// Procesa las entradas para un jugador específico durante el modo demo.
|
||||||
void Game::handleDemoPlayerInput(const std::shared_ptr<Player> &player, int index)
|
void Game::DEMO_handlePlayerInput(const std::shared_ptr<Player> &player, int index)
|
||||||
{
|
{
|
||||||
const auto &demoData = demo_.data[index][demo_.counter];
|
const auto &demoData = demo_.data[index][demo_.counter];
|
||||||
|
|
||||||
|
|||||||
@@ -103,10 +103,10 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// --- Objetos y punteros ---
|
// --- Objetos y punteros ---
|
||||||
SDL_Renderer *renderer_; // El renderizador de la ventana
|
SDL_Renderer *renderer_; // El renderizador de la ventana
|
||||||
Screen *screen_; // Objeto encargado de dibujar en pantalla
|
Screen *screen_; // Objeto encargado de dibujar en pantalla
|
||||||
Input *input_; // Manejador de entrada
|
Input *input_; // Manejador de entrada
|
||||||
Scoreboard *scoreboard_; // Objeto para dibujar el marcador
|
Scoreboard *scoreboard_; // Objeto para dibujar el marcador
|
||||||
|
|
||||||
std::unique_ptr<Background> background_; // Objeto para dibujar el fondo del juego
|
std::unique_ptr<Background> background_; // Objeto para dibujar el fondo del juego
|
||||||
|
|
||||||
@@ -215,8 +215,9 @@ private:
|
|||||||
int getController(int playerId); // Obtiene un controlador a partir del "id" del jugador
|
int getController(int playerId); // Obtiene un controlador a partir del "id" del jugador
|
||||||
void checkInput(); // Gestiona la entrada durante el juego
|
void checkInput(); // Gestiona la entrada durante el juego
|
||||||
void checkPauseInput(); // Verifica si alguno de los controladores ha solicitado una pausa y actualiza el estado de pausa del juego.
|
void checkPauseInput(); // Verifica si alguno de los controladores ha solicitado una pausa y actualiza el estado de pausa del juego.
|
||||||
void handleDemoMode(); // Gestiona las entradas de los jugadores en el modo demo, incluyendo movimientos y disparos automáticos.
|
void DEMO_handleInput(); // Gestiona las entradas de los jugadores en el modo demo, incluyendo movimientos y disparos automáticos.
|
||||||
void handleDemoPlayerInput(const std::shared_ptr<Player> &player, int index); // Procesa las entradas para un jugador específico durante el modo demo.
|
void DEMO_handlePassInput(); // Gestiona las entradas de los jugadores en el modo demo para saltarse la demo.
|
||||||
|
void DEMO_handlePlayerInput(const std::shared_ptr<Player> &player, int index); // Procesa las entradas para un jugador específico durante el modo demo.
|
||||||
void handleFireInput(const std::shared_ptr<Player> &player, BulletType bulletType); // Maneja el disparo de un jugador, incluyendo la creación de balas y la gestión del tiempo de espera entre disparos.
|
void handleFireInput(const std::shared_ptr<Player> &player, BulletType bulletType); // Maneja el disparo de un jugador, incluyendo la creación de balas y la gestión del tiempo de espera entre disparos.
|
||||||
void handlePlayersInput(); // Gestiona las entradas de todos los jugadores en el modo normal (fuera del modo demo).
|
void handlePlayersInput(); // Gestiona las entradas de todos los jugadores en el modo normal (fuera del modo demo).
|
||||||
void handleNormalPlayerInput(const std::shared_ptr<Player> &player); // Maneja las entradas de movimiento y disparo para un jugador en modo normal.
|
void handleNormalPlayerInput(const std::shared_ptr<Player> &player); // Maneja las entradas de movimiento y disparo para un jugador en modo normal.
|
||||||
|
|||||||
@@ -170,8 +170,72 @@ namespace globalInputs
|
|||||||
ServiceMenu::get()->toggle();
|
ServiceMenu::get()->toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
// Comprueba el boton de servicio
|
||||||
void check()
|
void checkServiceButton()
|
||||||
|
{
|
||||||
|
// Teclado
|
||||||
|
if (Input::get()->checkInput(InputAction::SERVICE, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD))
|
||||||
|
{
|
||||||
|
toggleServiceMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mandos
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Input::get()->getNumControllers(); ++i)
|
||||||
|
{
|
||||||
|
if (Input::get()->checkInput(InputAction::SERVICE, INPUT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i))
|
||||||
|
{
|
||||||
|
toggleServiceMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comprueba las entradas del menú de servicio
|
||||||
|
void checkServiceInputs()
|
||||||
|
{
|
||||||
|
// Teclado
|
||||||
|
{
|
||||||
|
// Arriba
|
||||||
|
if (Input::get()->checkInput(InputAction::UP, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD))
|
||||||
|
{
|
||||||
|
ServiceMenu::get()->setSelectorUp();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Abajo
|
||||||
|
if (Input::get()->checkInput(InputAction::DOWN, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD))
|
||||||
|
{
|
||||||
|
ServiceMenu::get()->setSelectorDown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mandos
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Input::get()->getNumControllers(); ++i)
|
||||||
|
{
|
||||||
|
// Arriba
|
||||||
|
if (Input::get()->checkInput(InputAction::UP, INPUT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i))
|
||||||
|
{
|
||||||
|
ServiceMenu::get()->setSelectorUp();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Abajo
|
||||||
|
if (Input::get()->checkInput(InputAction::DOWN, INPUT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i))
|
||||||
|
{
|
||||||
|
ServiceMenu::get()->setSelectorDown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Comprueba las entradas fuera del menú de servicio
|
||||||
|
void checkInputs()
|
||||||
{
|
{
|
||||||
// Teclado
|
// Teclado
|
||||||
{
|
{
|
||||||
@@ -267,13 +331,6 @@ namespace globalInputs
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Service Menu
|
|
||||||
if (Input::get()->checkInput(InputAction::SERVICE, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD))
|
|
||||||
{
|
|
||||||
toggleServiceMenu();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// Debug info
|
// Debug info
|
||||||
if (Input::get()->checkInput(InputAction::SHOW_INFO, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD))
|
if (Input::get()->checkInput(InputAction::SHOW_INFO, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::KEYBOARD))
|
||||||
@@ -283,18 +340,13 @@ namespace globalInputs
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Mandos
|
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
|
||||||
{
|
void check()
|
||||||
for (int i = 0; i < Input::get()->getNumControllers(); ++i)
|
{
|
||||||
{
|
checkServiceButton();
|
||||||
// Salir
|
checkServiceInputs();
|
||||||
if (Input::get()->checkInput(InputAction::SERVICE, INPUT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i))
|
checkInputs();
|
||||||
{
|
|
||||||
toggleServiceMenu();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -334,6 +334,7 @@ void Resource::createText()
|
|||||||
{"04b_25_flat_2x", "04b_25_flat_2x.png", "04b_25_2x.txt"},
|
{"04b_25_flat_2x", "04b_25_flat_2x.png", "04b_25_2x.txt"},
|
||||||
{"04b_25_reversed_2x", "04b_25_reversed_2x.png", "04b_25_2x.txt"},
|
{"04b_25_reversed_2x", "04b_25_reversed_2x.png", "04b_25_2x.txt"},
|
||||||
{"8bithud", "8bithud.png", "8bithud.txt"},
|
{"8bithud", "8bithud.png", "8bithud.txt"},
|
||||||
|
{"aseprite", "aseprite.png", "aseprite.txt"},
|
||||||
{"smb2", "smb2.gif", "smb2.txt"}};
|
{"smb2", "smb2.gif", "smb2.txt"}};
|
||||||
|
|
||||||
for (const auto &resource : resources)
|
for (const auto &resource : resources)
|
||||||
|
|||||||
@@ -220,12 +220,12 @@ void Screen::renderInfo()
|
|||||||
{
|
{
|
||||||
if (debug_info_.show)
|
if (debug_info_.show)
|
||||||
{
|
{
|
||||||
|
// Resolution
|
||||||
|
debug_info_.text->writeDX(TEXT_COLOR | TEXT_SHADOW, param.game.width - debug_info_.text->lenght(options.video.info) - 2, 1, options.video.info, 1, DEBUG_COLOR, 1, DEBUG_COLOR.darken(150));
|
||||||
|
|
||||||
// FPS
|
// FPS
|
||||||
const std::string FPS_TEXT = std::to_string(fps_.lastValue) + " FPS";
|
const std::string FPS_TEXT = std::to_string(fps_.lastValue) + " FPS";
|
||||||
debug_info_.text->writeDX(TEXT_COLOR | TEXT_SHADOW, param.game.width - debug_info_.text->lenght(FPS_TEXT), 0, FPS_TEXT, 1, ORANGE_SOFT_COLOR, 1, ORANGE_SHADOW_COLOR);
|
debug_info_.text->writeDX(TEXT_COLOR | TEXT_SHADOW, param.game.width - debug_info_.text->lenght(FPS_TEXT) - 2, 1 + debug_info_.text->getCharacterSize(), FPS_TEXT, 1, DEBUG_COLOR, 1, DEBUG_COLOR.darken(150));
|
||||||
|
|
||||||
// Resolution
|
|
||||||
debug_info_.text->writeDX(TEXT_COLOR | TEXT_SHADOW, 0, 0, options.video.info, 1, ORANGE_SOFT_COLOR, 1, ORANGE_SHADOW_COLOR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -378,9 +378,9 @@ void Screen::getDisplayInfo()
|
|||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Window resolution: %dx%d x%d",
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Window resolution: %dx%d x%d",
|
||||||
static_cast<int>(param.game.width), static_cast<int>(param.game.height), options.window.zoom);
|
static_cast<int>(param.game.width), static_cast<int>(param.game.height), options.window.zoom);
|
||||||
|
|
||||||
options.video.info = std::to_string(static_cast<int>(DM->w)) + " X " +
|
options.video.info = std::to_string(static_cast<int>(DM->w)) + "x" +
|
||||||
std::to_string(static_cast<int>(DM->h)) + " AT " +
|
std::to_string(static_cast<int>(DM->h)) + " @ " +
|
||||||
std::to_string(static_cast<int>(DM->refresh_rate)) + " HZ";
|
std::to_string(static_cast<int>(DM->refresh_rate)) + " Hz";
|
||||||
|
|
||||||
// Calcula el máximo factor de zoom que se puede aplicar a la pantalla
|
// Calcula el máximo factor de zoom que se puede aplicar a la pantalla
|
||||||
const int MAX_ZOOM = std::min(DM->w / param.game.width, (DM->h - WINDOWS_DECORATIONS_) / param.game.height);
|
const int MAX_ZOOM = std::min(DM->w / param.game.width, (DM->h - WINDOWS_DECORATIONS_) / param.game.height);
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ private:
|
|||||||
{
|
{
|
||||||
if (Resource::get())
|
if (Resource::get())
|
||||||
{
|
{
|
||||||
text = Resource::get()->getText("smb2");
|
text = Resource::get()->getText("aseprite");
|
||||||
if (!text)
|
if (!text)
|
||||||
{
|
{
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to retrieve debug_.text object!");
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to retrieve debug_.text object!");
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ void ServiceMenu::render()
|
|||||||
{
|
{
|
||||||
y += lineHeight_;
|
y += lineHeight_;
|
||||||
elementText_->writeColored(rect_.x + H_PADDING, y, VIDEO_LIST.at(i), i == selected_ ? selectedColor_ : textColor_, -2);
|
elementText_->writeColored(rect_.x + H_PADDING, y, VIDEO_LIST.at(i), i == selected_ ? selectedColor_ : textColor_, -2);
|
||||||
elementText_->writeColored(rect_.x + H_PADDING + 100, y, ": " + std::string(OPTIONS_LIST.at(i)), i == selected_ ? selectedColor_ : textColor_, -2);
|
elementText_->writeColored(rect_.x + H_PADDING + 100, y, "" + std::string(OPTIONS_LIST.at(i)), i == selected_ ? selectedColor_ : textColor_, -2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,21 +139,46 @@ void ServiceMenu::updateCounter()
|
|||||||
Color ServiceMenu::getSelectedColor()
|
Color ServiceMenu::getSelectedColor()
|
||||||
{
|
{
|
||||||
static std::array<Color, 12> colors = {
|
static std::array<Color, 12> colors = {
|
||||||
Color(0xFF, 0xFF, 0x00), // Amarillo brillante
|
Color(0xFF, 0xFB, 0x8A), // Amarillo suave
|
||||||
Color(0xFF, 0xD7, 0x00), // Dorado claro
|
Color(0xFF, 0xE4, 0x5D), // Dorado medio
|
||||||
Color(0xFF, 0xEF, 0x7C), // Amarillo pastel
|
Color(0xFF, 0xD1, 0x3C), // Amarillo pastel intenso
|
||||||
Color(0xFF, 0xCC, 0x00), // Amarillo anaranjado
|
Color(0xFF, 0xBF, 0x23), // Amarillo anaranjado
|
||||||
Color(0xFF, 0xF7, 0x00), // Amarillo limón
|
Color(0xFF, 0xAA, 0x12), // Amarillo cálido
|
||||||
Color(0xCC, 0x99, 0x00), // Mostaza
|
Color(0xE6, 0x9A, 0x08), // Mostaza oscuro
|
||||||
Color(0xFF, 0xF7, 0x00), // Amarillo limón (regreso)
|
Color(0xE6, 0x9A, 0x08), // Mostaza oscuro (regreso, cierre)
|
||||||
Color(0xFF, 0xCC, 0x00), // Amarillo anaranjado (regreso)
|
Color(0xFF, 0xAA, 0x12), // Amarillo cálido (regreso)
|
||||||
Color(0xFF, 0xEF, 0x7C), // Amarillo pastel (regreso)
|
Color(0xFF, 0xBF, 0x23), // Amarillo anaranjado (regreso)
|
||||||
Color(0xFF, 0xD7, 0x00), // Dorado claro (regreso)
|
Color(0xFF, 0xD1, 0x3C), // Amarillo pastel intenso (regreso)
|
||||||
Color(0xFF, 0xFF, 0x00), // Amarillo brillante (regreso)
|
Color(0xFF, 0xE4, 0x5D), // Dorado medio (regreso)
|
||||||
Color(0xCC, 0x99, 0x00) // Mostaza (regreso, cierre)
|
Color(0xFF, 0xFB, 0x8A) // Amarillo suave (regreso)
|
||||||
};
|
};
|
||||||
|
|
||||||
const size_t index = counter_ % colors.size();
|
const size_t index = counter_ % colors.size();
|
||||||
|
|
||||||
return colors.at(index);
|
return colors.at(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServiceMenu::setSelectorUp()
|
||||||
|
{
|
||||||
|
if (selected_ > 0)
|
||||||
|
{
|
||||||
|
--selected_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selected_ = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServiceMenu::setSelectorDown()
|
||||||
|
{
|
||||||
|
selected_ = (selected_ + 1) % 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServiceMenu::acceptSelection()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServiceMenu::cancelSelection()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,13 +21,22 @@ public:
|
|||||||
void render();
|
void render();
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
// --- Métodos de control ---
|
||||||
|
void setSelectorUp();
|
||||||
|
void setSelectorDown();
|
||||||
|
void acceptSelection();
|
||||||
|
void cancelSelection();
|
||||||
|
|
||||||
|
// --- Getters ---
|
||||||
|
bool isEnabled() const { return enabled_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// -- Variables internas ---
|
// -- Variables internas ---
|
||||||
bool enabled_ = false; // Indica si el menú de servicio está activo
|
bool enabled_ = false; // Indica si el menú de servicio está activo
|
||||||
SDL_FRect rect_; // Rectangulo para definir el area del menú de servicio
|
SDL_FRect rect_; // Rectangulo para definir el area del menú de servicio
|
||||||
std::shared_ptr<Text> elementText_; // Objeto para escribir texto;
|
std::shared_ptr<Text> elementText_; // Objeto para escribir texto;
|
||||||
std::shared_ptr<Text> titleText_; // Objeto para escribir texto;
|
std::shared_ptr<Text> titleText_; // Objeto para escribir texto;
|
||||||
size_t selected_ = 2; // Elemento del menú seleccionado
|
size_t selected_ = 2; // Elemento del menú seleccionado
|
||||||
Uint32 counter_ = 0; // Contador interno
|
Uint32 counter_ = 0; // Contador interno
|
||||||
|
|
||||||
// -- Aspecto --
|
// -- Aspecto --
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ const Color SERV_MENU_TITLE_COLOR = Color(0XFF, 0XFF, 0XFF);
|
|||||||
const Color SERV_MENU_TEXT_COLOR = Color(0XFF, 0XFF, 0XFF);
|
const Color SERV_MENU_TEXT_COLOR = Color(0XFF, 0XFF, 0XFF);
|
||||||
const Color SERV_MENU_SELECTED_COLOR = Color(0XFF, 0XFF, 0X00);;
|
const Color SERV_MENU_SELECTED_COLOR = Color(0XFF, 0XFF, 0X00);;
|
||||||
const Color SERV_MENU_BG_COLOR = Color(0x1E, 0x1E, 0x1E);
|
const Color SERV_MENU_BG_COLOR = Color(0x1E, 0x1E, 0x1E);
|
||||||
|
const Color DEBUG_COLOR = Color(0xFF, 0xFF, 0x00);
|
||||||
|
|
||||||
// Obtiene un color del vector de colores imitando al Coche Fantástico
|
// Obtiene un color del vector de colores imitando al Coche Fantástico
|
||||||
Color getColorLikeKnightRider(const std::vector<Color> &colors, int counter_)
|
Color getColorLikeKnightRider(const std::vector<Color> &colors, int counter_)
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ extern const Color SERV_MENU_TITLE_COLOR;
|
|||||||
extern const Color SERV_MENU_TEXT_COLOR;
|
extern const Color SERV_MENU_TEXT_COLOR;
|
||||||
extern const Color SERV_MENU_SELECTED_COLOR;
|
extern const Color SERV_MENU_SELECTED_COLOR;
|
||||||
extern const Color SERV_MENU_BG_COLOR;
|
extern const Color SERV_MENU_BG_COLOR;
|
||||||
|
extern const Color DEBUG_COLOR;
|
||||||
|
|
||||||
// Colores y gráficos
|
// Colores y gráficos
|
||||||
Color getColorLikeKnightRider(const std::vector<Color> &colors, int counter_);
|
Color getColorLikeKnightRider(const std::vector<Color> &colors, int counter_);
|
||||||
|
|||||||
Reference in New Issue
Block a user