From 92f63bbdbfc214849c203511bbcb1be0a4865588 Mon Sep 17 00:00:00 2001 From: Mel Date: Thu, 15 Feb 2024 11:33:11 +0100 Subject: Proper input system --- src/Game.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Game.cpp') diff --git a/src/Game.cpp b/src/Game.cpp index 231c681..dd04b2f 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -21,6 +21,9 @@ void Game::run() const { World::Clouds clouds{}; Entities::Player player{{0, World::Chunk::Height / 2.0, 0}}; + Input::register_callbacks(m_window); + + Input input; Time time; while (!m_window.should_close()) { @@ -33,11 +36,13 @@ void Game::run() const { time.start_frame(); - if (m_window.key(GLFW_KEY_ESCAPE, GLFW_PRESS)) { + input.update(time.frame_start()); + + if (input.pressed(Key::Escape)) { m_window.close(); } - player.update(time, m_window, camera, world); + player.update(time, input, camera, world); clouds.update(time); GFX::Actions actions; -- cgit 1.4.1