Advertisement
x89codered89x

imagewrapper.h

Oct 27th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.47 KB | None | 0 0
  1. #ifndef IMAGEWRAPPER_JAMES
  2. #define IMAGEWRAPPER_JAMES
  3.  
  4. #include "graphics.h"
  5.  
  6. /*
  7. Private header
  8.  
  9. 1)The goal of this class is a class that loads/unloads image for opengl
  10. 2)Keeps track of how  images by
  11.     -filename
  12.     -openGLtextureID
  13.     -image/2D image Metrics in terms of raw pixel data
  14. 3)Loads sentinal image if the image failed to load
  15. 4) Contains implementation to keep track of how many applications of this image are being used
  16. 4) Note: Does NOT  sanity check if  a given image file has been all ready loaded
  17.  
  18. */
  19.  
  20. template <class T> class ImageWrapper {
  21.     public:
  22.     ImageWrapper(cch* fileName_);
  23.     ~ImageWrapper(void);   
  24.    
  25.     //Modifiers
  26.     void bindTexture(void);
  27.     const ui& incrementInstances(void);
  28.     const ui& decrementInstances(void);
  29.            
  30.     //Non Const access
  31.     sf::Image& image(void);
  32.    
  33.     //const access
  34.     cch* fileName(void) const;
  35.     const ui& instances(void) const;
  36.     const sf::Image& image(void) const;
  37.     const GLuint& textureID(void) const;
  38.  
  39.     //static access
  40.     static cch* failureSignature(void);
  41.    
  42.     //Const calculations
  43.     const vt size(void) const;
  44.     const T area(void) const;
  45.     const vt inertia(void) const;
  46.  
  47.     private:
  48.     //Constructor and Destructor Helpers
  49.     void loadImage(void);
  50.     void loadTexture(void);
  51.     void removeTexture(void);
  52.    
  53.     //Members
  54.     ui _instances;
  55.     cch* _fileName;
  56.     sf::Image _image;
  57.     GLuint _textureID;
  58.    
  59.     static  cch* _failureSignature;
  60. };
  61. template <class T> cch* ImageWrapper<T>::_failureSignature ="images/LoadImageFailure2.jpg";
  62. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement