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.
|
|
#ifndef __SDL_CORE_LABEL_HEADERS__
#define __SDL_CORE_LABEL_HEADERS__
#include <vector>
#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<sdlLabel*> vectorLabels;
#endif
|