diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-06 17:39:15 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-06 17:39:15 +0200 |
commit | 2969fe8c0fca4826ca129fe12d2e125bb7955c78 (patch) | |
tree | b7514048a8894cc5c64657e817765eb4e860187c /src/example | |
parent | 8a509ad4c5e15fbf7eaade1c8bf4834f0d0069c5 (diff) |
WIP ScriptSystem
Diffstat (limited to 'src/example')
-rw-r--r-- | src/example/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/example/script.cpp | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/example/CMakeLists.txt b/src/example/CMakeLists.txt index eef38fd..6df4ce7 100644 --- a/src/example/CMakeLists.txt +++ b/src/example/CMakeLists.txt @@ -14,4 +14,5 @@ endfunction() add_example(audio_internal) add_example(components_internal) +add_example(script) diff --git a/src/example/script.cpp b/src/example/script.cpp new file mode 100644 index 0000000..28605c7 --- /dev/null +++ b/src/example/script.cpp @@ -0,0 +1,33 @@ +/** \file + * + * Standalone example for usage of the script component and system + */ + +#include <crepe/util/log.h> +#include <crepe/ScriptSystem.h> +#include <crepe/ComponentManager.h> +#include <crepe/GameObject.h> + +#include <crepe/api/BehaviorScript.h> + +using namespace crepe; +using namespace std; + +class MyScript : public api::BehaviorScript { + void update() { + dbg_trace(); + } +}; + +int main() { + dbg_trace(); + + auto obj = GameObject(0, "name", "tag", 0); + obj.add_component<MyScript>(); + + auto & sys = ScriptSystem::get_instance(); + sys.update(); // -> MyScript::update + + return 0; +} + |