Advertisement
Kondensator

LTexture.cpp

Jul 7th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include "LTexture.h"
  2.  
  3. LTexture::LTexture()
  4. {
  5. }
  6.  
  7.  
  8. LTexture::~LTexture()
  9. {
  10. }
  11.  
  12. bool LTexture::loadFromFile(std::string path)
  13. {
  14.     bool success = true;
  15.  
  16.     SDL_Surface* loadedSurface = IMG_Load(path.c_str());
  17.     if (loadedSurface == NULL)
  18.     {
  19.         std::cout << " Could not load: " << path.c_str() << " Error: " << SDL_GetError() << std::endl;
  20.         success = false;
  21.     }
  22.     else
  23.     {
  24.         mTexture = SDL_CreateTextureFromSurface(gRenderer, loadedSurface);
  25.         if (mTexture == NULL)
  26.         {
  27.             std::cout << "Could not load Texture image: " << path.c_str() << " Error: " << SDL_GetError() << std::endl;
  28.             success = false;
  29.         }
  30.         SDL_FreeSurface(loadedSurface);
  31.     }
  32.     return success;
  33. }
  34.  
  35. void LTexture::free()
  36. {
  37. }
  38.  
  39. void LTexture::render(int x, int y)
  40. {
  41. }
  42.  
  43. int LTexture::getWidth()
  44. {
  45.     return 0;
  46. }
  47.  
  48. int LTexture::getHeight()
  49. {
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement