home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 06 General Architectures / 04 Christian / 2dworld.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-01  |  1.3 KB  |  66 lines

  1.  
  2.  
  3. #ifndef _World2D_H_
  4. #define _World2D_H_
  5.  
  6. #include <string>
  7.  
  8. class World2D;
  9. class WorldPos;
  10.  
  11. class WorldObj
  12. {
  13.  
  14. public:
  15.  
  16.     WorldObj ( World2D * world, char * name );           
  17.  
  18.     void   setPos   ( int x, int y );             // set the world pos center point
  19.     void   setSize  ( int width, int height );    // set the size of the object
  20.     void   setSpeed ( float speed );              // set the speed of the object
  21.     void   move     ( int x, int y );             // move the object
  22.     char * getName  ();                           // get the object name
  23.  
  24. private:
  25.     
  26.     std::string m_name;                           // object name
  27.     WorldPos *  m_pos;          
  28.     World2D  *  m_world;
  29. };
  30.  
  31. class WorldPos
  32. {
  33.     friend World2D;
  34.  
  35. public:
  36.  
  37.     void       setObject ( WorldObj * obj );     // register an obj on this pos
  38.     WorldObj * getObj    ();                     // get the object on this ps
  39.  
  40. private:
  41.     int        m_id;    // world position id
  42.     WorldObj * m_obj;   // object in this position
  43.     int        m_type;  // pos type 
  44.  
  45. };
  46.  
  47. class World2D
  48. {
  49.  
  50. public:
  51.  
  52.     World2D ( int length, int width );
  53.  
  54.     void setTileDistance ( float dist );
  55.  
  56. private:
  57.  
  58.     int   m_length;
  59.     int   m_width;
  60.  
  61.     float m_tileDist;
  62.  
  63.     WorldPos * m_posArray;
  64. };
  65.  
  66. #endif