2012-08-02 01:43:55 +00:00
|
|
|
#ifndef _GUIIMAGE_H_
|
|
|
|
#define _GUIIMAGE_H_
|
|
|
|
|
|
|
|
#include "../GuiComponent.h"
|
|
|
|
#include <SDL/SDL.h>
|
2012-08-09 21:19:07 +00:00
|
|
|
#include <SDL/SDL_thread.h>
|
2012-08-02 01:43:55 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
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);
|
|
|
|
void setAlpha(bool useAlpha);
|
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-08-02 01:43:55 +00:00
|
|
|
private:
|
2012-08-09 21:19:07 +00:00
|
|
|
int mMaxWidth, mMaxHeight;
|
2012-08-13 18:32:53 +00:00
|
|
|
float mOriginX, mOriginY;
|
|
|
|
bool mResizeExact, mTiled, mUseAlpha;
|
2012-08-09 21:19:07 +00:00
|
|
|
|
2012-08-10 02:17:48 +00:00
|
|
|
void loadImage(std::string path);
|
2012-08-13 18:32:53 +00:00
|
|
|
void resizeSurface(SDL_Surface** surfRef);
|
|
|
|
void updateRect();
|
2012-08-10 02:17:48 +00:00
|
|
|
|
|
|
|
std::string mPath;
|
2012-08-09 21:19:07 +00:00
|
|
|
|
2012-08-02 01:43:55 +00:00
|
|
|
SDL_Surface* mSurface;
|
2012-08-09 21:19:07 +00:00
|
|
|
int mOffsetX, mOffsetY;
|
2012-08-02 01:43:55 +00:00
|
|
|
SDL_Rect mRect;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|