You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.6 KiB
61 lines
1.6 KiB
#ifndef __SDL_CORE_ELEMENT_HEADER__
|
|
#define __SDL_CORE_ELEMENT_HEADER__
|
|
|
|
#include <SDL.h>
|
|
#include <vector>
|
|
|
|
typedef enum E_GEL_ELEMENT_TYPE {
|
|
GEL_NONE = 0,
|
|
GEL_SPRITE = 1,
|
|
GEL_BUTTON = 2,
|
|
GEL_PANEL = 3,
|
|
GEL_SIMPLE_PANEL = 4,
|
|
GEL_SIMPLE_BUTTON = 5,
|
|
GEL_MAIN_MENU_ITEM = 6
|
|
} GEL_ELEMENT_TYPE;
|
|
|
|
typedef struct S_TEXTURE_HEAP_ITEM {
|
|
char key[33];
|
|
SDL_Rect geopmetry;
|
|
SDL_Texture * texture;
|
|
}TEXTURE_HEAP_ITEM;
|
|
|
|
typedef std::vector<TEXTURE_HEAP_ITEM*> TEXTURE_HEAP;
|
|
|
|
void DestroyTextureHeapItem(TEXTURE_HEAP_ITEM* &ptr);
|
|
|
|
class classGUI_SDL;
|
|
class sdlDecoration;
|
|
class sdlGraphicElement {
|
|
protected:
|
|
GEL_ELEMENT_TYPE m_eType;
|
|
classGUI_SDL * m_pGUI;
|
|
uint32_t m_nVisualStage;
|
|
bool m_bUpdateReq;
|
|
bool m_bInitComplete;
|
|
bool m_bHidden;
|
|
bool m_pEnabled;
|
|
virtual void drawBefore(SDL_Renderer* tPtr) {};
|
|
virtual void drawAfter(SDL_Renderer* tPtr) {};
|
|
virtual bool create( void ) { return m_bInitComplete; };
|
|
virtual void dispatch(SDL_Event* pEvt){};
|
|
public:
|
|
SDL_Rect m_sGeometry;
|
|
explicit sdlGraphicElement(int x, int y, int w, int h);
|
|
explicit sdlGraphicElement(SDL_Rect &R);
|
|
explicit sdlGraphicElement(SDL_Rect *R);
|
|
virtual ~sdlGraphicElement();
|
|
void setGeometry(int x, int y, int w, int h);
|
|
void setGeometry(SDL_Rect& R);
|
|
void setGeometry(SDL_Rect* R);
|
|
void moveTo(int x, int y);
|
|
void setVisibility(bool val);
|
|
void setType(GEL_ELEMENT_TYPE a) { m_eType = a; };
|
|
virtual void render(SDL_Renderer* tPtr) {};
|
|
friend classGUI_SDL;
|
|
friend sdlDecoration;
|
|
};
|
|
|
|
typedef std::vector< sdlGraphicElement* > vectorGEL;
|
|
|
|
#endif
|