Slippers Engine
 
Loading...
Searching...
No Matches
Sprite Class Reference

Responsible for Sprite Creation and Positioning. More...

#include <Sprite.h>

Collaboration diagram for Sprite:
Collaboration graph

Public Member Functions

 Sprite (std::string imgKey)
 Creates a Sprite using a given Image Key.
 
float GetAngleRad ()
 Gets Sprite's current angle in radians.
 
float GetAngleDeg ()
 Gets Sprite's current angle in degrees.
 
void SetAngleRad (float a)
 Sets sprites angle in radians based on sprite center.
 
void SetAngleDeg (float a)
 Sets sprites angle in degrees based on sprite center.
 
float GetScaleX ()
 Gets Sprite's current size X.
 
float GetScaleXPixel ()
 Gets Sprite's current size X in pixels.
 
float GetScaleY ()
 Gets Sprite's current size Y.
 
float GetScaleYPixel ()
 Gets Sprite's current size Y in pixels.
 
float GetCenterX ()
 Gets Sprite's current center X.
 
float GetCenterY ()
 Gets Sprite's current center Y.
 
void SetCenter (float offsetx, float offsety)
 Sets a new Sprite Center.
 
float GetPosX ()
 Gets Sprite's current position X.
 
float GetPosY ()
 Gets Sprite's current position Y.
 
void SetPosition (float x, float y)
 Sets Sprite's position XY.
 
void SetScaleFactor (float scalex, float scaley)
 Sets Sprite's current orientation to ScaleFactorX and ScaleFactorY.
 
void SetScalePixel (float width, float height)
 Sets Sprite's current orientation to width and height.
 
void Render ()
 Renders Sprite to the 2D Camera.
 

Detailed Description

Responsible for Sprite Creation and Positioning.

Constructor & Destructor Documentation

◆ Sprite()

Sprite::Sprite ( std::string imgKey)

Creates a Sprite using a given Image Key.

Takes in a String as a MapKey to create a Sprite using the given Image.

Example:

Sprite* demoSpriteOne = new Sprite("Demo Sprite");
Sprite(std::string imgKey)
Creates a Sprite using a given Image Key.
Definition Sprite.cpp:12
Parameters
imgKey

Member Function Documentation

◆ GetAngleDeg()

float Sprite::GetAngleDeg ( )

Gets Sprite's current angle in degrees.

Returns
float

◆ GetAngleRad()

float Sprite::GetAngleRad ( )

Gets Sprite's current angle in radians.

Returns
float

◆ GetCenterX()

float Sprite::GetCenterX ( )

Gets Sprite's current center X.

Returns
float

◆ GetCenterY()

float Sprite::GetCenterY ( )

Gets Sprite's current center Y.

Returns
float

◆ GetPosX()

float Sprite::GetPosX ( )

Gets Sprite's current position X.

Returns
float

◆ GetPosY()

float Sprite::GetPosY ( )

Gets Sprite's current position Y.

Returns
float

◆ GetScaleX()

float Sprite::GetScaleX ( )

Gets Sprite's current size X.

Returns
float

◆ GetScaleXPixel()

float Sprite::GetScaleXPixel ( )

Gets Sprite's current size X in pixels.

Returns
float

◆ GetScaleY()

float Sprite::GetScaleY ( )

Gets Sprite's current size Y.

Returns
float

◆ GetScaleYPixel()

float Sprite::GetScaleYPixel ( )

Gets Sprite's current size Y in pixels.

Returns
float

◆ Render()

void Sprite::Render ( )

Renders Sprite to the 2D Camera.

◆ SetAngleDeg()

void Sprite::SetAngleDeg ( float a)

Sets sprites angle in degrees based on sprite center.

Parameters
a

◆ SetAngleRad()

void Sprite::SetAngleRad ( float a)

Sets sprites angle in radians based on sprite center.

Parameters
a

◆ SetCenter()

void Sprite::SetCenter ( float offsetx,
float offsety )

Sets a new Sprite Center.

Parameters
offsetx
offsety

◆ SetPosition()

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

Sets Sprite's position XY.

Parameters
x
y

◆ SetScaleFactor()

void Sprite::SetScaleFactor ( float scalex,
float scaley )

Sets Sprite's current orientation to ScaleFactorX and ScaleFactorY.

Warning
Remember this is based on the current orientation not the starting orientation
Parameters
scalex
scaley

◆ SetScalePixel()

void Sprite::SetScalePixel ( float width,
float height )

Sets Sprite's current orientation to width and height.

Warning
Remember this is based on the current orientation not the starting orientation
Parameters
width
height