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.

60 lines
1.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __SDL_CORE_ELEMENT_HEADER__
  2. #define __SDL_CORE_ELEMENT_HEADER__
  3. #include <SDL.h>
  4. #include <vector>
  5. typedef enum E_GEL_ELEMENT_TYPE {
  6. GEL_NONE = 0,
  7. GEL_SPRITE = 1,
  8. GEL_BUTTON = 2,
  9. GEL_PANEL = 3,
  10. GEL_SIMPLE_PANEL = 4,
  11. GEL_SIMPLE_BUTTON = 5,
  12. GEL_MAIN_MENU_ITEM = 6
  13. } GEL_ELEMENT_TYPE;
  14. typedef struct S_TEXTURE_HEAP_ITEM {
  15. char key[33];
  16. SDL_Rect geopmetry;
  17. SDL_Texture * texture;
  18. }TEXTURE_HEAP_ITEM;
  19. typedef std::vector<TEXTURE_HEAP_ITEM*> TEXTURE_HEAP;
  20. void DestroyTextureHeapItem(TEXTURE_HEAP_ITEM* &ptr);
  21. class classGUI_SDL;
  22. class sdlDecoration;
  23. class sdlGraphicElement {
  24. protected:
  25. GEL_ELEMENT_TYPE m_eType;
  26. classGUI_SDL * m_pGUI;
  27. uint32_t m_nVisualStage;
  28. bool m_bUpdateReq;
  29. bool m_bInitComplete;
  30. bool m_bHidden;
  31. bool m_pEnabled;
  32. virtual void drawBefore(SDL_Renderer* tPtr) {};
  33. virtual void drawAfter(SDL_Renderer* tPtr) {};
  34. virtual bool create( void ) { return m_bInitComplete; };
  35. virtual void dispatch(SDL_Event* pEvt){};
  36. public:
  37. SDL_Rect m_sGeometry;
  38. explicit sdlGraphicElement(int x, int y, int w, int h);
  39. explicit sdlGraphicElement(SDL_Rect &R);
  40. explicit sdlGraphicElement(SDL_Rect *R);
  41. virtual ~sdlGraphicElement();
  42. void setGeometry(int x, int y, int w, int h);
  43. void setGeometry(SDL_Rect& R);
  44. void setGeometry(SDL_Rect* R);
  45. void moveTo(int x, int y);
  46. void setVisibility(bool val);
  47. void setType(GEL_ELEMENT_TYPE a) { m_eType = a; };
  48. virtual void render(SDL_Renderer* tPtr) {};
  49. friend classGUI_SDL;
  50. friend sdlDecoration;
  51. };
  52. typedef std::vector< sdlGraphicElement* > vectorGEL;
  53. #endif