Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

object.h

Go to the documentation of this file.
00001 #ifndef __OBJECT_H
00002 #define __OBJECT_H
00003 
00004 class ObjectManager;
00005 
00006 
00007 enum direction  { EAST = 0, SOUTHEAST, SOUTH,
00008                   SOUTHWEST, WEST, NORTHWEST, NORTH, NORTHEAST, NO_DIRECTION };
00009 
00010 
00011 #include <string>
00012 #include "sprite.h"
00013 #include "graphics.h"
00014 #include "background.h"
00015 
00016 class GameObject {
00017 public:
00019 
00025         GameObject(ObjectManager &, string name = "");
00026 
00028 
00032         ~GameObject();
00033         
00035 
00041         virtual Rect draw(Graphics &GD) { Rect r; r.x=r.y=-9999; if(sprite) r = sprite->draw(GD); return r; }
00042 
00044 
00050         virtual Rect draw(Surface *s)   { Rect r; r.x=r.y=-9999; if(sprite) r = sprite->draw(s); return r; }
00051 
00053 
00057         virtual void animate()          { if(sprite) sprite->animate(); }
00058 
00060 
00066         virtual void think()            { return; }
00067 
00069 
00080         virtual int SetPosition(double x, double y);
00081 
00083 
00088         virtual int Recenter ();
00089 
00091 
00097         Sprite *getSprite() const { return sprite; }
00098 
00100 
00105         string  getName() const { return name; }
00106 
00108 
00114         void SetDead(bool b) { dead = b; }
00115 
00117 
00120         bool IsDead() const { return dead; }
00121 
00123 
00130         Rect GetBoundingRect();
00131 
00133 
00136         bool IsCollidable() { return collide; }
00137 
00139 
00143         void SetCollidable(bool b) { collide = b; }
00144 
00146 
00149         bool IsDamagable() const { return damagable; }
00150 
00152 
00155         void SetDamagable(bool b) { damagable = b; }
00156 
00158 
00161         int GetXint() const;
00162 
00164 
00167         int GetYint() const;
00168 
00170 
00173         double GetX() const;
00174 
00176 
00179         double GetY() const;
00180 
00182 
00186         int GetLayer() const;
00187 
00189 
00193         void SetLayer(int l);
00194 
00196 
00203         void Damage(double howmuch = 1);
00204 
00206 
00211         void SetDamage(double howhigh = 1);
00212 
00213 protected:
00215         Sprite *sprite;
00216 
00218         double Xpos, Ypos;
00219 
00221         int Xposi, Yposi;
00222 
00224         ObjectManager &OM;
00225 
00226 private:
00227         // Private Data
00228 
00229         string name;
00230         bool dead, collide, damagable;
00231         int layer;
00232         double damage;
00233 };
00234 
00235 #endif

Generated on Sun Dec 8 12:02:20 2002 for nnc by doxygen1.3-rc1