Update project structure

This commit is contained in:
2024-10-19 10:20:37 +02:00
parent aa3dd28fb3
commit 2a43299a15
49 changed files with 79 additions and 65 deletions

View File

@@ -1,39 +0,0 @@
#include "input.h"
#include <GLFW/glfw3.h>
namespace Input {
void KeyListener::key_event(KeyInput const& key_input_event)
{
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);
} else if (key_input_event.action == static_cast<Action>(GLFW_RELEASE)) {
key_state.release(key_input_event.key_code);
}
}
void CursorListener::cursor_event(MouseMotion const& mouse_motion_event)
{
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().get<MouseMotion>();
mouse_motion = {};
}
template <typename T> void State<T>::update_state(entt::registry& registry)
{
auto& state = registry.ctx().get<State<T>>();
state.just_pressed_keys.clear();
state.just_released_keys.clear();
}
template class State<KeyCode>;
} // namespace Input