Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
physics_service.h
Go to the documentation of this file.
1#pragma once
2
3#include <box2d/box2d.h>
9
10#include <memory>
11
19 public:
21
33 void update(float dt,
34 const std::vector<std::reference_wrapper<GameObject>>& objects);
35
42 std::unique_ptr<PhysicsWorld>& world() noexcept;
43
50 std::unique_ptr<PhysicsRaycaster>& raycaster() noexcept;
51
58 std::unique_ptr<PhysicsCreationFactory>& factory() noexcept;
59
60 [[nodiscard]] bool debug_mode() const noexcept;
61 void debug_mode(bool enabled) noexcept;
62
63 private:
64 bool debug_mode_{false};
65 std::unique_ptr<PhysicsWorld> physics_world_{nullptr};
66 std::unique_ptr<PhysicsRaycaster> physics_raycaster_{nullptr};
67 std::unique_ptr<PhysicsCreationFactory> physics_creation_factory_{nullptr};
68};
Definition iEngineService.h:4
Factory class for creating physics bodies in the Box2D world.
Definition physics_creation_factory.h:20
Class responsible for raycasting in the physics world.
Definition physics_raycaster.h:16
Service responsible for managing the physics world.
Definition physics_service.h:18
std::unique_ptr< PhysicsWorld > & world() noexcept
Accessor for the physics world instance.
std::unique_ptr< PhysicsCreationFactory > & factory() noexcept
Accessor for the physics creation factory instance.
bool debug_mode() const noexcept
void update(float dt, const std::vector< std::reference_wrapper< GameObject > > &objects)
Updates the physics world by stepping the simulation.
std::unique_ptr< PhysicsRaycaster > & raycaster() noexcept
Accessor for the physics raycaster instance.