home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / XenonSource.exe / gamesystem / includes / gs_tiledimage.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  1.5 KB  |  72 lines

  1. //-------------------------------------------------------------
  2. //
  3. // Class:    gsCTiledImage
  4. //
  5. // Author:    John M Phillips
  6. //
  7. // Started:    12/03/00
  8. //
  9. // Base:    gsCImage
  10. //
  11. // Derived:    gsCFont
  12. //
  13. //-------------------------------------------------------------
  14.  
  15. #ifndef _INCLUDE_GS_TILEDIMAGE_H
  16. #define _INCLUDE_GS_TILEDIMAGE_H
  17.  
  18. #include "gs_types.h"
  19. #include "gs_image.h"
  20.  
  21. //-------------------------------------------------------------
  22.  
  23. typedef enum {
  24.     gsTILE_EMPTY,
  25.     gsTILE_PARTIAL,
  26.     gsTILE_SOLID,
  27. } gsTileInfo;
  28.  
  29. //-------------------------------------------------------------
  30.  
  31. class gsCTiledImage : public gsCImage
  32. {
  33.     private:
  34.         bool calculateSourceRects();
  35.     
  36.     protected:
  37.         int m_num_tiles;
  38.         gsCPoint m_tile_size;
  39.         gsCRect *m_source_rects;
  40.  
  41.     public:
  42.         gsCTiledImage();
  43.         virtual ~gsCTiledImage();
  44.  
  45.         void destroy();
  46.  
  47.         bool load(const char *filename,bool rescale = false);
  48.  
  49.         bool setTileSize(const gsCPoint& tile_size);
  50.         gsCPoint getTileSize();
  51.  
  52.         gsTileInfo getTileInfo(int tile);
  53.  
  54.         int getNumTiles();
  55.  
  56.         bool draw(int tile,const gsCPoint& position);
  57.         bool drawSolid(int tile,const gsCPoint& position,const gsCColour& fill_colour);
  58.         bool drawTinted(int tile,const gsCPoint& position,const gsCColour& tint_colour);
  59.         bool drawFast(int tile,const gsCPoint& position);
  60. };
  61.  
  62. //-------------------------------------------------------------
  63.  
  64. inline int gsCTiledImage::getNumTiles()
  65. {
  66.     return m_num_tiles;
  67. }
  68.  
  69. //-------------------------------------------------------------
  70.  
  71. #endif
  72.