ff3d77ec6d26e443ce47f5c9b3f79b7ec52c87f7
[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
8 class ScriptInterpreter
9 {
10 public:
11   ScriptInterpreter();
12   ~ScriptInterpreter();
13
14   void load_script(std::istream& in, const std::string& sourcename = "");
15   void run_script();
16   
17   void expose_object(void* object, const std::string& name,
18                      const std::string& type);
19
20   void suspend(float seconds);
21   void update();
22
23   static ScriptInterpreter* current()
24   {
25     return _current;
26   }
27
28 private:
29   HSQUIRRELVM v;
30   static ScriptInterpreter* _current;
31   Timer resume_timer;
32 };
33
34 #endif
35