diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2020-05-09 09:42:18 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2020-05-09 09:42:18 -0400 |
commit | da0913771538fd9b1ca538615fd9aa0388608466 (patch) | |
tree | 18b23720b0a9c24e05a8f3eceb6b03b0b858fcb2 /src/player.cpp | |
parent | f461087223a80cd06619517e355690654f406d63 (diff) |
Merge audio; handle mouse events
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/src/player.cpp b/src/player.cpp index b914672..f40a1d1 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -54,26 +54,23 @@ void PlayerSystem::receive(const KeyDownEvent& kue) { if (player.valid()) { if (kue.sym == SDLK_a) { - entities.each<EventListener>([&]([[maybe_unused]] entityx::Entity e, - EventListener& el) - { + entities.each<EventListener>( + [](entityx::Entity e, EventListener& el) { el.tryListener("MoveLeftPressed", e.component<Scripted>()->caller); - }); + }); } else if (kue.sym == SDLK_d) { - entities.each<EventListener>([&]([[maybe_unused]] entityx::Entity e, - EventListener& el) - { + entities.each<EventListener>( + [](entityx::Entity e, EventListener& el) { el.tryListener("MoveRightPressed", e.component<Scripted>()->caller); - }); + }); } else if (kue.sym == SDLK_SPACE) { - entities.each<EventListener>([&]([[maybe_unused]] entityx::Entity e, - EventListener& el) - { + entities.each<EventListener>( + [](entityx::Entity e, EventListener& el) { el.tryListener("JumpKeyPressed", e.component<Scripted>()->caller); - }); + }); } } } @@ -82,26 +79,23 @@ void PlayerSystem::receive(const KeyUpEvent& kue) { if (player.valid()) { if (kue.sym == SDLK_a) { - entities.each<EventListener>([&]([[maybe_unused]] entityx::Entity e, - EventListener& el) - { + entities.each<EventListener>( + [](entityx::Entity e, EventListener& el) { el.tryListener("MoveLeftReleased", e.component<Scripted>()->caller); - }); + }); } else if (kue.sym == SDLK_d) { - entities.each<EventListener>([&]([[maybe_unused]] entityx::Entity e, - EventListener& el) - { + entities.each<EventListener>( + [](entityx::Entity e, EventListener& el) { el.tryListener("MoveRightReleased", e.component<Scripted>()->caller); - }); + }); } else if (kue.sym == SDLK_SPACE) { - entities.each<EventListener>([&]([[maybe_unused]] entityx::Entity e, - EventListener& el) - { + entities.each<EventListener>( + [](entityx::Entity e, EventListener& el) { el.tryListener("JumpKeyReleased", e.component<Scripted>()->caller); - }); + }); } } } |