18 #ifndef HEADER_SUPERTUX_SQUIRREL_SQUIRREL_ENVIRONMENT_HPP 19 #define HEADER_SUPERTUX_SQUIRREL_SQUIRREL_ENVIRONMENT_HPP 26 #include "squirrel/squirrel_util.hpp" 56 void expose(
const std::string& name, std::unique_ptr<T> script_object)
58 sq_pushobject(m_vm.get_vm(), m_table);
59 expose_object(m_vm.get_vm(), -1, std::move(script_object), name.c_str());
60 sq_pop(m_vm.get_vm(), 1);
62 void unexpose(
const std::string& name);
66 void run_script(
const std::string& script,
const std::string& sourcename);
72 void run_script(std::istream& in,
const std::string& sourcename);
74 void update(
float dt_sec);
75 void wait_for_seconds(HSQUIRRELVM vm,
float seconds);
78 void garbage_collect();
84 std::vector<HSQOBJECT> m_scripts;
85 std::unique_ptr<SquirrelScheduler> m_scheduler;
void expose(const std::string &name, std::unique_ptr< T > script_object)
Generic expose function, T must be a type that has a create_squirrel_instance() associated with it...
Definition: squirrel_environment.hpp:56
void expose_self()
Expose this engine under 'name'.
Definition: squirrel_environment.cpp:67
The SquirrelEnvironment contains the environment in which a script is executed, meaning a root table ...
Definition: squirrel_environment.hpp:35
void try_expose(GameObject &object)
Expose the GameObject if it has a ScriptInterface, otherwise do nothing.
Definition: squirrel_environment.cpp:83
Base class for all the things that make up Levels' Sectors.
Definition: game_object.hpp:46
Basic wrapper around HSQUIRRELVM with some utility functions, not to be confused with SquirrelVirtual...
Definition: squirrel_vm.hpp:29
Objects that want to expose themself to the scripting environment should implement this interface...
Definition: script_interface.hpp:26
void run_script(const std::string &script, const std::string &sourcename)
Convenience function that takes an std::string instead of an std::istream&.
Definition: squirrel_environment.cpp:123