SUNENGINE 0.0.2
A simple and bright C++ game engine.
 
Loading...
Searching...
No Matches
SpriteString Class Reference

Represents a string of sprites in the SUNENGINE. More...

#include <SpriteString.h>

Public Member Functions

 SpriteString (const SpriteString &)=delete
 
SpriteStringoperator= (const SpriteString &)=delete
 
 SpriteString (SpriteFont *font, std::string text, float x, float y)
 Constructor for SpriteString with a font, text, and position.
 
float GetWidth ()
 Gets the width of the sprite string.
 
float GetHeight ()
 Gets the height of the sprite string.
 
void SetPosition (float x, float y)
 Sets the position of the sprite string.
 
float GetPosX () const
 Gets the x-coordinate of the position.
 
float GetPosY () const
 Gets the y-coordinate of the position.
 
void SetCollection (SpriteFont *font, std::string text, float x, float y)
 Sets the collection of sprites for the string.
 
void UpdateCollection (SpriteFont *font, std::string text, float x, float y)
 Updates the collection of sprites for the string.
 
void UpdateCollection (std::string text, float x, float y)
 Updates the collection of sprites for the string.
 
void Render ()
 Renders the sprite string.
 
void SetScaleFactor (float x, float y)
 Sets the scale factor for the sprite string.
 
void SetScalePixel (float x, float y)
 Sets the scale of the sprite string in pixels.
 
int GetLines () const
 Sets the scale of the sprite string in pixels.
 
float GetScaleX () const
 Gets the scale factor in the x direction.
 
float GetScaleY () const
 Gets the scale factor in the y direction.
 
void SetAngleDegrees (float degrees)
 Sets the angle of the sprite string in degrees.
 
void SetAngleRadians (float radians)
 Sets the angle of the sprite string in radians.
 
void SetOrigin (float x, float y)
 Sets the origin of the sprite string.
 
std::string GetText () const
 Gets the current text of the sprite string.
 

Private Types

using GlyphIt = std::list<Glyph*>::iterator
 Iterator type for the glyph list.
 

Private Attributes

std::list< Glyph * > GlyphList
 List of glyphs representing the string.
 
SpriteFontpFont
 Pointer to the SpriteFont used for rendering the string.
 
float originX
 The x-coordinate of the origin.
 
float originY
 The y-coordinate of the origin.
 
float posX
 The x-coordinate of the position.
 
float posY
 The y-coordinate of the position.
 
int width
 The width of the sprite string.
 
int height
 The height of the sprite string.
 
float scaleX
 The scale factor in the x direction.
 
float scaleY
 The scale factor in the y direction.
 
int lines
 The number of lines in the sprite string.
 
float angle
 The angle of the sprite string in radians.
 
std::string currentText
 The current text in the sprite string.
 

Detailed Description

Represents a string of sprites in the SUNENGINE.

The SpriteString class is responsible for managing and rendering a string of sprites in the SUNENGINE. It provides methods to set the position, update the collection of sprites, and render the string.

Constructor & Destructor Documentation

◆ SpriteString()

SpriteString::SpriteString ( SpriteFont * font,
std::string text,
float x,
float y )

Constructor for SpriteString with a font, text, and position.

Parameters
fontPointer to the SpriteFont to be used.
textThe text to be rendered.
xThe x-coordinate of the position.
yThe y-coordinate of the position.
Here is the call graph for this function:

Member Function Documentation

◆ GetHeight()

float SpriteString::GetHeight ( )

Gets the height of the sprite string.

Returns
The height of the sprite string.
Here is the caller graph for this function:

◆ GetLines()

int SpriteString::GetLines ( ) const

Sets the scale of the sprite string in pixels.

Parameters
xThe width in pixels.
yThe height in pixels.

◆ GetPosX()

float SpriteString::GetPosX ( ) const

Gets the x-coordinate of the position.

Returns
The x-coordinate of the position.

◆ GetPosY()

float SpriteString::GetPosY ( ) const

Gets the y-coordinate of the position.

Returns
The y-coordinate of the position.

◆ GetScaleX()

float SpriteString::GetScaleX ( ) const

Gets the scale factor in the x direction.

Returns
The scale factor in the x direction.

◆ GetScaleY()

float SpriteString::GetScaleY ( ) const

Gets the scale factor in the y direction.

Returns
The scale factor in the y direction.

◆ GetText()

std::string SpriteString::GetText ( ) const

Gets the current text of the sprite string.

Returns
The current text as a string.

◆ GetWidth()

float SpriteString::GetWidth ( )

Gets the width of the sprite string.

Returns
The width of the sprite string.
Here is the caller graph for this function:

◆ SetAngleDegrees()

void SpriteString::SetAngleDegrees ( float degrees)

Sets the angle of the sprite string in degrees.

Parameters
degreesThe angle in degrees.

◆ SetAngleRadians()

void SpriteString::SetAngleRadians ( float radians)

Sets the angle of the sprite string in radians.

Parameters
radiansThe angle in radians.

◆ SetCollection()

void SpriteString::SetCollection ( SpriteFont * font,
std::string text,
float x,
float y )

Sets the collection of sprites for the string.

Parameters
fontPointer to the SpriteFont to be used.
textThe text to be rendered.
xThe x-coordinate of the position.
yThe y-coordinate of the position.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetOrigin()

void SpriteString::SetOrigin ( float x,
float y )

Sets the origin of the sprite string.

Parameters
xThe x-coordinate of the origin.
yThe y-coordinate of the origin.

◆ SetPosition()

void SpriteString::SetPosition ( float x,
float y )

Sets the position of the sprite string.

Parameters
xThe x-coordinate of the position.
yThe y-coordinate of the position.

◆ SetScaleFactor()

void SpriteString::SetScaleFactor ( float x,
float y )

Sets the scale factor for the sprite string.

Parameters
xThe scale factor in the x direction.
yThe scale factor in the y direction.
Here is the caller graph for this function:

◆ SetScalePixel()

void SpriteString::SetScalePixel ( float x,
float y )

Sets the scale of the sprite string in pixels.

Parameters
xThe width in pixels.
yThe height in pixels.

◆ UpdateCollection() [1/2]

void SpriteString::UpdateCollection ( SpriteFont * font,
std::string text,
float x,
float y )

Updates the collection of sprites for the string.

Parameters
fontPointer to the SpriteFont to be used.
textThe text to be rendered.
xThe x-coordinate of the position.
yThe y-coordinate of the position.
Here is the call graph for this function:

◆ UpdateCollection() [2/2]

void SpriteString::UpdateCollection ( std::string text,
float x,
float y )

Updates the collection of sprites for the string.

Parameters
textThe text to be rendered.
xThe x-coordinate of the position.
yThe y-coordinate of the position.
Here is the call graph for this function:

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