Osiris Framework  0.3
OText2D Class Reference

Two-dimensional text handling class. More...

#include <OsirisSDK/OText2D.h>

Inheritance diagram for OText2D:
OObject

Public Member Functions

 OText2D (OFont *font, unsigned int fontSize, float x, float y, const OVector4 &color=OVector4(1.0f), const char *content=NULL)
 Class constructor. More...
 
virtual ~OText2D ()
 Class destructor.
 
void setFont (OFont *font, unsigned int fontSize)
 Sets font class and size.
 
OFontfont () const
 Returns the font file being used.
 
unsigned int fontSize () const
 Returns the font size.
 
void setFontColor (const OVector4 &color)
 Set the font color using a OVector4 class object as input. More...
 
OVector4 fontColor () const
 Provides the font color in the form of a four-dimensional vector. More...
 
void setPosition (float x, float y)
 Sets the position of the text box. More...
 
float x () const
 Returns the position of the text box on the X axis in pixels.
 
float y () const
 Returns the position of the text box on the Y axis in pixels.
 
void setScale (float sx, float sy)
 Sets the size of the text box. More...
 
float scaleX () const
 Returns the horizontal size of the text box in pixels.
 
float scaleY () const
 Returns the vertical size of the text box in pixels.
 
void setContent (const char *content)
 Sets the text content of the text box. More...
 
void append (const char *content)
 Adds text to the end of the text box content. More...
 
const char * content () const
 Returns the content of the text box.
 
void render ()
 Renders the text string on the screen.
 
void onScreenResize (const OResizeEvent *evt)
 Screen resize event handler. More...
 
- Public Member Functions inherited from OObject
 OObject ()
 Class constructor.
 
virtual ~OObject ()
 Class destructor.
 
void scheduleDelete ()
 Schedule this object for deletion at the end of an application loop.
 
virtual void processEvent (const OEvent *evt)
 Main event handle. More...
 

Additional Inherited Members

- Protected Member Functions inherited from OObject
virtual void onKeyboardPress (const OKeyboardPressEvent *evt)
 Keyboard press event handler. More...
 
virtual void onKeyboardRelease (const OKeyboardPressEvent *evt)
 Mouse release event handler. More...
 
virtual void onMouseClick (const OMouseClickEvent *evt)
 Mouse click event handler. More...
 
virtual void onMouseMove (const OMouseMoveEvent *evt)
 Mouse active and passive move event handler. More...
 

Detailed Description

Two-dimensional text handling class.

This class enabled the rendering of text on the screen.

Constructor & Destructor Documentation

OText2D::OText2D ( OFont font,
unsigned int  fontSize,
float  x,
float  y,
const OVector4 color = OVector4(1.0f),
const char *  content = NULL 
)

Class constructor.

Parameters
fontObject containing font definitions and cache.
fontSizeFont height in pixels.
xPosition of the beggining of the text box in the X axis.
yPosition of the beggining of the text box in the Y axis.
contentText conte

Member Function Documentation

void OText2D::append ( const char *  content)

Adds text to the end of the text box content.

Parameters
contentContent to be appended to the current string.
OVector4 OText2D::fontColor ( ) const

Provides the font color in the form of a four-dimensional vector.

Returns
An OVector4 class object in the form (r, g, b, alpha).
void OText2D::onScreenResize ( const OResizeEvent evt)
virtual

Screen resize event handler.

This handler is only called if the object is set as an event recipient. By default does nothing.

Parameters
evtScreen resize event object.

Reimplemented from OObject.

void OText2D::setContent ( const char *  content)

Sets the text content of the text box.

Parameters
contentNew content of the text box.
void OText2D::setFontColor ( const OVector4 color)

Set the font color using a OVector4 class object as input.

Parameters
colorA four-dimensional vector containing the color components in the form (r, g, b, alpha).
void OText2D::setPosition ( float  x,
float  y 
)

Sets the position of the text box.

Parameters
xPosition of the text box on the X axis in pixels.
yPosition of the text box on the Y axis in pixels.
void OText2D::setScale ( float  sx,
float  sy 
)

Sets the size of the text box.

Parameters
sxHorizontal scale of the text box.
sxVertical scale of the text box.

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