#ifndef __SDL_CORE_LABEL_HEADERS__ #define __SDL_CORE_LABEL_HEADERS__ #include #include "../../components/base/basicMutex.h" #include "../gui_sdl.h" #include "coreWidget.h" #define SDL_DEFAULT_TEXT_SIZE 256 #define SDL_DEFAULT_FONT_SIZE 12 typedef enum E_TEXT_ALIGN{ ALIGN_LEFT = 0, ALIGN_CENTER = 1, ALIGN_RIGHT } TEXT_ALIGN; class sdlLabel :public sdlCoreWidget{ private: char m_pText[SDL_DEFAULT_TEXT_SIZE]; TTF_Font * m_pFont; SDL_Texture * m_pFontTexture; SDL_Color m_sColor; int m_nMargin; int m_nLabelWidth; int m_nLabelHeight; sdlColorStyle m_sColorStyle; TEXT_ALIGN m_bTextAlign; protected: virtual void drawBefore(SDL_Renderer *pRenderer); public: explicit sdlLabel(CSTR text, int x, int y, int w, int h, sdlCoreWidget *wPtr=NULL, int fsize = SDL_DEFAULT_FONT_SIZE, CSTR fontName = NULL); virtual ~sdlLabel(); void setText( CSTR pStr ); void setFont( TTF_Font *tPtr ); void setColor( SDL_Color *tC ); void setColor(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha = 255 ); void setBlendMode(SDL_BlendMode blending ); void setAlpha( uint8_t alpha ); void setAlign(TEXT_ALIGN tA){ m_bTextAlign = tA; }; CSTR getText(void){ return m_pText; }; }; typedef std::vector vectorLabels; #endif