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 "../../components/base/basicMutex.h"
#include "../gui_sdl.h"
#include "coreWidget.h"
#define SDL_DEFAULT_TEXT_SIZE 1024
#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; SDL_Rect m_sRect; int m_nLabelWidth; int m_nLabelHeight; sdlColorStyle m_sColorStyle; TEXT_ALIGN m_bTextAlign; protected: virtual void draw(SDL_Renderer *pRenderer); public: explicit sdlLabel(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 red, Uint8 green, Uint8 blue ); void setBlendMode(SDL_BlendMode blending ); void setAlpha( Uint8 alpha ); void setAlign(TEXT_ALIGN tA){ m_bTextAlign = tA; }; CSTR getText(void){ return m_pText; };};
#endif
|