aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2024-11-20 10:43:32 +0100
committerJAROWMR <jarorutjes07@gmail.com>2024-11-20 10:43:32 +0100
commit690471c7c4536c074a4dca5aab7cc618d47bfb5f (patch)
tree35dcf3858b8f86a031cf5070de9caa069af4257d /src/crepe/api
parentd81ecc242ff88ffd49e0b5296dfb23ab54a0cd78 (diff)
merge with maser
Diffstat (limited to 'src/crepe/api')
-rw-r--r--src/crepe/api/LoopManager.cpp6
-rw-r--r--src/crepe/api/LoopManager.h5
-rw-r--r--src/crepe/api/Script.h9
3 files changed, 14 insertions, 6 deletions
diff --git a/src/crepe/api/LoopManager.cpp b/src/crepe/api/LoopManager.cpp
index a4bc101..586919d 100644
--- a/src/crepe/api/LoopManager.cpp
+++ b/src/crepe/api/LoopManager.cpp
@@ -35,10 +35,8 @@ void LoopManager::start() {
void LoopManager::set_running(bool running) { this->game_running = running; }
void LoopManager::fixed_update() {
- PhysicsSystem phys;
- phys.update();
- CollisionSystem col;
- col.update();
+ this->get_system<PhysicsSystem>().update();
+ this->get_system<CollisionSystem>().update();
}
void LoopManager::loop() {
diff --git a/src/crepe/api/LoopManager.h b/src/crepe/api/LoopManager.h
index f6904be..37f13ac 100644
--- a/src/crepe/api/LoopManager.h
+++ b/src/crepe/api/LoopManager.h
@@ -4,6 +4,7 @@
#include "../ComponentManager.h"
#include "../system/System.h"
+#include "api/SceneManager.h"
namespace crepe {
@@ -71,7 +72,9 @@ private:
private:
//! Component manager instance
ComponentManager component_manager{};
-
+public:
+ //! Scene manager instance
+ SceneManager scene_manager{component_manager};
private:
/**
* \brief Collection of System instances
diff --git a/src/crepe/api/Script.h b/src/crepe/api/Script.h
index 2b70379..939d142 100644
--- a/src/crepe/api/Script.h
+++ b/src/crepe/api/Script.h
@@ -63,7 +63,14 @@ protected:
*/
template <typename T>
std::vector<std::reference_wrapper<T>> get_components() const;
-
+
+ /**
+ * \brief Gets game object id this script is attached to
+ *
+ * \returns game object id
+ */
+ game_object_id_t get_game_object_id() const {return this->game_object_id;};
+
protected:
// NOTE: Script must have a constructor without arguments so the game programmer doesn't need
// to manually add `using Script::Script` to their concrete script class.