home *** CD-ROM | disk | FTP | other *** search
/ Game Programming - All in One (3rd Edition) / game_prog_all_in_one_3rd_ed.iso / sources / chapter10 / AngularMotion / spritehandler.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2006-08-26  |  478 b   |  34 lines

  1. #include "spritehandler.h"
  2.  
  3. spritehandler::spritehandler(void)
  4. {
  5.     count = 0;
  6. }
  7.  
  8. spritehandler::~spritehandler(void)
  9. {
  10.     //delete the sprites
  11.     for (int n = 0; n < count; n++)
  12.         delete sprites[n];
  13. }
  14.  
  15. void spritehandler::add(sprite *spr) 
  16. {
  17.     if (spr != NULL) {
  18.         sprites[count] = spr;
  19.         count++;
  20.     }
  21. }
  22.  
  23. void spritehandler::create() 
  24. {
  25.     sprites[count] = new sprite();
  26.     count++;
  27. }
  28.  
  29. sprite *spritehandler::get(int index)
  30. {
  31.     return sprites[index];
  32. }
  33.  
  34.