Introduce new scene loading system
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Input {
|
||||
|
||||
void KeyListener::key_event(KeyInput const& key_input_event)
|
||||
{
|
||||
auto& key_state = registry.ctx().emplace<State<KeyCode>>();
|
||||
auto& key_state = registry.ctx().get<State<KeyCode>>();
|
||||
|
||||
if (key_input_event.action == static_cast<Action>(GLFW_PRESS)) {
|
||||
key_state.press(key_input_event.key_code);
|
||||
@@ -17,21 +17,16 @@ void KeyListener::key_event(KeyInput const& key_input_event)
|
||||
|
||||
void CursorListener::cursor_event(MouseMotion const& mouse_motion_event)
|
||||
{
|
||||
auto& mouse_motion = registry.ctx().emplace<MouseMotion>();
|
||||
auto& mouse_motion = registry.ctx().get<MouseMotion>();
|
||||
mouse_motion.delta += mouse_motion_event.delta;
|
||||
}
|
||||
|
||||
void reset_mouse_motion(entt::registry& registry)
|
||||
{
|
||||
auto& mouse_motion = registry.ctx().emplace<MouseMotion>();
|
||||
auto& mouse_motion = registry.ctx().get<MouseMotion>();
|
||||
mouse_motion = {};
|
||||
}
|
||||
|
||||
template <typename T> void State<T>::init_state(entt::registry& registry)
|
||||
{
|
||||
registry.ctx().emplace<State<T>>();
|
||||
}
|
||||
|
||||
template <typename T> void State<T>::update_state(entt::registry& registry)
|
||||
{
|
||||
auto& state = registry.ctx().get<State<T>>();
|
||||
|
||||
Reference in New Issue
Block a user