Guest User

Untitled

a guest
Oct 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include "handleGraphics.h"
  2. //error: /home/ivan/workspace/Test/src/handleGraphics.cpp|16|error: request for member ‘h’ in ‘optimized’, which is //of non-class type ‘SDL_Surface*’|
  3. handleGraphics::handleGraphics()
  4. {
  5. //ctor
  6. }
  7.  
  8. void handleGraphics::applyImage(SDL_Surface *screen,std::string name,int x,int y)
  9. {
  10. SDL_Surface *image=SDL_LoadBMP(name.c_str());
  11. SDL_Surface *optimized=SDL_DisplayFormat(image);
  12. SDL_FreeSurface(image);
  13.  
  14.  
  15. SDL_Rect offset;
  16. offset.x = x-(int)((*optimized.h)/2);
  17. offset.y = y-(int)((*optimized.w)/2);
  18.  
  19. SDL_BlitSurface( optimized, NULL, screen, &offset );
  20. }
Add Comment
Please, Sign In to add comment