From e7ea9dc19c7a19be9fc065891e4aeac4d74c19a7 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sun, 17 Feb 2013 23:22:35 -0500 Subject: [PATCH] call game.handle_move_event() on movement inputs --- src/game.d | 4 ++-- src/main.d | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/game.d b/src/game.d index eca70be..cbe62e2 100644 --- a/src/game.d +++ b/src/game.d @@ -16,7 +16,7 @@ struct Player struct MoveEvent { - ubyte type; + int type; bool stop; uint tick; }; @@ -28,7 +28,7 @@ public: { m_pindex = (m_pindex + 1) % 2; } - void handle_move_event(ref MoveEvent me) + void handle_move_event(int type, bool stop) { } Player[] get_players() { return m_players; } diff --git a/src/main.d b/src/main.d index afd8f25..1fa79fa 100644 --- a/src/main.d +++ b/src/main.d @@ -94,12 +94,16 @@ int main(char[][] args) exit = true; break; case SDLK_a: + game.handle_move_event(MOVE_LEFT, false); break; case SDLK_d: + game.handle_move_event(MOVE_RIGHT, false); break; case SDLK_w: + game.handle_move_event(MOVE_UP, false); break; case SDLK_s: + game.handle_move_event(MOVE_DOWN, false); break; case SDLK_TAB: game.change_player(); @@ -112,12 +116,16 @@ int main(char[][] args) switch (event.key.keysym.sym) { case SDLK_a: + game.handle_move_event(MOVE_LEFT, true); break; case SDLK_d: + game.handle_move_event(MOVE_RIGHT, true); break; case SDLK_w: + game.handle_move_event(MOVE_UP, true); break; case SDLK_s: + game.handle_move_event(MOVE_DOWN, true); break; default: break;