diff options
| author | Mel <einebeere@gmail.com> | 2024-02-15 11:33:11 +0100 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2024-02-15 11:34:28 +0100 |
| commit | 92f63bbdbfc214849c203511bbcb1be0a4865588 (patch) | |
| tree | d82e1b31e583b5cc9538f61cad696dab5dbd84dc /src/Game.cpp | |
| parent | 87ef308220addbe4406006ceb802a7364e6f1a05 (diff) | |
| download | meowcraft-92f63bbdbfc214849c203511bbcb1be0a4865588.tar.zst meowcraft-92f63bbdbfc214849c203511bbcb1be0a4865588.zip | |
Proper input system
Diffstat (limited to 'src/Game.cpp')
| -rw-r--r-- | src/Game.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
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; |
