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

  1. //-------------------------------------------------------------
  2. //
  3. // Class:    gsCImage
  4. //
  5. // Author:    John M Phillips
  6. //
  7. // Started:    12/03/00
  8. //
  9. // Base:    gsCVisual
  10. //
  11. // Derived:    gsCTiledImage
  12. //
  13. //-------------------------------------------------------------
  14.  
  15. #ifndef _INCLUDE_GS_IMAGE_H
  16. #define _INCLUDE_GS_IMAGE_H
  17.  
  18. #include "gs_visual.h"
  19. #include "gs_point.h"
  20. #include "gs_rect.h"
  21.  
  22. class gsCColour;
  23.  
  24. //-------------------------------------------------------------
  25.  
  26. class gsCImage : public gsCVisual
  27. {
  28.     private:
  29.         gsCRect m_rect;
  30.  
  31.         bool create(const gsCPoint& size);
  32.  
  33.         bool m_isLocked;
  34.  
  35.     protected:
  36.  
  37.         gsLPDIRECTDRAWSURFACE m_surface;
  38.         DWORD m_colour_key;
  39.  
  40.         gsDDSURFACEDESC m_ddsd;
  41.  
  42.         bool lock();
  43.         void unlock();
  44.  
  45.     public:
  46.  
  47.         gsCImage();
  48.         virtual ~gsCImage();
  49.  
  50.         bool load(const char *filename,bool rescale = false);
  51.  
  52.         bool setSize(const gsCPoint& size);
  53.         bool enableColourKey(const gsCColour& colour);
  54.         bool disableColourKey();
  55.  
  56.         gsCPoint getSize() const;
  57.  
  58.         void destroy();
  59.         
  60.         void fill(const gsCColour& colour);
  61.         bool setPoint(const gsCPoint& point,const gsCColour& colour);
  62.         bool setRect(const gsCRect& rect,const gsCColour& colour);
  63.  
  64.         bool draw(const gsCPoint& position);
  65.         bool drawSolid(const gsCPoint& position,const gsCColour& fill_colour);
  66.         bool drawFast(const gsCPoint& position);
  67. };
  68.  
  69. //-------------------------------------------------------------
  70.  
  71. inline gsCPoint gsCImage::getSize() const
  72. {
  73.     return m_rect.getSize();
  74. }
  75.  
  76. //-------------------------------------------------------------
  77.  
  78. #endif
  79.  
  80.