summary refs log tree commit diff stats
path: root/src/script_system.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-05 20:20:21 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-05 20:20:21 -0500
commitbd1a66887f00e186ab86a5195ebb3271ea732b38 (patch)
treed3fc0335d98f386877b991f538e2645ff6d74fd1 /src/script_system.h
parentccf0fab9f7b8057afc5884e70fff29109f707bf8 (diff)
downloadtanetane-bd1a66887f00e186ab86a5195ebb3271ea732b38.tar.gz
tanetane-bd1a66887f00e186ab86a5195ebb3271ea732b38.tar.bz2
tanetane-bd1a66887f00e186ab86a5195ebb3271ea732b38.zip
Created script system
Diffstat (limited to 'src/script_system.h')
-rw-r--r--src/script_system.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/script_system.h b/src/script_system.h new file mode 100644 index 0000000..2832576 --- /dev/null +++ b/src/script_system.h
@@ -0,0 +1,32 @@
1#ifndef SCRIPT_SYSTEM_H_FD8A95B3
2#define SCRIPT_SYSTEM_H_FD8A95B3
3
4#include <sol/sol.hpp>
5#include <memory>
6#include <set>
7#include <string>
8#include "system.h"
9
10class Game;
11
12class ScriptSystem : public System {
13public:
14
15 static constexpr SystemKey Key = SystemKey::Script;
16
17 explicit ScriptSystem(Game& game);
18
19 void tick(double dt) override;
20
21 void runScript(std::string name);
22
23private:
24
25 Game& game_;
26 sol::state engine_;
27 std::unique_ptr<sol::thread> runner_;
28 std::unique_ptr<sol::coroutine> callable_;
29 std::set<std::string> loadedScripts_;
30};
31
32#endif /* end of include guard: SCRIPT_SYSTEM_H_FD8A95B3 */