home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / XenonSource.exe / gamesystem / source / gs_sprite.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-29  |  1.0 KB  |  54 lines

  1. //-------------------------------------------------------------
  2. //
  3. // Class:    gsCSprite
  4. //
  5. // Author:    John M Phillips
  6. //
  7. // Started:    12/03/00
  8. //
  9. // Base:    gsCObject
  10. //
  11. // Derived:    None
  12. //
  13. //-------------------------------------------------------------
  14.  
  15. #include "gamesystem.h"
  16.  
  17. //-------------------------------------------------------------
  18.  
  19. gsCSprite::gsCSprite()
  20. {
  21.     m_image = 0;
  22.     m_position = gsCPoint(0,0);
  23.     m_hotspot = gsCPoint(0,0);
  24.     m_frame = 0;
  25.     m_active = false;
  26.     m_use_fill_colour = false;
  27.     m_rect_valid = false;
  28. }
  29.  
  30. //-------------------------------------------------------------
  31.  
  32. gsCSprite::~gsCSprite()
  33. {
  34. }
  35.  
  36. //-------------------------------------------------------------
  37.  
  38. const gsCRect& gsCSprite::getRect()
  39. {
  40.     if (!m_rect_valid) {
  41.         if (!m_image)
  42.             m_rect = gsCRect(0,0,0,0);
  43.         else {
  44.             gsCPoint p = m_position - m_hotspot;
  45.             m_rect = gsCRect(p,p + m_image->getTileSize());
  46.             }
  47.         m_rect_valid = true;
  48.         }
  49.  
  50.     return m_rect;
  51. }    
  52.  
  53. //-------------------------------------------------------------
  54.