Guest User

Untitled

a guest
Oct 20th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include "handleGraphics.h"
  2.  
  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