change "stop" to "active" for move events
This commit is contained in:
1 parent
a29acd2619
commit
7f3185b26a
2 files changed
+14
-14
No files matched your search
+6
-6
@@ -18,7 +18,7 @@ struct Player
|
||||
struct MoveEvent
|
||||
{
|
||||
int type;
|
||||
bool stop;
|
||||
bool active;
|
||||
uint tick;
|
||||
};
|
||||
|
||||
@@ -29,21 +29,21 @@ public:
|
||||
{
|
||||
m_pindex ^= 1;
|
||||
}
|
||||
void handle_move_event(int type, bool stop)
|
||||
void handle_move_event(int type, bool active)
|
||||
{
|
||||
final switch (type)
|
||||
{
|
||||
case MOVE_LEFT:
|
||||
m_left = !stop;
|
||||
m_left = active;
|
||||
break;
|
||||
case MOVE_RIGHT:
|
||||
m_right = !stop;
|
||||
m_right = active;
|
||||
break;
|
||||
case MOVE_UP:
|
||||
m_up = !stop;
|
||||
m_up = active;
|
||||
break;
|
||||
case MOVE_DOWN:
|
||||
m_down = !stop;
|
||||
m_down = active;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -94,16 +94,16 @@ int main(char[][] args)
|
||||
exit = true;
|
||||
break;
|
||||
case SDLK_a:
|
||||
game.handle_move_event(MOVE_LEFT, false);
|
||||
game.handle_move_event(MOVE_LEFT, true);
|
||||
break;
|
||||
case SDLK_d:
|
||||
game.handle_move_event(MOVE_RIGHT, false);
|
||||
game.handle_move_event(MOVE_RIGHT, true);
|
||||
break;
|
||||
case SDLK_w:
|
||||
game.handle_move_event(MOVE_UP, false);
|
||||
game.handle_move_event(MOVE_UP, true);
|
||||
break;
|
||||
case SDLK_s:
|
||||
game.handle_move_event(MOVE_DOWN, false);
|
||||
game.handle_move_event(MOVE_DOWN, true);
|
||||
break;
|
||||
case SDLK_TAB:
|
||||
game.change_player();
|
||||
@@ -116,16 +116,16 @@ int main(char[][] args)
|
||||
switch (event.key.keysym.sym)
|
||||
{
|
||||
case SDLK_a:
|
||||
game.handle_move_event(MOVE_LEFT, true);
|
||||
game.handle_move_event(MOVE_LEFT, false);
|
||||
break;
|
||||
case SDLK_d:
|
||||
game.handle_move_event(MOVE_RIGHT, true);
|
||||
game.handle_move_event(MOVE_RIGHT, false);
|
||||
break;
|
||||
case SDLK_w:
|
||||
game.handle_move_event(MOVE_UP, true);
|
||||
game.handle_move_event(MOVE_UP, false);
|
||||
break;
|
||||
case SDLK_s:
|
||||
game.handle_move_event(MOVE_DOWN, true);
|
||||
game.handle_move_event(MOVE_DOWN, false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user