My Project
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ParaEngine::CGUIText Class Reference

This class represents a string inside a rectangular box in the screen coordinates Multiple Type_GUIText object with the same font are batched together at rendering time So it is important that you are not rendering them in the z-ordering. More...

#include <GUIText.h>

Inheritance diagram for ParaEngine::CGUIText:
ParaEngine::CGUIBase ParaEngine::IAttributeFields ParaEngine::IObjectDrag ParaEngine::CPaintDevice ParaEngine::IObject ParaEngine::CRefCounted

Public Member Functions

 ATTRIBUTE_DEFINE_CLASS (CGUIText)
 
virtual std::string ToScript (int option=0)
 
virtual void SetTextA (const char *szText)
 Set the text of this object. More...
 
virtual void SetText (const char16_t *wszText)
 Set the text of this object The control internally store everything in Unicode. More...
 
virtual int GetTextA (std::string &out)
 get the text of the control More...
 
virtual const char16_t * GetText ()
 get the text of the control The control internally store everything in Unicode. More...
 
virtual bool DoAutoSize ()
 try to automatically adjust the size of this object to contain all its content. More...
 
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 line. More...
 
void SetColor (DWORD color)
 
void SetTransparency (DWORD transparency)
 
void SetTextFormat (DWORD dwFormat)
 Set the text align and other text displaying formats. More...
 
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. More...
 
virtual void UpdateRects ()
 
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. More...
 
virtual HRESULT RenderInBatch (GUIState *pGUIState)
 this function is similar to render(), except that it assume that all states have been set properly
 
virtual void Clone (IObject *pobj) const
 Clone the object's contains to a pointer. More...
 
virtual IObjectClone () const
 Clone the object's contains and return a pointer to the newly created object. More...
 
virtual const ITypeGetType () const
 
virtual void SetTextScale (float fScale)
 set the text scale the text scale, default to 1.f. More...
 
virtual float GetTextScale ()
 get the text scale the text scale, default to 1.f. More...
 
bool IsAutoSize () const
 
void SetAutoSize (bool val)
 
- Public Member Functions inherited from ParaEngine::CGUIBase
virtual int GetAttributeClassID ()
 attribute class ID should be identical, unless one knows how overriding rules work. More...
 
virtual const char * GetAttributeClassName ()
 a static string, describing the attribute class object's name
 
virtual const char * GetAttributeClassDescription ()
 a static string, describing the attribute class object
 
virtual int InstallFields (CAttributeClass *pClass, bool bOverride)
 this class should be implemented if one wants to add new attribute. More...
 
virtual void * QueryObject (int nObjectType)
 convert to object of a given type. More...
 
virtual IAttributeFieldsGetChildAttributeObject (const std::string &sName)
 get attribute by child object. More...
 
virtual int GetChildAttributeObjectCount (int nColumnIndex=0)
 get the number of child objects (row count) in the given column. More...
 
virtual int GetChildAttributeColumnCount ()
 we support multi-dimensional child object. More...
 
virtual IAttributeFieldsGetChildAttributeObject (int nRowIndex, int nColumnIndex=0)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetName_s, const char **)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetName_s, const char *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetTextScale_s, float *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetTextScale_s, float)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetUseTextShadow_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetUseTextShadow_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetTextShadowQuality_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetTextShadowQuality_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetTextShadowColor_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetTextShadowColor_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetTextOffsetX_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetTextOffsetX_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetTextOffsetY_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetTextOffsetY_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetEnabled_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetAlwaysMouseOver_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetAlwaysMouseOver_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetDepth_s, float *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetDepth_s, float)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetLifeTime_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetLifeTime_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetX_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetX_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetY_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetY_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetWidth_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetWidth_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetHeight_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetHeight_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetRotation_s, float *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetRotation_s, float)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetScaling_s, Vector2 *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetScaling_s, Vector2)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetTranslation_s, Vector2 *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetTranslation_s, Vector2)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetRotOriginOffset_s, Vector2 *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetRotOriginOffset_s, Vector2)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetColorMask_s, DWORD *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetColorMask_s, DWORD)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetText_s, const char **)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetText_s, const char *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetSpacing_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetSpacing_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetPadding_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetPadding_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetZOrder_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetZOrder_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetCursor_s, const char **)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetCursor_s, const char *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetIndex_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetID_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetID_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetVisible_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetVisible_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetVisibleRecursive_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetHighlightStyle_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetHighlightStyle_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetAnimationStyle_s, int *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetAnimationStyle_s, int)
 
 ATTRIBUTE_METHOD1 (CGUIBase, IsPressed_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, IsClickThrough_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetClickThrough_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, CanHaveFocus_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetCanHaveFocus_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, IsDirty_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetDirty_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, IsOwnerDraw_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetOwnerDraw_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, IsUVWrappingEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, EnableUVWrapping_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, HasKeyFocus_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetUsePointTextureFiltering_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetUsePointTextureFiltering_s, bool)
 
 ATTRIBUTE_METHOD (CGUIBase, ApplyColorMask_s)
 
 ATTRIBUTE_METHOD (CGUIBase, ApplyAnim_s)
 
 ATTRIBUTE_METHOD1 (CGUIBase, IsSelfPaintEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, EnableSelfPaint_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, IsAutoClearBackground_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetAutoClearBackground_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, IsMouseCaptured_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetMouseCaptured_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, IsInputMethodEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetInputMethodEnabled_s, bool)
 
 ATTRIBUTE_METHOD1 (CGUIBase, GetCompositionPoint_s, Vector2 *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, SetCompositionPoint_s, Vector2)
 
 ATTRIBUTE_METHOD1 (CGUIBase, IsNonClientTestEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CGUIBase, EnableNonClientTest_s, bool)
 
virtual CPaintEnginepaintEngine () const
 Returns the paint engine. More...
 
void DeleteThis ()
 
CGUIContainerGetParent ()
 get the parent container
 
CGUIContainerGetPainterWindow ()
 get the parent container which has a self painted painter device. More...
 
bool IsPainterWindow ()
 if control contains its own painting device. More...
 
virtual int GetChildCount ()
 
virtual bool HasClickEvent ()
 return true, if this control can be clicked. More...
 
bool IsAncestorOf (CGUIBase *pChild)
 return true if current control is a parent of pChild. More...
 
bool HasParent (CGUIContainer *pParent)
 return true if pParent is a predecessor of this object. More...
 
void SetParent (CGUIContainer *parent)
 set the parent container
 
int GetIndex ()
 get the child index in the parent object. More...
 
bool GetEnabled ()
 whether control is enabled. More...
 
void SetEnabled (bool bEnabled)
 set whether the control is enabled or not
 
bool IsInputMethodEnabled () const
 
void SetInputMethodEnabled (bool val)
 
void SetNeedUpdate (bool bNeedUpdate=true)
 set need update
 
bool IsNeedUpdate (bool bRecursive=false)
 whether this control needs update. More...
 
void SetAlwaysMouseOver (bool bAlwaysMouseOver)
 set whether make mouse over to true as long as it contains the mouse point, no matter it has mouse focus or not. More...
 
bool GetAlwaysMouseOver ()
 get whether make mouse over to true as long as it contains the mouse point, no matter it has mouse focus or not. More...
 
virtual GUIBase_List_Type * GetChildren ()
 get pointer to children list. More...
 
virtual bool IsPressed ()
 whether it is pressed. More...
 
virtual void Reset ()
 Resets the objects states. More...
 
bool HasEvent (int etype)
 check if the object has any events More...
 
void ClearAllEvent ()
 Clear all events in the event buffer (m_objEvents), not including interpreted events such as m_pMouseEvent and m_pKeyEvent.
 
void ClearEvent (int etype)
 Clear specific kind of events in the event buffer (m_objEvents), including interpreted events such as m_pMouseEvent and m_pKeyEvent. More...
 
void BeginDepthTest (GUIState *pState=NULL)
 draw calls between BeginDepthTest() and EndDepthTest() are rendered with depth enabled, such as for relative to 3d objects. More...
 
void EndDepthTest (GUIState *pState=NULL)
 
virtual void GetAbsolutePosition (CGUIPosition *pOut, const CGUIPosition *pIn)
 Gets the absolute position of a CGUIPosition structure. More...
 
virtual void SetDepth (float fDepth)
 set the 3D depth. More...
 
virtual float GetDepth ()
 Get the 3D depth.
 
bool HasFocus () const
 
virtual bool HasKeyFocus ()
 whether this control has key focus. More...
 
virtual bool MsgProc (MSG *event)
 the procedure that handles all the events. More...
 
virtual void SetLifeTime (int lifttime)
 Set/get how many frames the control will survive. More...
 
virtual int GetLifeTime () const
 
- Public Member Functions inherited from ParaEngine::IAttributeFields
 ATTRIBUTE_METHOD1 (IAttributeFields, GetName_s, const char **)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, SetName_s, const char *)
 
 ATTRIBUTE_METHOD (IAttributeFields, PrintObject_s)
 
 ATTRIBUTE_METHOD (IAttributeFields, AddRef_s)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetRefCount_s, int *)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, SetTime_s, int)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetTime_s, int *)
 
 ATTRIBUTE_METHOD (IAttributeFields, Release_s)
 
virtual const std::string & GetIdentifier ()
 
virtual void SetIdentifier (const std::string &sID)
 
virtual bool IsModified ()
 whether some of the fields are modified.It is up to the implementation class to provide this functionality if necessary. More...
 
virtual void SetModified (bool bModified)
 set whether any field has been modified. More...
 
virtual bool ValidateFields ()
 validate all fields and return true if validation passed. More...
 
virtual string GetValidationMessage ()
 get the recent validation message due to the most recent call to ValidateFields()
 
virtual bool ResetField (int nFieldID)
 Reset the field to its initial or default value. More...
 
virtual bool InvokeEditor (int nFieldID, const std::string &sParameters)
 Invoke an (external) editor for a given field. More...
 
virtual bool AddChildAttributeObject (IAttributeFields *pChild, int nRowIndex=-1, int nColumnIndex=0)
 add child object. More...
 
virtual void * QueryObjectByName (const std::string &sObjectType)
 convert to object of a given type. More...
 
virtual int GetTime ()
 get the current local time in case it is animated in milli seconds frames. More...
 
virtual void SetTime (int nTime)
 
virtual CDynamicAttributeFieldGetDynamicField (const std::string &sName)
 Get a dynamic field with a given name. More...
 
virtual CDynamicAttributeFieldGetDynamicField (int nIndex)
 Get a dynamic field with a given index. More...
 
virtual const char * GetDynamicFieldNameByIndex (int nIndex)
 get field name by index
 
virtual int GetDynamicFieldCount ()
 how many dynamic field this object currently have. More...
 
virtual int SetDynamicField (const std::string &sName, const CVariable &value)
 set a dynamic field with a given name. More...
 
virtual int AddDynamicField (const std::string &sName, ATTRIBUTE_FIELDTYPE dwType)
 add dynamic field and return field index
 
virtual void RemoveAllDynamicFields ()
 remove all dynamic fields
 
virtual int SaveDynamicFieldsToString (std::string &output)
 save only text dynamic fields to fieldname = value text strings. More...
 
virtual int LoadDynamicFieldsFromString (const std::string &input)
 load only text dynamic fields from string More...
 
CAttributeClassGetAttributeClass ()
 get the main attribute class object. More...
 
void PrintObject ()
 print the content of this object to a text file at temp/doc/[ClassName].txt. More...
 
- Public Member Functions inherited from ParaEngine::IObject
virtual bool Equals (const IObject *obj) const
 Compare the object with another object. More...
 
virtual std::string ToString () const
 
WeakPtr_typeGetWeakReference ()
 get weak reference object. More...
 
virtual int ProcessObjectEvent (const ObjectEvent &event)
 this function is only used to backward compatibility of ParaObject:AddEvent() function. More...
 
- Public Member Functions inherited from ParaEngine::CRefCounted
void addref () const
 add reference count of the object. More...
 
bool delref () const
 decrease reference count of the object. More...
 
int GetRefCount () const
 get the reference count
 
virtual int Release ()
 
CRefCountedAddToAutoReleasePool ()
 addref and releases the ownership sometime soon automatically (usually at the end of the current frame). More...
 
- Public Member Functions inherited from ParaEngine::IObjectDrag
virtual void SetCandrag (bool bCandrag)=0
 
virtual bool GetCandrag () const =0
 
virtual void BeginDrag (int nEvent, int x, int y, int z)=0
 Default BeginDrag handle function. More...
 
virtual void EndDrag (int nEvent, int x, int y, int z)=0
 Default EndDrag handle function. More...
 
virtual BOOL IsOnObject (int x, int y, int z)=0
 Decide whether the input position is on this object This function is to help other function to decide if the currently pointing position is logically "on" the object. More...
 
virtual void SetPositionI (const CGUIPosition &position)
 restore to a given position. More...
 
- Public Member Functions inherited from ParaEngine::CPaintDevice
virtual int devType () const
 
bool paintingActive () const
 
int width () const
 
int height () const
 
int depth () const
 
virtual float GetUIScalingX () const
 
virtual float GetUIScalingY () const
 
virtual float GetViewportLeft () const
 
virtual float GetViewportTop () const
 

Static Public Member Functions

static void StaticInit ()
 
- Static Public Member Functions inherited from ParaEngine::CGUIBase
static void StaticInit ()
 Initialize the event mapping for the default CGUIBase class All its inheritances should have a StaticInit() for each kind of class.
 
- Static Public Member Functions inherited from ParaEngine::IAttributeFields
static HRESULT GetAttributeClassID_s (IAttributeFields *cls, int *p1)
 
static HRESULT GetAttributeClassName_s (IAttributeFields *cls, const char **p1)
 
static bool OpenWithDefaultEditor (const char *sFilename, bool bWaitOnReturn=false)
 Open a given file with the default registered editor in the game engine. More...
 
- Static Public Member Functions inherited from ParaEngine::IObjectDrag
static bool CancelDrag (STRUCT_DRAG_AND_DROP *pdrag)
 try cancel the drag operation. More...
 

Protected Attributes

std::u16string m_szText
 Text to output to screen.
 
bool m_bAutoSize
 
bool m_bNeedCalRect
 
float m_text_scale
 the text scale, default to 1.f. More...
 
- Protected Attributes inherited from ParaEngine::IObject
WeakPtr_type m_weak_reference
 
- Protected Attributes inherited from ParaEngine::CRefCounted
int m_refcount
 
- Protected Attributes inherited from ParaEngine::IObjectDrag
bool m_bCandrag
 
- Protected Attributes inherited from ParaEngine::CPaintDevice
int32 painters
 refcount
 

Static Protected Attributes

static const ITypem_type =NULL
 

Additional Inherited Members

- Public Types inherited from ParaEngine::CGUIBase
typedef ParaEngine::weak_ptr< IObject, CGUIBaseWeakPtr_type
 
- Public Types inherited from ParaEngine::IAttributeFields
typedef ParaEngine::weak_ptr< IObject, IAttributeFieldsWeakPtr_type
 
- Public Types inherited from ParaEngine::IObject
typedef ParaEngine::weak_ptr< IObjectWeakPtr_type
 
- Public Types inherited from ParaEngine::CPaintDevice
enum  PaintDeviceMetric { PdmWidth = 1, PdmHeight, PdmDepth }
 
- Static Public Attributes inherited from ParaEngine::IObjectDrag
static STRUCT_DRAG_AND_DROP DraggingObject
 This structure contains the information about the dragging object.
 
- Protected Member Functions inherited from ParaEngine::IAttributeFields
virtual CAttributeClassCreateAttributeClass ()
 initialize fields
 
virtual CDynamicAttributesSetGetDynamicAttributes (bool bCreateIfNotExist=false)
 
- Protected Member Functions inherited from ParaEngine::CPaintDevice
virtual int metric (PaintDeviceMetric metric) const
 
virtual void initPainter (CPainter *painter) const
 
virtual CPaintersharedPainter () const
 

Detailed Description

This class represents a string inside a rectangular box in the screen coordinates Multiple Type_GUIText object with the same font are batched together at rendering time So it is important that you are not rendering them in the z-ordering.

This class is suitable of rendering large blocks of text, or multiple short text with the same font. It's good practice to keep the text instance as few as possible, however, the Type_GUIText has been extremely optimized so that the only overhead of having many instances of this class is in the data structure keeping. There will be NO or very few texture swapping during batched rendering.

You can dynamically create and discard many instances of this object during frame rendering. Only simple data structure is recreated, not any D3D device objects.

Member Function Documentation

§ Clone() [1/2]

void CGUIText::Clone ( IObject obj) const
virtual

Clone the object's contains to a pointer.

The caller should allocate the memory and pass the pointer to this function.. Inheritance should implement this function void Clone(IObject*) and IObject* Clone() should have the same behavior In some cases, if you want to avoid Dead Reference( one object is being referred to by many objects and you can't update all the references). It is possible to use this function to replace the contains at a given pointer. But this may result in memory leak if you do not implement this function carefully or misuse it.

Reimplemented from ParaEngine::IObject.

§ Clone() [2/2]

IObject * CGUIText::Clone ( ) const
virtual

Clone the object's contains and return a pointer to the newly created object.

The caller should free the memory of the return object. Inheritance should implement this function void Clone(IObject*) and IObject* Clone() should have the same behavior

Reimplemented from ParaEngine::IObject.

§ DoAutoSize()

bool CGUIText::DoAutoSize ( )
virtual

try to automatically adjust the size of this object to contain all its content.

§ GetText()

const char16_t * ParaEngine::CGUIText::GetText ( )
virtual

get the text of the control The control internally store everything in Unicode.

So it is faster this version than the ascii version.

Returns

Reimplemented from ParaEngine::CGUIBase.

§ GetTextA()

int CGUIText::GetTextA ( std::string &  out)
virtual

get the text of the control

Parameters
szText[out] buffer to receive the text
nLengthsize of the input buffer
Returns
return the number of bytes written to the buffer. If nLength is 0, this function returns the total number of characters of the text

Reimplemented from ParaEngine::CGUIBase.

§ GetTextLineSize()

void CGUIText::GetTextLineSize ( int *  width,
int *  height 
)

get the text line size in pixels, supposing the current font and text will be rendered in a single line.

§ GetTextScale()

float CGUIText::GetTextScale ( )
virtual

get the text scale the text scale, default to 1.f.

if we have text scale between 1.1-1.5 and shadow to true, the text will have an alpha border. This is great for rendering text in 3d scene with a boarder using just normal system font.

§ InitObject()

void CGUIText::InitObject ( const char *  strObjectName,
const char *  alignment,
int  x,
int  y,
int  width,
int  height 
)
virtual

desc: pFontEntity [in]: Pointer to a Font Asset object pString [in]: Pointer to a string to draw.

pPos [in]: Pointer to a FUI_POSITION structure that contains the rectangle, in logical coordinates, in which the text is to be formatted. Format [in]: Specifies the method of formatting the text. It can be any combination of the following values. DT_BOTTOM Justifies the text to the bottom of the rectangle. This value must be combined with DT_SINGLELINE. DT_CALCRECT Determines the width and height of the rectangle. If there are multiple lines of text, ID3DXFont::DrawText uses the width of the rectangle pointed to by the pRect parameter and extends the base of the rectangle to bound the last line of text. If there is only one line of text, ID3DXFont::DrawText modifies the right side of the rectangle so that it bounds the last character in the line. In either case, ID3DXFont::DrawText returns the height of the formatted text but does not draw the text. DT_CENTER Centers text horizontally in the rectangle. DT_EXPANDTABS Expands tab characters. The default number of characters per tab is eight. DT_LEFT Aligns text to the left. DT_NOCLIP Draws without clipping. ID3DXFont::DrawText is somewhat faster when DT_NOCLIP is used. DT_RIGHT Aligns text to the right. DT_RTLREADING Displays text in right-to-left reading order for bi-directional text when a Hebrew or Arabic font is selected. The default reading order for all text is left-to-right. DT_SINGLELINE Displays text on a single line only. Carriage returns and line feeds do not break the line. DT_TOP Top-justifies text. DT_VCENTER Centers text vertically (single line only). DT_WORDBREAK Breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the pRect parameter. A carriage return/line feed sequence also breaks the line. Color [in]: Color of the text. For more information, see Color.

§ Render()

HRESULT CGUIText::Render ( GUIState pGUIState,
float  fElapsedTime 
)
virtual

desc: if pGUIState->bIsBatchRender is false, then Add to batch rendering list otherwise, render the text with sprite.

It is up to the caller to ensure that both the font and the sprite object used to render the text are valid.

§ SetText()

void CGUIText::SetText ( const char16_t *  wszText)
virtual

Set the text of this object The control internally store everything in Unicode.

Parameters
wszText

Reimplemented from ParaEngine::CGUIBase.

§ SetTextA()

void CGUIText::SetTextA ( const char *  szText)
virtual

Set the text of this object.

Parameters
szText

Reimplemented from ParaEngine::CGUIBase.

§ SetTextFormat()

void CGUIText::SetTextFormat ( DWORD  dwFormat)

Set the text align and other text displaying formats.

Parameters
dwFormatthe new format. It can be any combination of the following values. DT_BOTTOM (0x00000008) Justifies the text to the bottom of the rectangle. This value must be combined with DT_SINGLELINE. DT_CALCRECT (0x00000400) Determines the width and height of the rectangle. If there are multiple lines of text, ID3DXFont::DrawText uses the width of the rectangle pointed to by the pRect parameter and extends the base of the rectangle to bound the last line of text. If there is only one line of text, ID3DXFont::DrawText modifies the right side of the rectangle so that it bounds the last character in the line. In either case, ID3DXFont::DrawText returns the height of the formatted text but does not draw the text. DT_CENTER (0x00000001) Centers text horizontally in the rectangle. DT_EXPANDTABS (0x00000040) Expands tab characters. The default number of characters per tab is eight. DT_LEFT (0x00000000) Aligns text to the left. DT_NOCLIP (0x00000100) Draws without clipping. ID3DXFont::DrawText is somewhat faster when DT_NOCLIP is used. DT_RIGHT (0x00000002) Aligns text to the right. DT_RTLREADING Displays text in right-to-left reading order for bi-directional text when a Hebrew or Arabic font is selected. The default reading order for all text is left-to-right. DT_SINGLELINE (0x00000020) Displays text on a single line only. Carriage returns and line feeds do not break the line. DT_TOP (0x00000000) Top-justifies text. DT_VCENTER (0x00000004) Centers text vertically (single line only). DT_WORDBREAK (0x00000010) Breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the pRect parameter. A carriage return/line feed sequence also breaks the line.

§ SetTextScale()

void CGUIText::SetTextScale ( float  fScale)
virtual

set the text scale the text scale, default to 1.f.

if we have text scale between 1.1-1.5 and shadow to true, the text will have an alpha border. This is great for rendering text in 3d scene with a boarder using just normal system font.

Member Data Documentation

§ m_text_scale

float ParaEngine::CGUIText::m_text_scale
protected

the text scale, default to 1.f.

if we have text scale between 1.1-1.5 and shadow to true, the text will have an alpha border. This is great for rendering text in 3d scene with a boarder using just normal system font.


The documentation for this class was generated from the following files: