changed worldmap format a bit to be more consistent with level format
[supertux.git] / src / scripting / script_interpreter.h
1 #ifndef __SCRIPT_INTERPRETER_H__
2 #define __SCRIPT_INTERPRETER_H__
3
4 #include <squirrel.h>
5 #include <iostream>
6 #include "timer.h"
7 #include "game_object.h"
8 #include "scripting/sound.h"
9 #include "scripting/level.h"
10
11 class Sector;
12
13 class ScriptInterpreter : public GameObject
14 {
15 public:
16   ScriptInterpreter(Sector* sector);
17   ~ScriptInterpreter();
18
19   void draw(DrawingContext& );
20   void update(float );
21
22   void load_script(std::istream& in, const std::string& sourcename = "");
23   void start_script();
24   
25   void expose_object(void* object, const std::string& name,
26                      const std::string& type);
27
28   void set_wakeup_time(float seconds);
29
30   static ScriptInterpreter* current()
31   {
32     return _current;
33   }
34
35 private:
36   HSQUIRRELVM v;
37   static ScriptInterpreter* _current;
38   Timer wakeup_timer;
39
40   Scripting::Sound* sound;
41   Scripting::Level* level;
42 };
43
44 #endif
45