diff options
author | Andy Belle-Isle <abelleisle@protonmail.com> | 2022-11-13 13:55:26 -0600 |
---|---|---|
committer | Andy Belle-Isle <abelleisle@protonmail.com> | 2022-11-13 13:55:26 -0600 |
commit | 38e2036d031bdeaea76ef4b6c3c2af5247ed93ec (patch) | |
tree | b1401ba2ef33d08dbc528aadbf61f0d4aedad63d /src/player.cpp | |
parent | 57a1eb6fdccb9023557d0a470796f423f063948a (diff) | |
parent | 57013add5b7c524086272be7d395f9ec5109bde2 (diff) |
Merge remote-tracking branch 'origin/lib-cleanup' into world
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); - }); + }); } } } |