aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Script.cpp
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2024-12-05 21:10:07 +0100
committerJAROWMR <jarorutjes07@gmail.com>2024-12-05 21:10:07 +0100
commit9604616001ac273f2c966c3c829638e905def7bf (patch)
tree7e958c2b658a4dbc9e79068d7309513efa928937 /src/crepe/api/Script.cpp
parent018a451051669506be447aa925ecb6a9f5aaf418 (diff)
parent1f4e961d7f9d6887c807cac1a362f2d178b0860b (diff)
merge with master and keypressed added to game
Diffstat (limited to 'src/crepe/api/Script.cpp')
-rw-r--r--src/crepe/api/Script.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/crepe/api/Script.cpp b/src/crepe/api/Script.cpp
index fcbe4c7..4091fd4 100644
--- a/src/crepe/api/Script.cpp
+++ b/src/crepe/api/Script.cpp
@@ -1,11 +1,17 @@
+#include <string>
+
+#include "../manager/SceneManager.h"
+
#include "Script.h"
using namespace crepe;
+using namespace std;
Script::~Script() {
- EventManager & evmgr = this->event_manager;
+ Mediator & mediator = this->mediator;
+ EventManager & mgr = mediator.event_manager;
for (auto id : this->listeners) {
- evmgr.unsubscribe(id);
+ mgr.unsubscribe(id);
}
}
@@ -13,3 +19,9 @@ template <>
void Script::subscribe(const EventHandler<CollisionEvent> & callback) {
this->subscribe_internal(callback, this->game_object_id);
}
+
+void Script::set_next_scene(const string & name) {
+ Mediator & mediator = this->mediator;
+ SceneManager & mgr = mediator.scene_manager;
+ mgr.set_next_scene(name);
+}