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

Represents a sprite in the SUNENGINE. More...

#include <SUNENGINESprite.h>

Public Member Functions

 SUNENGINESprite (const SUNENGINESprite &)=delete
 
SUNENGINESpriteoperator= (const SUNENGINESprite &)=delete
 
 SUNENGINESprite (std::string key)
 Constructor for SUNENGINESprite with a key.
 
void SetOrigin (float x, float y)
 Sets the origin of the sprite.
 
void SetPosition (float x, float y)
 Sets the position of the sprite.
 
void SetAngleRadians (float rad)
 Sets the angle of the sprite in radians.
 
void SetAngleDegrees (float deg)
 Sets the angle of the sprite in degrees.
 
void SetScaleFactor (float x, float y)
 Sets the scale factor of the sprite.
 
void SetScalePixel (float x, float y)
 Sets the scale of the sprite in pixels.
 
float GetWidth () const
 Gets the width of the sprite.
 
float GetHeight () const
 Gets the height of the sprite.
 
float GetAngle () const
 Gets the angle of the sprite.
 
float GetScaleX () const
 Gets the scale factor in the x direction.
 
float GetScaleY () const
 Gets the scale factor in the y direction.
 
float GetPosX () const
 Gets the position in the x direction.
 
float GetPosY () const
 Gets the position in the y direction.
 
void Render ()
 Renders the sprite using the specified camera.
 
 SUNENGINESprite (const SUNENGINESprite &)=delete
 
SUNENGINESpriteoperator= (const SUNENGINESprite &)=delete
 
 SUNENGINESprite (std::string key)
 Constructor for SUNENGINESprite with a key.
 
void SetOrigin (float x, float y)
 Sets the origin of the sprite.
 
void SetPosition (float x, float y)
 Sets the position of the sprite.
 
void SetAngleRadians (float rad)
 Sets the angle of the sprite in radians.
 
void SetAngleDegrees (float deg)
 Sets the angle of the sprite in degrees.
 
void SetScaleFactor (float x, float y)
 Sets the scale factor of the sprite.
 
void SetScalePixel (float x, float y)
 Sets the scale of the sprite in pixels.
 
float GetWidth ()
 Gets the width of the sprite.
 
float GetHeight ()
 Gets the height of the sprite.
 
float GetAngle ()
 Gets the angle of the sprite.
 
void Render (Camera *cam)
 Renders the sprite using the specified camera.
 

Private Member Functions

void UpdateWorld ()
 Updates the world transformation matrix for the sprite.
 
void UpdateWorld ()
 Updates the world transformation matrix for the sprite.
 

Private Attributes

GraphicsObject_Sprite * pSprite
 Pointer to the GraphicsObject_Sprite associated with this sprite.
 
Matrix trans
 Transformation matrix for the sprite.
 
Matrix rot
 Rotation matrix for the sprite.
 
Matrix scale
 Scale matrix for the sprite.
 
float posX
 The x-coordinate of the sprite's position.
 
float posY
 The y-coordinate of the sprite's position.
 
float angle
 The angle of the sprite.
 
float scaleX
 The scale factor in the x direction.
 
float scaleY
 The scale factor in the y direction.
 

Detailed Description

Represents a sprite in the SUNENGINE.

The SUNENGINESprite class is responsible for managing and rendering a sprite in the SUNENGINE. It provides methods to set the sprite's origin, position, angle, scale, and to render the sprite.

Constructor & Destructor Documentation

◆ SUNENGINESprite() [1/2]

SUNENGINESprite::SUNENGINESprite ( std::string key)

Constructor for SUNENGINESprite with a key.

Parameters
keyThe key associated with the sprite.
Here is the call graph for this function:

◆ SUNENGINESprite() [2/2]

SUNENGINESprite::SUNENGINESprite ( std::string key)

Constructor for SUNENGINESprite with a key.

Parameters
keyThe key associated with the sprite.

Member Function Documentation

◆ GetAngle() [1/2]

float SUNENGINESprite::GetAngle ( )

Gets the angle of the sprite.

Returns
The angle of the sprite.

◆ GetAngle() [2/2]

float SUNENGINESprite::GetAngle ( ) const

Gets the angle of the sprite.

Returns
The angle of the sprite.

◆ GetHeight() [1/2]

float SUNENGINESprite::GetHeight ( )

Gets the height of the sprite.

Returns
The height of the sprite.

◆ GetHeight() [2/2]

float SUNENGINESprite::GetHeight ( ) const

Gets the height of the sprite.

Returns
The height of the sprite.

◆ GetPosX()

float SUNENGINESprite::GetPosX ( ) const

Gets the position in the x direction.

Returns
The x-coordinate of the sprite's position.

◆ GetPosY()

float SUNENGINESprite::GetPosY ( ) const

Gets the position in the y direction.

Returns
The y-coordinate of the sprite's position.

◆ GetScaleX()

float SUNENGINESprite::GetScaleX ( ) const

Gets the scale factor in the x direction.

Returns
The scale factor in the x direction.

◆ GetScaleY()

float SUNENGINESprite::GetScaleY ( ) const

Gets the scale factor in the y direction.

Returns
The scale factor in the y direction.

◆ GetWidth() [1/2]

float SUNENGINESprite::GetWidth ( )

Gets the width of the sprite.

Returns
The width of the sprite.

◆ GetWidth() [2/2]

float SUNENGINESprite::GetWidth ( ) const

Gets the width of the sprite.

Returns
The width of the sprite.

◆ Render() [1/2]

void SUNENGINESprite::Render ( )

Renders the sprite using the specified camera.

Parameters
camPointer to the camera used for rendering.
Here is the call graph for this function:

◆ Render() [2/2]

void SUNENGINESprite::Render ( Camera * cam)

Renders the sprite using the specified camera.

Parameters
camPointer to the camera used for rendering.

◆ SetAngleDegrees() [1/2]

void SUNENGINESprite::SetAngleDegrees ( float deg)

Sets the angle of the sprite in degrees.

Parameters
degThe angle in degrees.

◆ SetAngleDegrees() [2/2]

void SUNENGINESprite::SetAngleDegrees ( float deg)

Sets the angle of the sprite in degrees.

Parameters
degThe angle in degrees.

◆ SetAngleRadians() [1/2]

void SUNENGINESprite::SetAngleRadians ( float rad)

Sets the angle of the sprite in radians.

Parameters
radThe angle in radians.

◆ SetAngleRadians() [2/2]

void SUNENGINESprite::SetAngleRadians ( float rad)

Sets the angle of the sprite in radians.

Parameters
radThe angle in radians.

◆ SetOrigin() [1/2]

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

Sets the origin of the sprite.

Parameters
xThe x-coordinate of the origin.
yThe y-coordinate of the origin.
Here is the caller graph for this function:

◆ SetOrigin() [2/2]

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

Sets the origin of the sprite.

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

◆ SetPosition() [1/2]

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

Sets the position of the sprite.

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

◆ SetPosition() [2/2]

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

Sets the position of the sprite.

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

◆ SetScaleFactor() [1/2]

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

Sets the scale factor of the sprite.

Parameters
xThe scale factor in the x direction.
yThe scale factor in the y direction.

◆ SetScaleFactor() [2/2]

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

Sets the scale factor of the sprite.

Parameters
xThe scale factor in the x direction.
yThe scale factor in the y direction.

◆ SetScalePixel() [1/2]

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

Sets the scale of the sprite in pixels.

Parameters
xThe width in pixels.
yThe height in pixels.

◆ SetScalePixel() [2/2]

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

Sets the scale of the sprite in pixels.

Parameters
xThe width in pixels.
yThe height in pixels.

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