feat: added collision world to canvas engine class

main
Sara 2025-01-06 10:56:11 +01:00
parent 68dd2f0d06
commit 87d0c69701
2 changed files with 3 additions and 0 deletions

View File

@ -132,6 +132,7 @@ void CanvasEngine::process_event(SDL_Event const &evt) {
void CanvasEngine::tick(double delta_time) {
this->level->propagate_tick(delta_time);
this->physics_world.check_collisions();
}
void CanvasEngine::draw(SDL_Renderer *render) {

View File

@ -1,6 +1,7 @@
#ifndef CANVAS_ENGINE_HPP
#define CANVAS_ENGINE_HPP
#include "core/collision.hpp"
#include "core/level.hpp"
#include "node.hpp"
#include "assets/asset_db.hpp"
@ -21,6 +22,7 @@ private:
SDL_Renderer *render{nullptr}; //!< primary application window's renderer
SDL_Texture *render_target{nullptr};
AssetDB assets{};
CollisionWorld physics_world{};
InputMap input_map{}; //!< map of inputs to input callback objects
std::unique_ptr<Level> level;
Uint64 last_frame_start_time{}; //!< time at start of last frame