aboutsummaryrefslogtreecommitdiff
path: root/src/example/script.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-05 16:12:47 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-05 16:12:47 +0100
commite36ea050972fcaaf3d85d672755bad4ebb2dcd80 (patch)
tree5145e0b66650eea1df301106b7d197a586be65f3 /src/example/script.cpp
parent333b07775be1ef20fdb5909672c1e4dcabec1b40 (diff)
parentb770475741b7c33d57331f3139c55a3f237ad274 (diff)
merge `master` into `loek/savemgr`loek/savemgr
Diffstat (limited to 'src/example/script.cpp')
-rw-r--r--src/example/script.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/example/script.cpp b/src/example/script.cpp
index cda9591..dac7af3 100644
--- a/src/example/script.cpp
+++ b/src/example/script.cpp
@@ -4,7 +4,7 @@
*/
#include <crepe/ComponentManager.h>
-#include <crepe/ScriptSystem.h>
+#include <crepe/system/ScriptSystem.h>
#include <crepe/util/log.h>
#include <crepe/api/BehaviorScript.h>
@@ -14,20 +14,17 @@
#include <crepe/api/Transform.h>
using namespace crepe;
-using namespace crepe::api;
using namespace std;
// Unrelated stuff that is not part of this POC
-int _ = [] () {
+int _ = []() {
// Show dbg_trace() output
- auto & cfg = api::Config::get_instance();
- cfg.log.level = util::LogLevel::TRACE;
+ auto & cfg = Config::get_instance();
+ cfg.log.level = LogLevel::TRACE;
return 0; // satisfy compiler
}();
-
-
// User-defined script:
class MyScript : public Script {
void update() {
@@ -40,7 +37,12 @@ class MyScript : public Script {
int main() {
// Create game object with Transform and BehaviorScript components
auto obj = GameObject(0, "name", "tag", 0);
- obj.add_component<Transform>(Point { .x = 1.2, .y = 3.4, }, 0, 0);
+ obj.add_component<Transform>(
+ Point{
+ .x = 1.2,
+ .y = 3.4,
+ },
+ 0, 0);
obj.add_component<BehaviorScript>().set_script<MyScript>();
// Get ScriptSystem singleton instance (this would normally be done from the
@@ -51,4 +53,3 @@ int main() {
return EXIT_SUCCESS;
}
-