Ryan was right, Tux was firing from the head :D
[supertux.git] / src / gameobjs.h
index b6470e4..b6cec55 100644 (file)
@@ -138,9 +138,56 @@ class Trampoline : public GameObject
   unsigned int frame;
 };
 
-
 void load_object_gfx();
 
+
+class ObjectManager
+{
+ private:
+  ObjectManager();
+  ~ObjectManager();
+
+  static ObjectManager* instance_;
+
+  // XXX Objects will have to be split up into two categories:
+  //  - Drawn before tux
+  //  - Drawn after tux
+  // Eventually Player should be a part of ObjectManager
+
+  std::vector<BadGuy*> badguys;
+  std::vector<Trampoline> trampolines;
+  std::vector<BouncyDistro> bouncy_distros;
+  std::vector<BrokenBrick> broken_bricks;
+  std::vector<BouncyBrick> bouncy_bricks;
+  //std::vector<Upgrade> upgrades;
+  //std::vector<Bullet> bullets;
+
+  void load_badguys(std::string filename);
+
+ public:
+  static ObjectManager* instance() { return instance_ ? instance_ : instance_ = new ObjectManager(); }
+  static void destroy_instance() { delete instance_; instance_ = 0; }
+
+  void draw_bg();
+  void draw_fg();
+  void actions();
+  
+/*  Object* get(unsigned int id) {
+    if(id < badguys.size())
+      {
+        return badguys[id]; 
+      }
+    else
+      {
+        // Never return 0, but return the 0th tile instead so that
+        // user code doesn't have to check for NULL pointers all over
+        // the place
+        return badguys[0]; 
+      } 
+  }
+*/
+};
+
 #endif 
 
 /* Local Variables: */