diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-06 21:15:34 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-06 21:15:34 -0500 |
commit | 0e1e97da9e8937d19b0101dcc1f3a16e3db495b6 (patch) | |
tree | 64472e8e640bc9884a938106a49b87b43852aa75 /src/script_system.cpp | |
parent | cb7617344c3b7994cb40d6253a77dbfa3d3ff984 (diff) | |
download | tanetane-0e1e97da9e8937d19b0101dcc1f3a16e3db495b6.tar.gz tanetane-0e1e97da9e8937d19b0101dcc1f3a16e3db495b6.tar.bz2 tanetane-0e1e97da9e8937d19b0101dcc1f3a16e3db495b6.zip |
Added sound and animation changes to scripting
Diffstat (limited to 'src/script_system.cpp')
-rw-r--r-- | src/script_system.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/script_system.cpp b/src/script_system.cpp index 7f4729b..e2b117a 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <iostream> | 2 | #include <iostream> |
3 | #include "game.h" | 3 | #include "game.h" |
4 | #include "message_system.h" | 4 | #include "message_system.h" |
5 | #include "animation_system.h" | ||
5 | 6 | ||
6 | ScriptSystem::ScriptSystem(Game& game) : game_(game) { | 7 | ScriptSystem::ScriptSystem(Game& game) : game_(game) { |
7 | engine_.open_libraries( | 8 | engine_.open_libraries( |
@@ -15,12 +16,40 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
15 | "hideCutsceneBars", &MessageSystem::hideCutsceneBars, | 16 | "hideCutsceneBars", &MessageSystem::hideCutsceneBars, |
16 | "isMessageActive", sol::property(&MessageSystem::isMessageActive)); | 17 | "isMessageActive", sol::property(&MessageSystem::isMessageActive)); |
17 | 18 | ||
19 | engine_.new_usertype<AnimationSystem>( | ||
20 | "animation", | ||
21 | "setSpriteAnimation", &AnimationSystem::setSpriteAnimation); | ||
22 | |||
23 | engine_.new_usertype<Mixer>( | ||
24 | "mixer", | ||
25 | "playSound", &Mixer::playSound, | ||
26 | "loopSound", &Mixer::loopSound, | ||
27 | "stopChannel", &Mixer::stopChannel); | ||
28 | |||
18 | engine_.set_function( | 29 | engine_.set_function( |
19 | "message", | 30 | "message", |
20 | [&] () -> MessageSystem& { | 31 | [&] () -> MessageSystem& { |
21 | return game_.getSystem<MessageSystem>(); | 32 | return game_.getSystem<MessageSystem>(); |
22 | }); | 33 | }); |
23 | 34 | ||
35 | engine_.set_function( | ||
36 | "animation", | ||
37 | [&] () -> AnimationSystem& { | ||
38 | return game_.getSystem<AnimationSystem>(); | ||
39 | }); | ||
40 | |||
41 | engine_.set_function( | ||
42 | "mixer", | ||
43 | [&] () -> Mixer& { | ||
44 | return game_.getMixer(); | ||
45 | }); | ||
46 | |||
47 | engine_.set_function( | ||
48 | "getSpriteByAlias", | ||
49 | [&] (std::string alias) -> int { | ||
50 | return game_.getSpriteByAlias(alias); | ||
51 | }); | ||
52 | |||
24 | engine_.script_file("../res/scripts/common.lua"); | 53 | engine_.script_file("../res/scripts/common.lua"); |
25 | } | 54 | } |
26 | 55 | ||