Varios arreglos

This commit is contained in:
2024-11-03 20:28:01 +01:00
parent f29eb2f411
commit 371c477d0d
18 changed files with 168 additions and 202 deletions

View File

@@ -36,7 +36,7 @@ void DefineButtons::render()
}
// Comprueba el botón que se ha pulsado
void DefineButtons::doControllerButtonDown(SDL_ControllerButtonEvent &event)
void DefineButtons::doControllerButtonDown(const SDL_ControllerButtonEvent &event)
{
// Solo pilla botones del mando que toca
if (input_->getJoyIndex(event.which) != static_cast<int>(index_controller_))
@@ -124,8 +124,6 @@ void DefineButtons::incIndexButton()
saveBindingsToOptions();
// Deshabilita
//index_controller_ = 0;
//index_button_ = 0;
enabled_ = false;
}
}

View File

@@ -1,13 +1,14 @@
#pragma once
#include <SDL2/SDL_events.h> // para SDL_ControllerButtonEvent
#include <SDL2/SDL_gamecontroller.h> // para SDL_GameControllerButton
#include <memory> // para shared_ptr, unique_ptr
#include <string> // para string
#include <vector> // para vector
class Input;
class Text;
enum class InputType : int;
#include <SDL2/SDL_events.h> // Para SDL_ControllerButtonEvent
#include <SDL2/SDL_gamecontroller.h> // Para SDL_GameControllerButton
#include <stddef.h> // Para size_t
#include <memory> // Para shared_ptr, unique_ptr
#include <string> // Para string
#include <vector> // Para vector
class Input; // lines 8-8
class Text; // lines 9-9
enum class InputType : int; // lines 10-10
struct DefineButtonsButton
{
@@ -41,7 +42,7 @@ private:
void incIndexButton();
// Comprueba el botón que se ha pulsado
void doControllerButtonDown(SDL_ControllerButtonEvent &event);
void doControllerButtonDown(const SDL_ControllerButtonEvent &event);
// Asigna los botones definidos al input
void bindButtons();

View File

@@ -7,17 +7,17 @@
#include <SDL2/SDL_hints.h> // Para SDL_SetHint, SDL_HINT_RENDER_DR...
#include <SDL2/SDL_scancode.h> // Para SDL_SCANCODE_0, SDL_SCANCODE_DOWN
#include <SDL2/SDL_stdinc.h> // Para SDL_bool, Uint32
#include <SDL2/SDL_timer.h> // Para SDL_GetTicks
#include <bits/chrono.h> // Para duration, system_clock
#include <errno.h> // Para errno, EEXIST, EACCES, ENAMETOO...
#include <stdio.h> // Para printf, perror
#include <string.h> // Para strcmp
#include <sys/stat.h> // Para mkdir, stat, S_IRWXU
#include <unistd.h> // Para getuid
#include <cstdlib> // Para exit, EXIT_FAILURE, rand, srand
#include <iostream> // Para basic_ostream, operator<<, cout
#include <algorithm> // Para min
#include <cstdlib> // Para exit, EXIT_FAILURE, size_t, rand
#include <iostream> // Para basic_ostream, operator<<, basi...
#include <memory> // Para make_unique, unique_ptr, make_s...
#include <stdexcept> // Para runtime_error
#include <string> // Para operator+, allocator, char_traits
#include <string> // Para operator+, char_traits, allocator
#include <vector> // Para vector
#include "asset.h" // Para Asset, AssetType
#include "dbgtxt.h" // Para dbg_init
@@ -27,13 +27,13 @@
#include "input.h" // Para Input, InputType
#include "instructions.h" // Para Instructions
#include "intro.h" // Para Intro
#include "jail_audio.h" // Para JA_EnableMusic, JA_EnableSound
#include "jail_audio.h" // Para JA_SetMusicVolume, JA_SetSoundV...
#include "lang.h" // Para Code, loadFromFile
#include "logo.h" // Para Logo
#include "manage_hiscore_table.h" // Para ManageHiScoreTable
#include "notifier.h" // Para Notifier
#include "on_screen_help.h" // Para OnScreenHelp
#include "options.h" // Para Options, options, OptionsContro...
#include "options.h" // Para Options, OptionsController, opt...
#include "param.h" // Para Param, ParamGame, param, loadPa...
#include "resource.h" // Para Resource
#include "screen.h" // Para Screen
@@ -41,7 +41,6 @@
#include "text.h" // Para Text
#include "title.h" // Para Title
#include "utils.h" // Para Overrides, overrides
#include <chrono>
#ifndef _WIN32
#include <pwd.h> // para getpwuid, passwd
@@ -511,8 +510,6 @@ void Director::setFileList()
// Comprueba los parametros del programa
void Director::checkProgramArguments(int argc, const char *argv[])
{
const std::vector<std::string> argument_list = {"--320x240", "--clear_score"};
// Establece la ruta del programa
executable_path_ = argv[0];

View File

@@ -1,39 +1,39 @@
#include "game.h"
#include "asset.h" // for Asset
#include "background.h" // for Background
#include "balloon.h" // for Balloon, BALLOON_SCORE, BALLOON_VE...
#include "balloon_formations.h" // for BalloonFormations, BalloonFormatio...
#include "bullet.h" // for Bullet, BulletType, BulletMoveStatus
#include "explosions.h" // for Explosions
#include "fade.h" // for Fade, FadeType
#include "global_inputs.h" // for check
#include "input.h" // for InputType, Input, INPUT_DO_NOT_ALL...
#include "item.h" // for Item, ItemType
#include "jail_audio.h" // for JA_PlaySound, JA_GetMusicState
#include "lang.h" // for getText
#include "manage_hiscore_table.h" // for ManageHiScoreTable, HiScoreEntry
#include "notifier.h" // for Notifier
#include "param.h" // for Param, param, ParamGame, ParamFade
#include "path_sprite.h" // for Path, PathSprite, createPath, Path...
#include "player.h" // for Player, PlayerStatus
#include "resource.h" // for Resource
#include "scoreboard.h" // for Scoreboard, ScoreboardMode, SCOREB...
#include "screen.h" // for Screen
#include "section.h" // for Name, name, Options, options
#include "smart_sprite.h" // for SmartSprite
#include "text.h" // for Text
#include "texture.h" // for Texture
#include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
#include <SDL2/SDL_events.h> // for SDL_PollEvent, SDL_Event, SDL_KEYDOWN
#include <SDL2/SDL_keycode.h> // for SDLK_1, SDLK_2, SDLK_3, SDLK_4
#include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <SDL2/SDL_video.h> // for SDL_WINDOWEVENT_FOCUS_GAINED, SDL_...
#include <algorithm> // for find_if, clamp, min, remove_if
#include <functional> // for function
#include <iterator> // for distance, size
#include <numeric> // for accumulate
#include <stdlib.h> // for rand, size_t
#include "asset.h" // Para Asset
#include "background.h" // Para Background
#include "balloon.h" // Para Balloon, BALLOON_SCORE, BALLOON_VE...
#include "balloon_formations.h" // Para BalloonFormations, BalloonFormatio...
#include "bullet.h" // Para Bullet, BulletType, BulletMoveStatus
#include "explosions.h" // Para Explosions
#include "fade.h" // Para Fade, FadeType
#include "global_inputs.h" // Para check
#include "input.h" // Para InputType, Input, INPUT_DO_NOT_ALL...
#include "item.h" // Para Item, ItemType
#include "jail_audio.h" // Para JA_PlaySound, JA_GetMusicState
#include "lang.h" // Para getText
#include "manage_hiscore_table.h" // Para ManageHiScoreTable, HiScoreEntry
#include "notifier.h" // Para Notifier
#include "param.h" // Para Param, param, ParamGame, ParamFade
#include "path_sprite.h" // Para Path, PathSprite, createPath, Path...
#include "player.h" // Para Player, PlayerStatus
#include "resource.h" // Para Resource
#include "scoreboard.h" // Para Scoreboard, ScoreboardMode, SCOREB...
#include "screen.h" // Para Screen
#include "section.h" // Para Name, name, Options, options
#include "smart_sprite.h" // Para SmartSprite
#include "text.h" // Para Text
#include "texture.h" // Para Texture
#include <SDL2/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
#include <SDL2/SDL_events.h> // Para SDL_PollEvent, SDL_Event, SDL_KEYDOWN
#include <SDL2/SDL_keycode.h> // Para SDLK_1, SDLK_2, SDLK_3, SDLK_4
#include <SDL2/SDL_pixels.h> // Para SDL_PIXELFORMAT_RGBA8888
#include <SDL2/SDL_timer.h> // Para SDL_GetTicks
#include <SDL2/SDL_video.h> // Para SDL_WINDOWEVENT_FOCUS_GAINED, SDL_...
#include <algorithm> // Para find_if, clamp, min, remove_if
#include <functional> // Para function
#include <iterator> // Para distance, size
#include <numeric> // Para accumulate
#include <stdlib.h> // Para rand, size_t
struct JA_Sound_t; // lines 36-36

View File

@@ -1,15 +1,15 @@
#pragma once
#include <SDL2/SDL_render.h> // for SDL_Renderer, SDL_Texture
#include <SDL2/SDL_stdinc.h> // for Uint32, Uint8
#include <memory> // for shared_ptr, unique_ptr
#include <string> // for string
#include <vector> // for vector
#include "balloon.h" // for Balloon
#include "manage_hiscore_table.h" // for HiScoreEntry
#include "options.h" // for Options, OptionsGame, options
#include "player.h" // for Player
#include "utils.h" // for Demo
#include <SDL2/SDL_render.h> // Para SDL_Renderer, SDL_Texture
#include <SDL2/SDL_stdinc.h> // Para Uint32, Uint8
#include <memory> // Para shared_ptr, unique_ptr
#include <string> // Para string
#include <vector> // Para vector
#include "balloon.h" // Para Balloon
#include "manage_hiscore_table.h" // Para HiScoreEntry
#include "options.h" // Para Options, OptionsGame, options
#include "player.h" // Para Player
#include "utils.h" // Para Demo
class Asset; // lines 14-14
class Background; // lines 15-15
class BalloonFormations; // lines 16-16

View File

@@ -1,11 +1,13 @@
#include "input.h"
#include <SDL2/SDL.h> // para SDL_INIT_GAMECONTROLLER, SDL_InitSubS...
#include <SDL2/SDL_error.h> // para SDL_GetError
#include <SDL2/SDL_events.h> // para SDL_ENABLE
#include <SDL2/SDL_keyboard.h> // para SDL_GetKeyboardState
#include <iostream> // para basic_ostream, operator<<, cout, basi...
#include <unordered_map>
#include <algorithm>
#include <SDL2/SDL.h> // Para SDL_INIT_GAMECONTROLLER, SDL_InitSubS...
#include <SDL2/SDL_error.h> // Para SDL_GetError
#include <SDL2/SDL_events.h> // Para SDL_ENABLE
#include <SDL2/SDL_keyboard.h> // Para SDL_GetKeyboardState
#include <algorithm> // Para find
#include <iostream> // Para basic_ostream, operator<<, cout, endl
#include <iterator> // Para distance
#include <unordered_map> // Para unordered_map, operator==, _Node_cons...
#include <utility> // Para pair
// [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado
Input *Input::input_ = nullptr;
@@ -80,14 +82,7 @@ bool Input::checkInput(InputType input, bool repeat, InputDeviceToUse device, in
if (repeat)
{
if (keyStates[key_bindings_[input_index].scancode] != 0)
{
success_keyboard = true;
}
else
{
success_keyboard = false;
}
success_keyboard = keyStates[key_bindings_[input_index].scancode] != 0;
}
else
{
@@ -108,15 +103,11 @@ bool Input::checkInput(InputType input, bool repeat, InputDeviceToUse device, in
if (keyStates[key_bindings_[input_index].scancode] == 0)
{
key_bindings_[input_index].active = false;
success_keyboard = false;
}
else
{
success_keyboard = false;
}
}
}
}
if (gameControllerFound() && controller_index >= 0 && controller_index < num_gamepads_)
if ((device == InputDeviceToUse::CONTROLLER) || (device == InputDeviceToUse::ANY))
@@ -126,8 +117,15 @@ bool Input::checkInput(InputType input, bool repeat, InputDeviceToUse device, in
{
if (repeat)
{
if (SDL_GameControllerGetButton(connected_controllers_[controller_index], controller_bindings_[controller_index][input_index].button) != 0)
success_controller = SDL_GameControllerGetButton(connected_controllers_.at(controller_index), controller_bindings_.at(controller_index).at(input_index).button) != 0;
}
else
{
if (!controller_bindings_.at(controller_index).at(input_index).active)
{
if (SDL_GameControllerGetButton(connected_controllers_.at(controller_index), controller_bindings_.at(controller_index).at(input_index).button) != 0)
{
controller_bindings_.at(controller_index).at(input_index).active = true;
success_controller = true;
}
else
@@ -137,31 +135,13 @@ bool Input::checkInput(InputType input, bool repeat, InputDeviceToUse device, in
}
else
{
if (!controller_bindings_[controller_index][input_index].active)
if (SDL_GameControllerGetButton(connected_controllers_.at(controller_index), controller_bindings_.at(controller_index).at(input_index).button) == 0)
{
if (SDL_GameControllerGetButton(connected_controllers_[controller_index], controller_bindings_[controller_index][input_index].button) != 0)
{
controller_bindings_[controller_index][input_index].active = true;
success_controller = true;
controller_bindings_.at(controller_index).at(input_index).active = false;
}
else
{
success_controller = false;
}
}
else
{
if (SDL_GameControllerGetButton(connected_controllers_[controller_index], controller_bindings_[controller_index][input_index].button) == 0)
{
controller_bindings_[controller_index][input_index].active = false;
success_controller = false;
}
else
{
success_controller = false;
}
}
}
}
}
@@ -171,11 +151,6 @@ bool Input::checkInput(InputType input, bool repeat, InputDeviceToUse device, in
// Comprueba si hay almenos un input activo
bool Input::checkAnyInput(InputDeviceToUse device, int controller_index)
{
if (device == InputDeviceToUse::ANY)
{
controller_index = 0;
}
if (device == InputDeviceToUse::KEYBOARD || device == InputDeviceToUse::ANY)
{
const Uint8 *mKeystates = SDL_GetKeyboardState(nullptr);
@@ -412,9 +387,3 @@ bool Input::checkAxisInput(InputType input, int controller_index) const
return false;
}
}
// Establece el indice de mando que usará el teclado
void Input::setKeyboardIndex(int index)
{
keyboard_index_ = index;
}

View File

@@ -95,7 +95,6 @@ private:
int num_joysticks_ = 0; // Número de joysticks conectados
int num_gamepads_ = 0; // Número de mandos conectados
std::string game_controller_db_path_; // Ruta al archivo gamecontrollerdb.txt
int keyboard_index_ = 0;
// Comprueba el eje del mando
bool checkAxisInput(InputType input, int controller_index = 0) const;
@@ -161,7 +160,4 @@ public:
// Obtiene el indice a partir del nombre del mando
int getIndexByName(const std::string &name) const;
// Establece el indice de mando que usará el teclado
void setKeyboardIndex(int index);
};

View File

@@ -12,6 +12,7 @@
#include "section.h" // Para Name, name, Options, options
#include "sprite.h" // Para Sprite
#include "texture.h" // Para Texture
#include "utils.h" // Para Color, Zone
// Constructor
Logo::Logo()

View File

@@ -1,12 +1,12 @@
#pragma once
#include <SDL2/SDL_rect.h> // para SDL_Point
#include <SDL2/SDL_stdinc.h> // para Uint32
#include <memory> // para unique_ptr, shared_ptr
#include <vector> // para vector
#include "sprite.h" // para Sprite
#include "utils.h" // para Color
class Texture;
#include <SDL2/SDL_rect.h> // Para SDL_Point
#include <SDL2/SDL_stdinc.h> // Para Uint32
#include <memory> // Para shared_ptr, unique_ptr
#include <vector> // Para vector
class Sprite;
class Texture; // lines 9-9
struct Color;
/*
Esta clase gestiona un estado del programa. Se encarga de dibujar por pantalla el

View File

@@ -1,13 +1,14 @@
#include "options.h"
#include <SDL2/SDL_gamecontroller.h> // para SDL_GameControllerButton, SDL_C...
#include <algorithm> // para max, min
#include <fstream> // para basic_ostream, operator<<, basi...
#include <iostream> // para cout
#include <vector> // para vector
#include "input.h" // para inputs_e, InputDeviceToUse::ANY, INPUT_...
#include "lang.h" // para lang_e
#include "screen.h" // para ScreenVideoMode, ScreenFilter
#include "utils.h" // para OptionsController, Options, op_...
#include <SDL2/SDL_gamecontroller.h> // Para SDL_GameControllerButton
#include <algorithm> // Para clamp
#include <fstream> // Para basic_ostream, operator<<, basi...
#include <iostream> // Para cout
#include <utility> // Para swap
#include <vector> // Para vector
#include "input.h" // Para InputDeviceToUse
#include "lang.h" // Para Code
#include "screen.h" // Para ScreenVideoMode, ScreenFilter
#include "utils.h" // Para boolToString, stringToBool, get...
// Variables
Options options;
@@ -382,7 +383,7 @@ void swapOptionsControllers()
// Averigua quien está usando el teclado
int getPlayerWhoUsesKeyboard()
{
for (auto &controller : options.controllers)
for (const auto &controller : options.controllers)
{
if (controller.type == InputDeviceToUse::ANY)
{

View File

@@ -1,18 +1,16 @@
#pragma once
#include <SDL2/SDL_gamecontroller.h> // Para SDL_GameControllerButton
#include <SDL2/SDL_stdinc.h> // Para Uint8
#include "manage_hiscore_table.h"
#include <SDL2/SDL_gamecontroller.h> // Para SDL_CONTROLLER_BUTTON_B, SDL_CO...
#include <string> // Para string
#include <vector> // Para vector
#include "input.h"
#include <string>
enum class InputType : int;
enum class ScreenFilter : int;
enum class ScreenVideoMode : int;
#include "input.h" // Para InputType, InputDeviceToUse
#include "manage_hiscore_table.h" // Para HiScoreEntry
enum class ScreenFilter : int; // lines 10-10
enum class ScreenVideoMode : int; // lines 11-11
namespace lang
{
enum class Code : int;
}
} // lines 14-14
// Dificultad del juego
enum class GameDifficulty
@@ -84,11 +82,9 @@ struct OptionsController
// Constructor por defecto
OptionsController()
: index(-1), player_id(-1), type(InputDeviceToUse::CONTROLLER), name(""), plugged(false)
{
inputs = {InputType::FIRE_LEFT, InputType::FIRE_CENTER, InputType::FIRE_RIGHT, InputType::START, InputType::SERVICE};
buttons = {SDL_CONTROLLER_BUTTON_X, SDL_CONTROLLER_BUTTON_Y, SDL_CONTROLLER_BUTTON_B, SDL_CONTROLLER_BUTTON_START, SDL_CONTROLLER_BUTTON_BACK};
}
: index(-1), player_id(-1), type(InputDeviceToUse::CONTROLLER), name(""), plugged(false),
inputs{InputType::FIRE_LEFT, InputType::FIRE_CENTER, InputType::FIRE_RIGHT, InputType::START, InputType::SERVICE},
buttons{SDL_CONTROLLER_BUTTON_X, SDL_CONTROLLER_BUTTON_Y, SDL_CONTROLLER_BUTTON_B, SDL_CONTROLLER_BUTTON_START, SDL_CONTROLLER_BUTTON_BACK} {}
};
// Estructura con todas las opciones de configuración del programa

View File

@@ -1,8 +1,8 @@
#include "path_sprite.h"
#include <cmath> // for abs
#include <stdlib.h> // for abs
#include <functional> // for function
#include <utility> // for move
#include <cmath> // Para abs
#include <stdlib.h> // Para abs
#include <functional> // Para function
#include <utility> // Para move
// Devuelve un vector con los puntos que conforman la ruta
std::vector<SDL_Point> createPath(int start, int end, PathType type, int fixed_pos, int steps, const std::function<double(double)> &easingFunction)

View File

@@ -1,10 +1,10 @@
#pragma once
#include <SDL2/SDL_rect.h> // for SDL_Point
#include <functional> // for function
#include <memory> // for shared_ptr
#include <vector> // for vector
#include "sprite.h" // for Sprite
#include <SDL2/SDL_rect.h> // Para SDL_Point
#include <functional> // Para function
#include <memory> // Para shared_ptr
#include <vector> // Para vector
#include "sprite.h" // Para Sprite
class Texture; // lines 8-8
enum class PathType

View File

@@ -1,16 +1,17 @@
#pragma once
#include <SDL2/SDL_rect.h> // para SDL_Point, SDL_Rect
#include <SDL2/SDL_render.h> // para SDL_Renderer, SDL_Texture
#include <SDL2/SDL_stdinc.h> // para Uint32
#include <SDL2/SDL_timer.h> // para SDL_GetTicks
#include <memory> // para unique_ptr, shared_ptr
#include <string> // para string
#include <vector> // para vector
#include "utils.h" // para Color
class Sprite;
class Text;
class Texture;
#include <SDL2/SDL_rect.h> // Para SDL_Point, SDL_Rect
#include <SDL2/SDL_render.h> // Para SDL_Texture, SDL_Renderer
#include <SDL2/SDL_stdinc.h> // Para Uint32
#include <SDL2/SDL_timer.h> // Para SDL_GetTicks
#include <stddef.h> // Para size_t
#include <memory> // Para unique_ptr, shared_ptr
#include <string> // Para string
#include <vector> // Para vector
#include "utils.h" // Para Color
class Sprite; // lines 11-11
class Text; // lines 12-12
class Texture; // lines 13-13
// Defines
constexpr int SCOREBOARD_LEFT_PANEL = 0;

View File

@@ -6,12 +6,12 @@
#include <algorithm> // Para clamp, max, min
#include <fstream> // Para basic_ifstream, ifstream
#include <iterator> // Para istreambuf_iterator, operator==
#include <string> // Para allocator, operator+, to_string, char_t...
#include <string> // Para allocator, operator+, char_traits, to_s...
#include <vector> // Para vector
#include "asset.h" // Para Asset
#include "dbgtxt.h" // Para dbg_print
#include "global_inputs.h" // Para service_pressed_counter
#include "input.h" // Para Input, InputType, INPUT_DO_NOT_ALLOW_RE...
#include "jail_shader.h" // Para init, render
#include "notifier.h" // Para Notifier
#include "on_screen_help.h" // Para OnScreenHelp
#include "options.h" // Para Options, OptionsVideo, options, Options...

View File

@@ -1,16 +1,16 @@
#include "text.h"
#include <SDL2/SDL_blendmode.h> // for SDL_BLENDMODE_BLEND
#include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include <SDL2/SDL_rect.h> // for SDL_Rect
#include <SDL2/SDL_render.h> // for SDL_TEXTUREACCESS_TARGET
#include <stddef.h> // for size_t
#include <fstream> // for basic_ifstream, basic_istream, basic...
#include <iostream> // for cerr
#include <stdexcept> // for runtime_error
#include "screen.h" // for Screen
#include "sprite.h" // for Sprite
#include "texture.h" // for Texture
#include "utils.h" // for Color, getFileName, printWithDots
#include <SDL2/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
#include <SDL2/SDL_pixels.h> // Para SDL_PIXELFORMAT_RGBA8888
#include <SDL2/SDL_rect.h> // Para SDL_Rect
#include <SDL2/SDL_render.h> // Para SDL_TEXTUREACCESS_TARGET
#include <stddef.h> // Para size_t
#include <fstream> // Para basic_ifstream, basic_istream, basic...
#include <iostream> // Para cerr
#include <stdexcept> // Para runtime_error
#include "screen.h" // Para Screen
#include "sprite.h" // Para Sprite
#include "texture.h" // Para Texture
#include "utils.h" // Para Color, getFileName, printWithDots
// Llena una estructuta TextFile desde un fichero
std::shared_ptr<TextFile> loadTextFile(const std::string &file_path)

View File

@@ -1,9 +1,10 @@
#include "title.h"
#include <SDL2/SDL_events.h> // Para SDL_PollEvent, SDL_Event, SDL_KEYDOWN
#include <SDL2/SDL_keycode.h> // Para SDLK_1, SDLK_2, SDLK_3
#include <SDL2/SDL_keycode.h> // Para SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5
#include <SDL2/SDL_rect.h> // Para SDL_Rect
#include <SDL2/SDL_timer.h> // Para SDL_GetTicks
#include <string> // Para char_traits, operator+, to_string, bas...
#include <stddef.h> // Para size_t
#include <string> // Para char_traits, operator+, basic_string
#include <utility> // Para move
#include <vector> // Para vector
#include "define_buttons.h" // Para DefineButtons
@@ -18,7 +19,7 @@
#include "param.h" // Para Param, param, ParamGame, ParamTitle
#include "resource.h" // Para Resource
#include "screen.h" // Para Screen
#include "section.h" // Para Options, options, name, Name
#include "section.h" // Para Options, options, Name, name, AttractMode
#include "sprite.h" // Para Sprite
#include "text.h" // Para Text, TEXT_CENTER, TEXT_SHADOW
#include "texture.h" // Para Texture
@@ -216,15 +217,15 @@ void Title::checkEvents()
resetCounter();
break;
}
case SDLK_4: // Muestra la asignacion de mandos
case SDLK_4: // Intercambia la asignación del teclado
{
showControllers();
swapKeyboard();
resetCounter();
break;
}
case SDLK_5: // Intercambia la asignación del teclado
case SDLK_5: // Muestra la asignacion de mandos y teclado
{
swapKeyboard();
showControllers();
resetCounter();
break;
}
@@ -343,5 +344,7 @@ void Title::showControllers()
}
}
// std::string spaces(lang::getText(100).length() + 3, ' ');
// std::string kb_text = spaces + lang::getText(69);
Notifier::get()->showText({text.at(0), text.at(1)});
}

View File

@@ -2,14 +2,17 @@
#include <SDL2/SDL_stdinc.h> // Para Uint32
#include <memory> // Para unique_ptr, shared_ptr
#include "section.h" // Para Name
class DefineButtons;
class Fade;
class GameLogo;
class Sprite;
class Text;
class Texture; // lines 14-14
class TiledBG;
class DefineButtons; // lines 6-6
class Fade; // lines 7-7
class GameLogo; // lines 8-8
class Sprite; // lines 9-9
class Text; // lines 10-10
class Texture; // lines 11-11
class TiledBG; // lines 12-12
namespace section
{
enum class Name;
}
// Textos
constexpr const char TEXT_COPYRIGHT[] = "@2020,2024 JailDesigner";