change "stop" to "active" for move events

This commit is contained in:
Josh Holtrop 2013-02-18 23:07:09 -05:00
parent a29acd2619
commit 7f3185b26a
2 changed files with 14 additions and 14 deletions

View File

@ -18,7 +18,7 @@ struct Player
struct MoveEvent struct MoveEvent
{ {
int type; int type;
bool stop; bool active;
uint tick; uint tick;
}; };
@ -29,21 +29,21 @@ public:
{ {
m_pindex ^= 1; m_pindex ^= 1;
} }
void handle_move_event(int type, bool stop) void handle_move_event(int type, bool active)
{ {
final switch (type) final switch (type)
{ {
case MOVE_LEFT: case MOVE_LEFT:
m_left = !stop; m_left = active;
break; break;
case MOVE_RIGHT: case MOVE_RIGHT:
m_right = !stop; m_right = active;
break; break;
case MOVE_UP: case MOVE_UP:
m_up = !stop; m_up = active;
break; break;
case MOVE_DOWN: case MOVE_DOWN:
m_down = !stop; m_down = active;
break; break;
} }
} }

View File

@ -94,16 +94,16 @@ int main(char[][] args)
exit = true; exit = true;
break; break;
case SDLK_a: case SDLK_a:
game.handle_move_event(MOVE_LEFT, false); game.handle_move_event(MOVE_LEFT, true);
break; break;
case SDLK_d: case SDLK_d:
game.handle_move_event(MOVE_RIGHT, false); game.handle_move_event(MOVE_RIGHT, true);
break; break;
case SDLK_w: case SDLK_w:
game.handle_move_event(MOVE_UP, false); game.handle_move_event(MOVE_UP, true);
break; break;
case SDLK_s: case SDLK_s:
game.handle_move_event(MOVE_DOWN, false); game.handle_move_event(MOVE_DOWN, true);
break; break;
case SDLK_TAB: case SDLK_TAB:
game.change_player(); game.change_player();
@ -116,16 +116,16 @@ int main(char[][] args)
switch (event.key.keysym.sym) switch (event.key.keysym.sym)
{ {
case SDLK_a: case SDLK_a:
game.handle_move_event(MOVE_LEFT, true); game.handle_move_event(MOVE_LEFT, false);
break; break;
case SDLK_d: case SDLK_d:
game.handle_move_event(MOVE_RIGHT, true); game.handle_move_event(MOVE_RIGHT, false);
break; break;
case SDLK_w: case SDLK_w:
game.handle_move_event(MOVE_UP, true); game.handle_move_event(MOVE_UP, false);
break; break;
case SDLK_s: case SDLK_s:
game.handle_move_event(MOVE_DOWN, true); game.handle_move_event(MOVE_DOWN, false);
break; break;
default: default:
break; break;