* svn:ignored .externalToolBuilders in root directory (Eclipse+CDT)
[supertux.git] / src / scripting / script_interpreter.h
index 54618c4..c4ecabc 100644 (file)
@@ -3,20 +3,51 @@
 
 #include <squirrel.h>
 #include <iostream>
+#include "timer.h"
+#include "game_object.h"
+#include "scripting/sound.h"
+#include "scripting/level.h"
 
-class ScriptInterpreter
+class Sector;
+
+class ScriptInterpreter : public GameObject
 {
 public:
-    ScriptInterpreter();
-    ~ScriptInterpreter();
+  ScriptInterpreter(const std::string& working_dir);
+  ~ScriptInterpreter();
+
+  void register_sector(Sector* sector);
+
+  void draw(DrawingContext& );
+  void update(float );
+
+  void load_script(std::istream& in, const std::string& sourcename = "");
+  void start_script();
+  
+  void expose_object(void* object, const std::string& name,
+                     const std::string& type);
 
-    void load_script(std::istream& in, const std::string& sourcename = "");
-    void run_script();
-    void resume_script();
-    bool script_suspended();
+  void set_wakeup_time(float seconds);
+
+  static ScriptInterpreter* current()
+  {
+    return _current;
+  }
+
+  const std::string& get_working_directory() const
+  {
+      return working_directory;
+  }
 
 private:
-    HSQUIRRELVM v;
+  HSQUIRRELVM v;
+  static ScriptInterpreter* _current;
+  Timer wakeup_timer;
+
+  /// this directory is used as base for all filenames used in scripts
+  std::string working_directory;
+  Scripting::Sound* sound;
+  Scripting::Level* level;
 };
 
 #endif