Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
W3DDisplayString Class Reference

#include <W3DDisplayString.h>

Inherits DisplayString.

Public Member Functions

 W3DDisplayString (void)
 
void notifyTextChanged (void)
 called when text contents change
 
void draw (Int x, Int y, Color color, Color dropColor)
 render text
 
void draw (Int x, Int y, Color color, Color dropColor, Int xDrop, Int yDrop)
 render text with the drop shadow being at the offsets passed in
 
void getSize (Int *width, Int *height)
 get render size
 
Int getWidth (Int charPos=-1)
 
void setWordWrap (Int wordWrap)
 set the word wrap width
 
void setWordWrapCentered (Bool isCentered)
 If this is set to true, the text on a new line is centered.
 
void setFont (GameFont *font)
 set a font for display
 
void setUseHotkey (Bool useHotkey, Color hotKeyColor=0xffffffff)
 
void setClipRegion (IRegion2D *region)
 clip text in this region
 
- Public Member Functions inherited from DisplayString
 DisplayString (void)
 
virtual void setText (UnicodeString text)
 set text for this string
 
virtual UnicodeString getText (void)
 get text for this string
 
virtual Int getTextLength (void)
 return number of chars in string
 
virtual void reset (void)
 reset all contents of string
 
virtual GameFontgetFont (void)
 return font in string
 
virtual void removeLastChar (void)
 remove the last character
 
virtual void appendChar (WideChar c)
 append character to end
 
DisplayStringnext (void)
 return next string
 
- Public Member Functions inherited from MemoryPoolObject
void deleteInstance ()
 

Public Attributes

friend W3DDisplayStringManager
 
- Public Attributes inherited from DisplayString
friend DisplayStringManager
 

Protected Member Functions

void checkForChangedTextData (void)
 
void usingResources (UnsignedInt frame)
 
void computeExtents (void)
 compupte text width and height
 
- Protected Member Functions inherited from MemoryPoolObject
virtual ~MemoryPoolObject ()
 
void * operator new (size_t s)
 
void operator delete (void *p)
 
virtual MemoryPoolgetObjectMemoryPool ()=0
 

Protected Attributes

Render2DSentenceClass m_textRenderer
 for drawing text
 
Render2DSentenceClass m_textRendererHotKey
 for drawing text
 
Bool m_textChanged
 when contents of string change this is TRUE
 
Bool m_fontChanged
 when font has chagned this is TRUE
 
UnicodeString m_hotkey
 holds the current hotkey marker.
 
Bool m_useHotKey
 
ICoord2D m_hotKeyPos
 
Color m_hotKeyColor
 
ICoord2D m_textPos
 current text pos set in text renderer
 
Color m_currTextColor
 current color used in text renderer
 
Color m_currDropColor
 current color used for shadow in text
 
ICoord2D m_size
 (width,height) size of rendered text
 
IRegion2D m_clipRegion
 the clipping region for text
 
UnsignedInt m_lastResourceFrame
 last frame resources were used on
 
- Protected Attributes inherited from DisplayString
UnicodeString m_textString
 
GameFontm_font
 font to display this string with
 
DisplayStringm_next
 for the display string factory list ONLY
 
DisplayStringm_prev
 for the display string factory list ONLY
 

Detailed Description

Definition at line 68 of file W3DDisplayString.h.

Constructor & Destructor Documentation

◆ W3DDisplayString()

W3DDisplayString::W3DDisplayString ( void )

Definition at line 82 of file W3DDisplayString.cpp.

Member Function Documentation

◆ checkForChangedTextData()

void W3DDisplayString::checkForChangedTextData ( void )
protected

called when we need to update our render sentence and update extents

◆ computeExtents()

void W3DDisplayString::computeExtents ( void )
protected

compupte text width and height

Update the width and height of our string

Definition at line 352 of file W3DDisplayString.cpp.

◆ draw() [1/2]

void W3DDisplayString::draw ( Int x,
Int y,
Color color,
Color dropColor )
virtual

render text

Draw the text at the specified location in in the specified colors in the parameters. Since we keep an instance of the rendered text texture around, this is the time to check to see if any of our properties have changed since the last render, like color, or position, or content. If they have, we need to rebuild the sentence texture for rendering

Implements DisplayString.

Definition at line 160 of file W3DDisplayString.cpp.

◆ draw() [2/2]

void W3DDisplayString::draw ( Int x,
Int y,
Color color,
Color dropColor,
Int xDrop,
Int yDrop )
virtual

render text with the drop shadow being at the offsets passed in

Implements DisplayString.

Definition at line 164 of file W3DDisplayString.cpp.

◆ getSize()

void W3DDisplayString::getSize ( Int * width,
Int * height )
virtual

get render size

Get the render size width and height of the string in this instance with the font associated with it

Implements DisplayString.

Definition at line 247 of file W3DDisplayString.cpp.

◆ getWidth()

Int W3DDisplayString::getWidth ( Int charPos = -1)
virtual

Get text with up to charPos characters, -1 = all characters

Implements DisplayString.

Definition at line 262 of file W3DDisplayString.cpp.

◆ notifyTextChanged()

void W3DDisplayString::notifyTextChanged ( void )
virtual

called when text contents change

This method automatically gets called from some methods in the display class so that we can write our own code here to to appropriate things on the changing of string data

Reimplemented from DisplayString.

Definition at line 118 of file W3DDisplayString.cpp.

◆ setClipRegion()

void W3DDisplayString::setClipRegion ( IRegion2D * region)
virtual

clip text in this region

Set the clipping region for the text

Reimplemented from DisplayString.

Definition at line 320 of file W3DDisplayString.cpp.

◆ setFont()

void W3DDisplayString::setFont ( GameFont * font)
virtual

set a font for display

Set the font for this particular display string

Reimplemented from DisplayString.

Definition at line 291 of file W3DDisplayString.cpp.

◆ setUseHotkey()

void W3DDisplayString::setUseHotkey ( Bool useHotkey,
Color hotKeyColor = 0xffffffff )
virtual

Implements DisplayString.

Definition at line 385 of file W3DDisplayString.cpp.

◆ setWordWrap()

void W3DDisplayString::setWordWrap ( Int wordWrap)
virtual

set the word wrap width

Set the wordwrap of the m_textRenderer

Implements DisplayString.

Definition at line 378 of file W3DDisplayString.cpp.

◆ setWordWrapCentered()

void W3DDisplayString::setWordWrapCentered ( Bool isCentered)
virtual

If this is set to true, the text on a new line is centered.

Set the whether or not we want to center each new line in a text string

Implements DisplayString.

Definition at line 396 of file W3DDisplayString.cpp.

◆ usingResources()

void W3DDisplayString::usingResources ( UnsignedInt frame)
inlineprotected

call this whenever display resources are in use

Definition at line 119 of file W3DDisplayString.h.

Member Data Documentation

◆ m_clipRegion

IRegion2D W3DDisplayString::m_clipRegion
protected

the clipping region for text

Definition at line 111 of file W3DDisplayString.h.

◆ m_currDropColor

Color W3DDisplayString::m_currDropColor
protected

current color used for shadow in text

Definition at line 109 of file W3DDisplayString.h.

◆ m_currTextColor

Color W3DDisplayString::m_currTextColor
protected

current color used in text renderer

Definition at line 108 of file W3DDisplayString.h.

◆ m_fontChanged

Bool W3DDisplayString::m_fontChanged
protected

when font has chagned this is TRUE

Definition at line 102 of file W3DDisplayString.h.

◆ m_hotkey

UnicodeString W3DDisplayString::m_hotkey
protected

holds the current hotkey marker.

Definition at line 103 of file W3DDisplayString.h.

◆ m_hotKeyColor

Color W3DDisplayString::m_hotKeyColor
protected

Definition at line 106 of file W3DDisplayString.h.

◆ m_hotKeyPos

ICoord2D W3DDisplayString::m_hotKeyPos
protected

Definition at line 105 of file W3DDisplayString.h.

◆ m_lastResourceFrame

UnsignedInt W3DDisplayString::m_lastResourceFrame
protected

last frame resources were used on

Definition at line 112 of file W3DDisplayString.h.

◆ m_size

ICoord2D W3DDisplayString::m_size
protected

(width,height) size of rendered text

Definition at line 110 of file W3DDisplayString.h.

◆ m_textChanged

Bool W3DDisplayString::m_textChanged
protected

when contents of string change this is TRUE

Definition at line 101 of file W3DDisplayString.h.

◆ m_textPos

ICoord2D W3DDisplayString::m_textPos
protected

current text pos set in text renderer

Definition at line 107 of file W3DDisplayString.h.

◆ m_textRenderer

Render2DSentenceClass W3DDisplayString::m_textRenderer
protected

for drawing text

Definition at line 99 of file W3DDisplayString.h.

◆ m_textRendererHotKey

Render2DSentenceClass W3DDisplayString::m_textRendererHotKey
protected

for drawing text

Definition at line 100 of file W3DDisplayString.h.

◆ m_useHotKey

Bool W3DDisplayString::m_useHotKey
protected

Definition at line 104 of file W3DDisplayString.h.

◆ W3DDisplayStringManager

friend W3DDisplayString::W3DDisplayStringManager

Definition at line 75 of file W3DDisplayString.h.


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