aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2020-05-09 09:42:18 -0400
committerClyne Sullivan <clyne@bitgloo.com>2020-05-09 09:42:18 -0400
commitda0913771538fd9b1ca538615fd9aa0388608466 (patch)
tree18b23720b0a9c24e05a8f3eceb6b03b0b858fcb2 /src/player.cpp
parentf461087223a80cd06619517e355690654f406d63 (diff)
Merge audio; handle mouse events
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp42
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);
- });
+ });
}
}
}