Options: afegida opció per invertir el y_axis (la recre te els mandos mal cablejats)
This commit is contained in:
@@ -160,8 +160,8 @@ void Director::loadScoreFile()
|
||||
void Director::bindInputs()
|
||||
{
|
||||
// Teclado - Movimiento del jugador
|
||||
Input::get()->bindKey(InputAction::UP, SDL_SCANCODE_UP);
|
||||
Input::get()->bindKey(InputAction::DOWN, SDL_SCANCODE_DOWN);
|
||||
Input::get()->bindKey(InputAction::UP, Options::settings.is_y_axis_inverted ? SDL_SCANCODE_DOWN : SDL_SCANCODE_UP);
|
||||
Input::get()->bindKey(InputAction::DOWN, Options::settings.is_y_axis_inverted ? SDL_SCANCODE_UP : SDL_SCANCODE_DOWN);
|
||||
Input::get()->bindKey(InputAction::LEFT, SDL_SCANCODE_LEFT);
|
||||
Input::get()->bindKey(InputAction::RIGHT, SDL_SCANCODE_RIGHT);
|
||||
|
||||
@@ -202,8 +202,8 @@ void Director::bindInputs()
|
||||
for (int i = 0; i < NUM_GAMEPADS; ++i)
|
||||
{
|
||||
// Mando - Movimiento del jugador
|
||||
Input::get()->bindGameControllerButton(i, InputAction::UP, SDL_GAMEPAD_BUTTON_DPAD_UP);
|
||||
Input::get()->bindGameControllerButton(i, InputAction::DOWN, SDL_GAMEPAD_BUTTON_DPAD_DOWN);
|
||||
Input::get()->bindGameControllerButton(i, InputAction::UP, Options::settings.is_y_axis_inverted ? SDL_GAMEPAD_BUTTON_DPAD_DOWN : SDL_GAMEPAD_BUTTON_DPAD_UP);
|
||||
Input::get()->bindGameControllerButton(i, InputAction::DOWN, Options::settings.is_y_axis_inverted ? SDL_GAMEPAD_BUTTON_DPAD_UP : SDL_GAMEPAD_BUTTON_DPAD_DOWN);
|
||||
Input::get()->bindGameControllerButton(i, InputAction::LEFT, SDL_GAMEPAD_BUTTON_DPAD_LEFT);
|
||||
Input::get()->bindGameControllerButton(i, InputAction::RIGHT, SDL_GAMEPAD_BUTTON_DPAD_RIGHT);
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace Options
|
||||
settings.language = Lang::Code::VALENCIAN;
|
||||
settings.autofire = true;
|
||||
settings.shutdown_enabled = false;
|
||||
settings.is_y_axis_inverted = false;
|
||||
settings.clearLastHiScoreEntries();
|
||||
settings.config_file = Asset::get()->get("config.txt");
|
||||
|
||||
@@ -172,6 +173,7 @@ namespace Options
|
||||
file << "game.difficulty=" << static_cast<int>(settings.difficulty) << "\n";
|
||||
file << "game.autofire=" << boolToString(settings.autofire) << "\n";
|
||||
file << "game.shutdown_enabled=" << boolToString(settings.shutdown_enabled) << "\n";
|
||||
file << "game.is_y_axis_inverted=" << boolToString(settings.is_y_axis_inverted) << "\n";
|
||||
|
||||
// Opciones de mandos
|
||||
file << "\n\n## CONTROLLERS\n";
|
||||
@@ -276,6 +278,10 @@ namespace Options
|
||||
{
|
||||
settings.shutdown_enabled = stringToBool(value);
|
||||
}
|
||||
else if (var == "game.is_y_axis_inverted")
|
||||
{
|
||||
settings.is_y_axis_inverted = stringToBool(value);
|
||||
}
|
||||
|
||||
// Opciones de mandos
|
||||
else if (var == "controller.0.name")
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace Options
|
||||
Lang::Code language; // Idioma usado en el juego
|
||||
bool autofire; // Indicador de autofire
|
||||
bool shutdown_enabled; // Especifica si se puede apagar el sistema
|
||||
bool is_y_axis_inverted; // Indica si hay que invertir el eje Y de los controles
|
||||
std::vector<HiScoreEntry> hi_score_table; // Tabla de mejores puntuaciones
|
||||
std::vector<int> last_hi_score_entry = {-1, -1}; // Últimas posiciones de entrada en la tabla
|
||||
std::string config_file; // Ruta al fichero donde guardar la configuracion y las opciones del juego
|
||||
@@ -138,6 +139,6 @@ namespace Options
|
||||
int getPlayerWhoUsesKeyboard(); // Averigua quién está usando el teclado
|
||||
void applyPendingChanges(); // Aplica los cambios pendientes copiando los valores a sus variables
|
||||
void checkPendingChanges();
|
||||
DifficultyCode getDifficultyCodeFromName(const std::string& name);
|
||||
DifficultyCode getDifficultyCodeFromName(const std::string &name);
|
||||
std::string getDifficultyNameFromCode(DifficultyCode code);
|
||||
} // namespace Options
|
||||
@@ -30,7 +30,15 @@ void initParam()
|
||||
precalculateZones();
|
||||
|
||||
// SCOREBOARD
|
||||
param.scoreboard = {0, 216, param.game.width, 40};
|
||||
param.scoreboard.rect = {0, 216, param.game.width, 40};
|
||||
param.scoreboard.separator_autocolor = false;
|
||||
param.scoreboard.separator_color = Color();
|
||||
param.scoreboard.easy_color = Color();
|
||||
param.scoreboard.normal_color = Color();
|
||||
param.scoreboard.hard_color = Color();
|
||||
param.scoreboard.text_autocolor = false;
|
||||
param.scoreboard.text_color1 = Color();
|
||||
param.scoreboard.text_color2 = Color();
|
||||
|
||||
// FADE
|
||||
param.fade.num_squares_width = param.game.width / 2;
|
||||
|
||||
Reference in New Issue
Block a user