source:
orxonox.OLD/branches/script_engine/src/lib/script_engine/script_manager.h
@
8155
Last change on this file since 8155 was 8155, checked in by snellen, 18 years ago | |
---|---|
File size: 1.3 KB |
Rev | Line | |
---|---|---|
[8085] | 1 | #ifndef _SCRIPT_MANAGER_H |
2 | #define _SCRIPT_MNAGER_H | |
3 | ||
[8131] | 4 | #include <list> |
[8085] | 5 | #include <string> |
[8093] | 6 | |
[8131] | 7 | #include "script.h" |
[8085] | 8 | #include "base_object.h" |
9 | #include "luaincl.h" | |
[8093] | 10 | #include "loading/load_param.h" |
[8085] | 11 | |
12 | ||
[8155] | 13 | //!< Contains the name of a lua script file and a list of all objects that the script needs |
14 | struct LuaScript | |
[8131] | 15 | { |
16 | std::string name; | |
[8155] | 17 | std::list<std::string> objectList; |
18 | Script script; | |
[8131] | 19 | }; |
[8085] | 20 | |
[8093] | 21 | class ScriptManager //: public BaseObject |
[8085] | 22 | { |
23 | public: | |
[8139] | 24 | ScriptManager(); |
[8136] | 25 | ~ScriptManager(); |
[8085] | 26 | |
[8155] | 27 | inline static ScriptManager* getInstance(); |
[8138] | 28 | |
[8155] | 29 | virtual void loadParams(const TiXmlElement* root); |
30 | void setWorld(std::string& world){currentWorld = world;} | |
[8085] | 31 | |
[8137] | 32 | void tick(float timestep); |
[8085] | 33 | |
[8131] | 34 | void initScripts(); // initializes all scripts |
35 | ||
[8085] | 36 | private: |
[8138] | 37 | |
[8155] | 38 | void init(); |
39 | void createScriptList(TiXmlElement* scripts); | |
40 | void setCurrentScriptFile(std::string& file); | |
41 | void addObjectToScript(std::string& object, LuaScript& script); | |
[8085] | 42 | |
[8155] | 43 | bool fileIsInScriptList(std::string& file); |
44 | bool objectIsInObjectList(std::string& object,const LuaScript& script); | |
[8085] | 45 | |
[8131] | 46 | |
[8155] | 47 | static ScriptManager* singletonRef; //!< Reference to this class |
48 | std::list<LuaScript> scriptList; //!< The list of all scripts that the current world needs | |
49 | std::string currentWorld; | |
50 | LuaScript currentScript; //!< For temorary use | |
51 | ||
52 | ||
53 | ||
[8085] | 54 | }; |
55 | #endif |
Note: See TracBrowser
for help on using the repository browser.