Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 19th, 2012  |  syntax: None  |  size: 0.81 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Array Allocation
  2. SDL_Surface* sprites[];
  3.        
  4. void addNewSprite(SDL_Surface* sprite){
  5.  
  6.     this->sprites[n_sprites+1] = new SDL_Surface;
  7.     this->sprites[n_sprites+1] = IMG_Load("spritepath.jpg");
  8.     this->n_sprites++;
  9. }
  10.        
  11. SDL_Surface getSprite(int sprite_index){
  12.  
  13.     return this->sprites[sprite_index];
  14. }
  15.        
  16. Draw(x_position, y_position, this->sprite->getSprite[0], screen);
  17.        
  18. E:cGame.cpp|71|error: cannot convert `SDL_Surface' to `SDL_Surface*' for argument `1' to `int SDL_UpperBlit(SDL_Surface*, SDL_Rect*, SDL_Surface*, SDL_Rect*)'|
  19.        
  20. SDL_Surface* getSprite(int sprite_index){
  21.   return this->sprites[sprite_index];
  22. }
  23.        
  24. this->sprites[n_sprites+1] = new SDL_Surface;
  25. this->sprites[n_sprites+1] = IMG_Load("spritepath.jpg");
  26.        
  27. SDL_Surface getSprite(int sprite_index)
  28.        
  29. SDL_Surface* getSprite(int sprite_index)