Cavestory Mod API
Public Member Functions | Public Attributes | Protected Attributes | List of all members
CenteredTextInfo Class Reference

Draw centered text. More...

#include <CSMAPI_types.h>

Inheritance diagram for CenteredTextInfo:
GuiBase

Public Member Functions

 CenteredTextInfo ()
 Default constructor.
 
virtual const char * getClassName ()
 Get this class' name. More...
 
virtual void setSelected (int value)
 Set this GUI element as selected or not. More...
 
virtual void setHovered (int value)
 Set this GUI element as hovered over or not. More...
 
virtual bool isSelected ()
 Check selection status. More...
 
virtual bool isHovered ()
 Check hover status. More...
 
virtual bool isHoverable ()
 Check hoverability status. More...
 
virtual void setFont (FontObject *pFont)
 Set this element's font. More...
 
FontObject * getFont ()
 Get this element's font. More...
 
int getLineCount ()
 Get new line count. More...
 
int getLineLength (int index)
 Check line length. More...
 
void getLineText (int index, char *buffer, int buffer_len)
 Fetch line text. More...
 
GUI_POINT getLineSize (int index)
 Fetch line graphical size. More...
 
void setText (const char *text)
 Set the text of this element. More...
 
const char * getText ()
 Get this object's text. More...
 
virtual int process (GUI_POINT mouse)
 Process mouse input for this element. More...
 
virtual void calculate ()
 Re-calculate this element's data. More...
 
virtual void render ()
 Render this element.
 
- Public Member Functions inherited from GuiBase
 GuiBase ()
 Default constructor.
 
virtual ~GuiBase ()
 Default deconstructor.
 
virtual int getSelectableCount ()
 Get the selectable number of elements in this element. More...
 
virtual int getHoverableCount ()
 Get the number of elements that can be hovered over in this element. More...
 
virtual GuiBasegetHoverable (int index)
 Get a hoverable sub-element. More...
 
virtual GuiBasegetSelectable (int index)
 Get a selectable sub-element. More...
 
virtual bool SelectOnMouseUp ()
 Select on mouse up. More...
 
virtual int processKeys ()
 Process key input for this element. More...
 
virtual void importantRender ()
 Render the important bits of this element. More...
 
virtual int getMagnification ()
 
 GuiBase (const GuiBase &)=delete
 
GuiBaseoperator= (const GuiBase &)=delete
 
 GuiBase (GuiBase &&)=delete
 
GuiBaseoperator= (GuiBase &&)=delete
 

Public Attributes

GUI_COLOR mTextColor
 The text color.
 
char * mNewLines [8]
 A list of pointers to the new lines in mText. More...
 
int mNewLineCount
 The list size of mNewLines. More...
 
bool mCenterVertical
 Vertical center align.
 
bool mCenterHorizontal
 Vertical center align.
 
- Public Attributes inherited from GuiBase
GuiBasepNext
 
GuiBasepPrev
 
OnValueChangeCallbackFunc OnValueChange
 Called in specific GuiBase children classes to indicate that a value has been changed.
 
OnValidateChangeCallbackFunc OnValidateChange
 Called in specific GuiBase children classes to indicate that a value has been changed.
 
GUI_RECT rect
 The display rect this GUI element will use.
 
void * userData
 Custom user data.
 
void * userData2
 Custom user data.
 
unsigned int customMagnification
 The magnification to display this element at.
 
OnHoverChangeCallbackFunc OnHoverChange
 Called in specific GuiBase children classes to indicate that the GUI element is being hovered over.
 
bool has_special_mouse_processing
 Has special mouse processing.
 
GUI_RECT hotspot_rect
 The special hotspot rect.
 
bool has_special_hotspot_rect
 Has special hotspot rect; If true, 'process' will be called everytime the mouse is inside of 'hotspot_rect' instead of 'rect'.
 

Protected Attributes

unsigned int mTextColor_RGB
 Text color RGB.
 
FontObject * mFont
 Font for this element.
 
GUI_POINT mMinimumSize
 Minimum size for this point.
 
char mText [256]
 The text that this element should display.
 
GUI_POINT mTextPoint
 Text point for this element.
 
GUI_POINT mTextSize
 The size of the text.
 

Additional Inherited Members

- Public Types inherited from GuiBase
enum  ProcessReturnType {
  PRT_DIRTY = 0b000001 , PRT_IGNORE_MOUSE = 0b000010 , PRT_IGNORE_KEYS = 0b000100 , PRT_SELECTED = 0b001000 ,
  PRT_DISABLE_MOUSE_ON_MOVE = 0b010000 , PRT_CHANGED = 0b100000
}
 Return flags for GuiBase::process and GuiBase::processKeys. More...
 
typedef void(* OnHoverChangeCallbackFunc) (GuiBase *, int value)
 Hover callback.
 
typedef void(* OnValueChangeCallbackFunc) (GuiBase *, const char *&newValue)
 Value change callback.
 
typedef bool(* OnValidateChangeCallbackFunc) (GuiBase *, const char *oldValue, char *newValue)
 Validate change callback.
 
- Static Public Attributes inherited from GuiBase
static unsigned int defaultCustomMagnification
 
static GuiBasegFirst
 
- Protected Member Functions inherited from GuiBase
void Link ()
 Link ourselves to the global GUI element linkage.
 
void Unlink ()
 Unlink ourselves from the global GUI element linkage.
 

Detailed Description

Draw centered text.

Examples
WelcomeMode.cpp.

Member Function Documentation

◆ calculate()

virtual void CenteredTextInfo::calculate ( )
virtual

Re-calculate this element's data.

Warning
You should ALWAYS call this at least once BEFORE you call render()!

Implements GuiBase.

◆ getClassName()

virtual const char* CenteredTextInfo::getClassName ( )
inlinevirtual

Get this class' name.

Returns
Should return the name of this class.

Reimplemented from GuiBase.

◆ getFont()

FontObject* CenteredTextInfo::getFont ( )
inlinevirtual

Get this element's font.

Returns
Returns the font.

Reimplemented from GuiBase.

◆ getLineCount()

int CenteredTextInfo::getLineCount ( )

Get new line count.

Returns
Returns new line count

◆ getLineLength()

int CenteredTextInfo::getLineLength ( int  index)

Check line length.

Parameters
indexThe index of the line of text
Returns
Returns the length of a line of text

◆ getLineSize()

GUI_POINT CenteredTextInfo::getLineSize ( int  index)

Fetch line graphical size.

Parameters
indexThe index of the line of text
Returns
Returns calculated size of the text using this element's font.

◆ getLineText()

void CenteredTextInfo::getLineText ( int  index,
char *  buffer,
int  buffer_len 
)

Fetch line text.

Parameters
indexThe index of the line of text
bufferThe buffer that will hold the line.
buffer_lenSize of buffer

◆ getText()

const char* CenteredTextInfo::getText ( )
inline

Get this object's text.

Returns
Returns this element's text.

◆ isHoverable()

virtual bool CenteredTextInfo::isHoverable ( )
virtual

Check hoverability status.

Returns
Returns true if this element can be hovered over.

Implements GuiBase.

◆ isHovered()

virtual bool CenteredTextInfo::isHovered ( )
virtual

Check hover status.

Returns
Returns true if this element is being hovered over.

Implements GuiBase.

◆ isSelected()

virtual bool CenteredTextInfo::isSelected ( )
virtual

Check selection status.

Returns
Returns true if this element is selected.

Implements GuiBase.

◆ process()

virtual int CenteredTextInfo::process ( GUI_POINT  mouse)
virtual

Process mouse input for this element.

Returns
Returns ProcessReturnType flags.
See also
ProcessReturnType

Implements GuiBase.

◆ setFont()

virtual void CenteredTextInfo::setFont ( FontObject *  pFont)
inlinevirtual

Set this element's font.

Parameters
pFontThe new font.

Reimplemented from GuiBase.

◆ setHovered()

virtual void CenteredTextInfo::setHovered ( int  value)
virtual

Set this GUI element as hovered over or not.

Parameters
valueThe hover value.

Implements GuiBase.

◆ setSelected()

virtual void CenteredTextInfo::setSelected ( int  value)
virtual

Set this GUI element as selected or not.

Parameters
valueThe selection value.

Implements GuiBase.

◆ setText()

void CenteredTextInfo::setText ( const char *  text)

Set the text of this element.

Parameters
textThe text to set.

Member Data Documentation

◆ mNewLineCount

int CenteredTextInfo::mNewLineCount

The list size of mNewLines.

Warning
Do not directly modify this variable.

◆ mNewLines

char* CenteredTextInfo::mNewLines[8]

A list of pointers to the new lines in mText.

Warning
Do not directly modify this variable.

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