]> git.localhorst.tv Git - l2e.git/commitdiff
moved key mapping to a seperate file
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 21 Jan 2013 12:56:51 +0000 (06:56 -0600)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 21 Jan 2013 12:56:51 +0000 (06:56 -0600)
src/keys.h [new file with mode: 0644]
src/main.cpp

diff --git a/src/keys.h b/src/keys.h
new file mode 100644 (file)
index 0000000..66836ba
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef L2E_KEYS_H_
+#define L2E_KEYS_H_
+
+#include "app/Input.h"
+
+inline void MapKeys(app::Input &input) {
+       input.MapKey(SDLK_w, app::Input::PAD_UP);
+       input.MapKey(SDLK_d, app::Input::PAD_RIGHT);
+       input.MapKey(SDLK_s, app::Input::PAD_DOWN);
+       input.MapKey(SDLK_a, app::Input::PAD_LEFT);
+       input.MapKey(SDLK_RIGHT, app::Input::ACTION_A);
+       input.MapKey(SDLK_DOWN, app::Input::ACTION_B);
+       input.MapKey(SDLK_UP, app::Input::ACTION_X);
+       input.MapKey(SDLK_LEFT, app::Input::ACTION_Y);
+       input.MapKey(SDLK_RETURN, app::Input::START);
+       input.MapKey(SDLK_SPACE, app::Input::SELECT);
+       input.MapKey(SDLK_RSHIFT, app::Input::SHOULDER_RIGHT);
+       input.MapKey(SDLK_LSHIFT, app::Input::SHOULDER_LEFT);
+
+       input.MapKey(SDLK_1, app::Input::DEBUG_1);
+       input.MapKey(SDLK_2, app::Input::DEBUG_2);
+       input.MapKey(SDLK_3, app::Input::DEBUG_3);
+       input.MapKey(SDLK_4, app::Input::DEBUG_4);
+}
+
+#endif
index 05f3d8ad231057619d140110c6f6b42b0cc95abc..e0b7a47a3d1779eb4d290216b54326a210d38e3b 100644 (file)
@@ -1,3 +1,4 @@
+#include "keys.h"
 #include "app/Application.h"
 #include "app/Arguments.h"
 #include "app/Input.h"
@@ -320,22 +321,7 @@ int main(int argc, char **argv) {
                }
 
                Application app(screen, state);
-               app.Buttons().MapKey(SDLK_w, Input::PAD_UP);
-               app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT);
-               app.Buttons().MapKey(SDLK_s, Input::PAD_DOWN);
-               app.Buttons().MapKey(SDLK_a, Input::PAD_LEFT);
-               app.Buttons().MapKey(SDLK_RIGHT, Input::ACTION_A);
-               app.Buttons().MapKey(SDLK_DOWN, Input::ACTION_B);
-               app.Buttons().MapKey(SDLK_UP, Input::ACTION_X);
-               app.Buttons().MapKey(SDLK_LEFT, Input::ACTION_Y);
-               app.Buttons().MapKey(SDLK_RETURN, Input::START);
-               app.Buttons().MapKey(SDLK_SPACE, Input::SELECT);
-               app.Buttons().MapKey(SDLK_RSHIFT, Input::SHOULDER_RIGHT);
-               app.Buttons().MapKey(SDLK_LSHIFT, Input::SHOULDER_LEFT);
-               app.Buttons().MapKey(SDLK_1, Input::DEBUG_1);
-               app.Buttons().MapKey(SDLK_2, Input::DEBUG_2);
-               app.Buttons().MapKey(SDLK_3, Input::DEBUG_3);
-               app.Buttons().MapKey(SDLK_4, Input::DEBUG_4);
+               MapKeys(app.Buttons());
                app.Run();
 
                return 0;