diff --git a/data/room/34.tmx b/data/room/34.tmx
index 4726b4c..a9045d9 100644
--- a/data/room/34.tmx
+++ b/data/room/34.tmx
@@ -1,24 +1,24 @@
-
-
+
+
diff --git a/source/common/utils.h b/source/common/utils.h
index 3253fb4..57e236f 100644
--- a/source/common/utils.h
+++ b/source/common/utils.h
@@ -64,6 +64,14 @@ enum not_pos_e
pos_right
};
+// Tipos de control de teclado
+enum ctrl_schem_e
+{
+ ctrl_cursor,
+ ctrl_opqa,
+ ctrl_wasd
+};
+
// Estructura para las opciones de las notificaciones
struct op_notification_t
{
@@ -136,6 +144,7 @@ struct options_t
online_t online; // Datos del servicio online
op_notification_t notifications; // Opciones relativas a las notificaciones;
op_screen_t screen; // Opciones relativas a la clase screen
+ ctrl_schem_e keys; // Teclas usadas para jugar
};
// Calcula el cuadrado de la distancia entre dos puntos
diff --git a/source/director.cpp b/source/director.cpp
index 56dde81..850c0b7 100644
--- a/source/director.cpp
+++ b/source/director.cpp
@@ -57,9 +57,6 @@ Director::Director(int argc, char *argv[])
screen->setBorderColor(borderColor);
debug = new Debug(renderer, screen, asset);
music = JA_LoadMusic(asset->get("title.ogg").c_str());
-
- // Inicializa los servicios online
- // initOnline();
}
Director::~Director()
@@ -112,10 +109,13 @@ void Director::initOptions()
// Crea el puntero a la estructura de opciones
options = new options_t;
- // Version
+ // Version del archivo de configuración
options->configVersion = "v1.06.1";
- // Opciones dee video
+ // Opciones de control
+ options->keys = ctrl_cursor;
+
+ // Opciones de video
options->gameWidth = GAMECANVAS_WIDTH;
options->gameHeight = GAMECANVAS_HEIGHT;
options->videoMode = 0;
@@ -312,6 +312,21 @@ bool Director::saveConfig()
file << "## VERSION\n";
file << "configVersion=" + options->configVersion + "\n";
+ file << "\n## CONTROL OPTIONS\n";
+ file << "## keys = CURSOR | OPQA | WASD\n";
+ if (options->keys == ctrl_cursor)
+ {
+ file << "keys=CURSOR\n";
+ }
+ else if (options->keys == ctrl_opqa)
+ {
+ file << "keys=OPQA\n";
+ }
+ else if (options->keys == ctrl_wasd)
+ {
+ file << "keys=WASD\n";
+ }
+
file << "\n## VISUAL OPTIONS\n";
if (options->videoMode == 0)
{
@@ -362,7 +377,7 @@ bool Director::saveConfig()
{
file << "notifications.posV=pos_bottom\n";
}
-
+
file << "## notifications.posH = pos_left | pos_middle | pos_right\n";
if (options->notifications.posH == pos_left)
{
@@ -1009,6 +1024,22 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
options->configVersion = value;
}
+ else if (var == "keys")
+ {
+ if (value == "OPQA")
+ {
+ options->keys = ctrl_opqa;
+ }
+ else if (value == "WASD")
+ {
+ options->keys = ctrl_wasd;
+ }
+ else
+ {
+ options->keys = ctrl_cursor;
+ }
+ }
+
else if (var == "videoMode")
{
if (value == "SDL_WINDOW_FULLSCREEN_DESKTOP")
@@ -1169,10 +1200,26 @@ void Director::initInput()
input->discoverGameController();
// Asigna inputs a teclas
- input->bindKey(INPUT_UP, SDL_SCANCODE_UP);
+ if (options->keys == ctrl_cursor)
+ {
+ input->bindKey(INPUT_UP, SDL_SCANCODE_UP);
+ input->bindKey(INPUT_LEFT, SDL_SCANCODE_LEFT);
+ input->bindKey(INPUT_RIGHT, SDL_SCANCODE_RIGHT);
+ }
+ else if (options->keys == ctrl_opqa)
+ {
+ input->bindKey(INPUT_UP, SDL_SCANCODE_Q);
+ input->bindKey(INPUT_LEFT, SDL_SCANCODE_O);
+ input->bindKey(INPUT_RIGHT, SDL_SCANCODE_P);
+ }
+ else if (options->keys == ctrl_wasd)
+ {
+ input->bindKey(INPUT_UP, SDL_SCANCODE_W);
+ input->bindKey(INPUT_LEFT, SDL_SCANCODE_A);
+ input->bindKey(INPUT_RIGHT, SDL_SCANCODE_D);
+ }
+
input->bindKey(INPUT_DOWN, SDL_SCANCODE_DOWN);
- input->bindKey(INPUT_LEFT, SDL_SCANCODE_LEFT);
- input->bindKey(INPUT_RIGHT, SDL_SCANCODE_RIGHT);
input->bindKey(INPUT_ACCEPT, SDL_SCANCODE_RETURN);
input->bindKey(INPUT_CANCEL, SDL_SCANCODE_ESCAPE);
input->bindKey(INPUT_BUTTON_1, SDL_SCANCODE_SPACE);