My Project
GUIText.h
1 #pragma once
2 #include "GUIBase.h"
3 
4 namespace ParaEngine
5 {
6 struct SpriteFontEntity;
7 struct AssetEntity;
21 class CGUIText : public CGUIBase
22 {
23 public:
24  static void StaticInit();
25  CGUIText(void);
26  virtual ~CGUIText(void);
27 
28  ATTRIBUTE_DEFINE_CLASS(CGUIText);
29 
30 public:
31  virtual std::string ToScript(int option=0);
36  virtual void SetTextA(const char* szText);
42  virtual void SetText(const char16_t* wszText);
49  virtual int GetTextA(std::string& out);
55  virtual const char16_t* GetText();
56 
58  virtual bool DoAutoSize();
59 
61  void GetTextLineSize(int* width, int* height);
62 
63  void SetColor(DWORD color);
64  void SetTransparency(DWORD transparency);
65 
94  void SetTextFormat(DWORD dwFormat);
95  //bool MsgProc(CGUIEvent *event=NULL);
96  virtual void InitObject(const char * strObjectName, const char * alignment, int x, int y, int width, int height);
97  virtual void UpdateRects();
98  virtual HRESULT Render(GUIState* pGUIState ,float fElapsedTime);
100  virtual HRESULT RenderInBatch(GUIState* pGUIState);
101 
102  virtual void Clone(IObject* pobj)const;
103  virtual IObject* Clone()const;
104  virtual const IType* GetType()const{return m_type;}
105 
108  virtual void SetTextScale(float fScale);
111  virtual float GetTextScale();
112 
113  bool IsAutoSize() const;
114  void SetAutoSize(bool val);
115 protected:
116  static const IType* m_type;
118  std::u16string m_szText;
119  bool m_bAutoSize;
120 
121  bool m_bNeedCalRect;
125 };
126 }
std::u16string m_szText
Text to output to screen.
Definition: GUIText.h:118
IType is for type information and validating It contains type information of an object.
Definition: Type.h:75
virtual void SetTextScale(float fScale)
set the text scale the text scale, default to 1.f.
Definition: GUIText.cpp:168
different physics engine has different winding order.
Definition: EventBinding.h:32
virtual IObject * Clone() const
Clone the object's contains and return a pointer to the newly created object.
Definition: GUIText.cpp:53
virtual void InitObject(const char *strObjectName, const char *alignment, int x, int y, int width, int height)
desc: pFontEntity [in]: Pointer to a Font Asset object pString [in]: Pointer to a string to draw...
Definition: GUIText.cpp:229
virtual float GetTextScale()
get the text scale the text scale, default to 1.f.
Definition: GUIText.cpp:173
This class represents a string inside a rectangular box in the screen coordinates Multiple Type_GUITe...
Definition: GUIText.h:21
base object for all 2D GUI objects (1) 2D GUI object are not tested against view frustum, instead it is controlled by visibility tag automatically or through user input.
Definition: GUIBase.h:54
base class for object, such as CBaseObject, IAttributeObject, GUI object.
Definition: PERef.h:287
virtual const char16_t * GetText()
get the text of the control The control internally store everything in Unicode.
Definition: GUIText.cpp:492
It's used as parameter to Render method of each GUI object.
Definition: GUIState.h:16
virtual bool DoAutoSize()
try to automatically adjust the size of this object to contain all its content.
Definition: GUIText.cpp:303
virtual void SetText(const char16_t *wszText)
Set the text of this object The control internally store everything in Unicode.
Definition: GUIText.cpp:256
void GetTextLineSize(int *width, int *height)
get the text line size in pixels, supposing the current font and text will be rendered in a single li...
Definition: GUIText.cpp:273
void SetTextFormat(DWORD dwFormat)
Set the text align and other text displaying formats.
Definition: GUIText.cpp:268
virtual HRESULT Render(GUIState *pGUIState, float fElapsedTime)
desc: if pGUIState->bIsBatchRender is false, then Add to batch rendering list otherwise, render the text with sprite.
Definition: GUIText.cpp:343
virtual HRESULT RenderInBatch(GUIState *pGUIState)
this function is similar to render(), except that it assume that all states have been set properly ...
Definition: GUIText.cpp:391
virtual void SetTextA(const char *szText)
Set the text of this object.
Definition: GUIText.cpp:249
float m_text_scale
the text scale, default to 1.f.
Definition: GUIText.h:124
virtual int GetTextA(std::string &out)
get the text of the control
Definition: GUIText.cpp:263