diff --git a/dinkyecs.hpp b/dinkyecs.hpp index 2690379..1716a9c 100644 --- a/dinkyecs.hpp +++ b/dinkyecs.hpp @@ -98,7 +98,7 @@ namespace DinkyECS { } template - void send(int event, Entity entity) { + void send(Comp event, Entity entity) { EventQueue &queue = queue_map_for(); queue.push({event, entity}); } diff --git a/tests/dinkyecs.cpp b/tests/dinkyecs.cpp index 363a29d..ac39422 100644 --- a/tests/dinkyecs.cpp +++ b/tests/dinkyecs.cpp @@ -121,29 +121,29 @@ TEST_CASE("confirm ECS system works", "[ecs]") { }); } -enum FakeEvent { - HIT_EVENT, MISS_EVENT +enum GUIEvent { + HIT, MISS }; TEST_CASE("confirm that the event system works", "[ecs]") { DinkyECS::World world; DinkyECS::Entity gui_ent = world.entity(); DinkyECS::Entity player = world.entity(); - DaGUI gui{384}; + GUIEvent gui{GUIEvent::HIT}; - world.set(gui_ent, gui); - DaGUI &gui_test = world.get(gui_ent); - REQUIRE(gui.event == gui_test.event); + world.set(gui_ent, gui); + auto &gui_test = world.get(gui_ent); + REQUIRE(gui == gui_test); - world.send(FakeEvent::HIT_EVENT, player); + world.send(GUIEvent::HIT, player); - bool ready = world.has_event(); + bool ready = world.has_event(); REQUIRE(ready == true); - auto [event, entity] = world.recv(); - REQUIRE(event == FakeEvent::HIT_EVENT); + auto [event, entity] = world.recv(); + REQUIRE(event == GUIEvent::HIT); REQUIRE(entity == player); - ready = world.has_event(); + ready = world.has_event(); REQUIRE(ready == false); }