From 3ee74cdb1b4fd2bf9eefdf6bcd8439b27cbb7336 Mon Sep 17 00:00:00 2001 From: cflip Date: Fri, 1 Apr 2022 21:23:01 -0600 Subject: Add a game timer This adds a delta time that ensures that everything moves at the same speed regardless of framerate or system. --- src/level.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/level.cpp') diff --git a/src/level.cpp b/src/level.cpp index 22f861b..43ca215 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -32,10 +32,10 @@ void Level::set(int x, int y, uint8_t tile) m_tiles[x + y * m_width] = tile; } -void Level::update() +void Level::update(float deltaTime) { for (const auto& vehicle : m_vehicles) { - vehicle->update(); + vehicle->update(deltaTime); } } -- cgit v1.2.3