2012-08-02 01:43:55 +00:00
|
|
|
#ifndef _GUIIMAGE_H_
|
|
|
|
#define _GUIIMAGE_H_
|
|
|
|
|
|
|
|
#include "../GuiComponent.h"
|
|
|
|
#include <string>
|
2012-08-29 18:53:53 +00:00
|
|
|
#include <FreeImage.h>
|
|
|
|
#include <GLES/gl.h>
|
2012-08-02 01:43:55 +00:00
|
|
|
|
|
|
|
class GuiImage : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
2012-08-10 19:28:34 +00:00
|
|
|
GuiImage(int offsetX = 0, int offsetY = 0, std::string path = "", unsigned int maxWidth = 0, unsigned int maxHeight = 0, bool resizeExact = false);
|
2012-08-02 01:43:55 +00:00
|
|
|
~GuiImage();
|
|
|
|
|
|
|
|
void setImage(std::string path);
|
2012-08-13 18:32:53 +00:00
|
|
|
void setOrigin(float originX, float originY);
|
|
|
|
void setTiling(bool tile);
|
2012-08-02 01:43:55 +00:00
|
|
|
|
2012-08-09 21:19:07 +00:00
|
|
|
int getWidth();
|
|
|
|
int getHeight();
|
|
|
|
|
2012-08-02 01:43:55 +00:00
|
|
|
void onRender();
|
2012-08-09 21:19:07 +00:00
|
|
|
|
2012-09-04 16:45:16 +00:00
|
|
|
void onInit();
|
|
|
|
void onDeinit();
|
|
|
|
|
2012-08-02 01:43:55 +00:00
|
|
|
private:
|
2012-08-29 21:52:25 +00:00
|
|
|
unsigned int mResizeWidth, mResizeHeight;
|
2012-08-13 18:32:53 +00:00
|
|
|
float mOriginX, mOriginY;
|
2012-09-04 16:45:16 +00:00
|
|
|
bool mResizeExact, mTiled;
|
2012-08-09 21:19:07 +00:00
|
|
|
|
2012-08-10 02:17:48 +00:00
|
|
|
void loadImage(std::string path);
|
2012-08-29 21:52:25 +00:00
|
|
|
void drawImage(int x, int y);
|
2012-08-29 18:53:53 +00:00
|
|
|
void unloadImage();
|
2012-08-10 02:17:48 +00:00
|
|
|
|
|
|
|
std::string mPath;
|
2012-08-09 21:19:07 +00:00
|
|
|
|
|
|
|
int mOffsetX, mOffsetY;
|
2012-08-29 18:53:53 +00:00
|
|
|
unsigned int mWidth, mHeight;
|
|
|
|
|
|
|
|
GLuint mTextureID;
|
2012-08-02 01:43:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|