granera con sarna no pica

This commit is contained in:
2026-04-08 11:07:50 +02:00
parent d70edb29e7
commit 87cc58b5dd
29 changed files with 104 additions and 244 deletions

View File

@@ -16,6 +16,7 @@
#include "core/resources/resource_list.hpp" // Para Asset
#include "core/system/event_buffer.hpp" // Para EventBuffer
#include "core/system/global_events.hpp" // Para check
#include "game/defaults.hpp" // Para Defaults::Music::Files
#include "game/options.hpp" // Para Options, options, SectionState, Section
#include "game/scene_manager.hpp" // Para SceneManager
#include "game/ui/console.hpp" // Para Console
@@ -41,8 +42,8 @@ Title::Title()
SceneManager::options = SceneManager::Options::NONE;
// Acciones iniciales
Screen::get()->setBorderColor(0); // Cambia el color del borde
Audio::get()->playMusic("574071_EA_DTV.ogg"); // Inicia la musica
Screen::get()->setBorderColor(0); // Cambia el color del borde
Audio::get()->playMusic(Defaults::Music::Files::TITLE_TRACK); // Inicia la musica
}
// Destructor
@@ -260,10 +261,6 @@ void Title::renderMainMenu() {
return;
}
// Zona central del menu
constexpr int MENU_ZONE_Y = 73;
constexpr int MENU_ZONE_HEIGHT = 102;
// Menú principal normal con 3 opciones centradas verticalmente en la zona
const Uint8 COLOR = 8;
const int TEXT_SIZE = menu_text_->getCharacterSize();
@@ -394,9 +391,6 @@ void Title::applyKeyboardRemap() { // NOLINT(readability-convert-member-functio
// Dibuja la pantalla de redefinir teclado
void Title::renderKeyboardRemap() const {
// Zona central del menu
constexpr int MENU_ZONE_Y = 73;
constexpr int MENU_ZONE_HEIGHT = 102;
const Uint8 COLOR = 8;
const Uint8 ERROR_COLOR = 4;
const int TEXT_SIZE = menu_text_->getCharacterSize();
@@ -441,10 +435,6 @@ void Title::renderKeyboardRemap() const {
// Dibuja la pantalla de redefinir joystick
void Title::renderJoystickRemap() const {
// Zona central del menu
constexpr int MENU_ZONE_Y = 73;
constexpr int MENU_ZONE_HEIGHT = 102;
const Uint8 COLOR = 8;
const Uint8 ERROR_COLOR = 4;
const int TEXT_SIZE = menu_text_->getCharacterSize();
@@ -502,23 +492,20 @@ void Title::handleJoystickRemap(const SDL_Event& event) {
return;
}
constexpr Sint16 TRIGGER_THRESHOLD = 20000;
constexpr Sint16 AXIS_THRESHOLD = 20000;
// Capturar triggers como botones (usando valores especiales 100/101)
if (event.gaxis.axis == SDL_GAMEPAD_AXIS_LEFT_TRIGGER && event.gaxis.value > TRIGGER_THRESHOLD) {
if (event.gaxis.axis == SDL_GAMEPAD_AXIS_LEFT_TRIGGER && event.gaxis.value > Defaults::Controls::JOYSTICK_AXIS_THRESHOLD) {
captured_button = Input::TRIGGER_L2_AS_BUTTON; // 100
axis_cooldown_ = 0.5F; // Cooldown de medio segundo
} else if (event.gaxis.axis == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER && event.gaxis.value > TRIGGER_THRESHOLD) {
} else if (event.gaxis.axis == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER && event.gaxis.value > Defaults::Controls::JOYSTICK_AXIS_THRESHOLD) {
captured_button = Input::TRIGGER_R2_AS_BUTTON; // 101
axis_cooldown_ = 0.5F;
}
// Capturar ejes del stick analógico (usando valores especiales 200+)
else if (event.gaxis.axis == SDL_GAMEPAD_AXIS_LEFTX) {
if (event.gaxis.value < -AXIS_THRESHOLD) {
if (event.gaxis.value < -Defaults::Controls::JOYSTICK_AXIS_THRESHOLD) {
captured_button = 200; // Left stick izquierda
axis_cooldown_ = 0.5F;
} else if (event.gaxis.value > AXIS_THRESHOLD) {
} else if (event.gaxis.value > Defaults::Controls::JOYSTICK_AXIS_THRESHOLD) {
captured_button = 201; // Left stick derecha
axis_cooldown_ = 0.5F;
}