Skip to content

Commit

Permalink
feat(wolf): add portals pre update
Browse files Browse the repository at this point in the history
  • Loading branch information
Milerius committed Nov 25, 2019
1 parent 90212ea commit 5447209
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tutorials/wolf-3d/wolf-3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <antara/gaming/audio/component.music.hpp>
#include <antara/gaming/audio/component.sound.effect.hpp>
#include <antara/gaming/ecs/virtual.input.system.hpp>
#include <antara/gaming/ecs/lambda.system.hpp>
#include <antara/gaming/graphics/component.layer.hpp>
#include <antara/gaming/scenes/scene.manager.hpp>
#include <antara/gaming/sfml/graphic.system.hpp>
Expand Down Expand Up @@ -897,9 +898,22 @@ class game_scene final : public scenes::base_scene
//! Load Raycast system
system_manager.create_system<raycast_system>(p_system.get_player());

//! Load Portal system
//! Load Portal system (Will be turned into a generic sprite system soon)
system_manager.create_system<portal_system>(p_system.get_player());

auto portal_update_functor = [&registry]() {
auto functor = [&registry](entt::entity entity, transform::properties &props) {
auto dt = timer::time_step::get_fixed_delta_time();
props.rotation = props.rotation + 120.0f * dt;
registry.replace<transform::properties>(entity, props);
};
registry.view<entt::tag<"portal"_hs>, transform::properties>().less(functor);
};

system_manager += std::make_unique<ecs::lambda_pre_system>(
registry,
ecs::ftor{.on_update = std::move(portal_update_functor)});

//! Load minimap system
system_manager.create_system<minimap_system>(p_system.get_player());
}
Expand Down

0 comments on commit 5447209

Please sign in to comment.