Ketchup Engine
Loading...
Searching...
No Matches
KSprite Class Reference

#include <KSprite.h>

Collaboration diagram for KSprite:
Collaboration graph

Public Member Functions

 KSprite ()=delete
 
 KSprite (std::string imageKey)
 
 KSprite (Image *image)
 
 KSprite (const KSprite &)=delete
 
KSpriteoperator= (const KSprite &)=delete
 
 ~KSprite ()
 
void Render ()
 Renders the sprite to the default UI camera.
 
void SetPos (float x, float y)
 Sets position of sprite based on pixel coordinate (relative to original screen size)
 
void SetRelScale (float w, float h)
 Sets scale relative to original sprite size.
 
void SetRelWidth (float w)
 Sets width relative to original sprite size.
 
void SetRelHeight (float h)
 Sets height relative to original sprite size.
 
void SetPixScale (float w, float h)
 Sets scale by pixel width and height.
 
void SetPixWidth (float w)
 Sets width in pixels.
 
void SetPixHeight (float h)
 Sets height in pixels.
 
void SetPivot (float x, float y)
 Sets the sprite's pivot point.
 
void SetRot (float angle)
 Sets the rotation angle of the sprite.
 
float GetWidth ()
 Gets the width of the sprite in pixels.
 
float GetHeight ()
 Gets the height of the sprite in pixels.
 

Private Member Functions

void privConstruct (Image *img)
 
void UpdateWorld ()
 
void UpdateScale ()
 

Private Attributes

Matrix m_world
 
float m_relWidth
 
float m_relHeight
 
Matrix m_scale
 
Matrix m_trans
 
Matrix m_pivotTrans
 
float m_rotAngle
 
Matrix m_rot
 
Image * p_image
 
GraphicsObject_Sprite * p_goSprite
 

Constructor & Destructor Documentation

◆ KSprite() [1/4]

KSprite::KSprite ( )
delete

◆ KSprite() [2/4]

KSprite::KSprite ( std::string  imageKey)

◆ KSprite() [3/4]

KSprite::KSprite ( Image *  image)

◆ KSprite() [4/4]

KSprite::KSprite ( const KSprite )
delete

◆ ~KSprite()

KSprite::~KSprite ( )

Member Function Documentation

◆ GetHeight()

float KSprite::GetHeight ( )

Gets the height of the sprite in pixels.

Haru, 3/19/2023.

Returns
The height.

◆ GetWidth()

float KSprite::GetWidth ( )

Gets the width of the sprite in pixels.

Haru, 3/19/2023.

Returns
The width.

◆ operator=()

KSprite & KSprite::operator= ( const KSprite )
delete

◆ privConstruct()

void KSprite::privConstruct ( Image *  img)
private

◆ Render()

void KSprite::Render ( )

Renders the sprite to the default UI camera.

Haru, 3/19/2023.

◆ SetPivot()

void KSprite::SetPivot ( float  x,
float  y 
)

Sets the sprite's pivot point.

Haru, 3/19/2023.

Parameters
xThe x coordinate.
yThe y coordinate.

◆ SetPixHeight()

void KSprite::SetPixHeight ( float  h)

Sets height in pixels.

Haru, 3/19/2023.

Parameters
hThe height.

◆ SetPixScale()

void KSprite::SetPixScale ( float  w,
float  h 
)

Sets scale by pixel width and height.

Haru, 3/19/2023.

Parameters
wThe width.
hThe height.

◆ SetPixWidth()

void KSprite::SetPixWidth ( float  w)

Sets width in pixels.

Haru, 3/19/2023.

Parameters
wThe width.

◆ SetPos()

void KSprite::SetPos ( float  x,
float  y 
)

Sets position of sprite based on pixel coordinate (relative to original screen size)

Haru, 3/19/2023.

Parameters
xThe x coordinate (bottom-left origin).
yThe y coordinate (bottom-left origin).

◆ SetRelHeight()

void KSprite::SetRelHeight ( float  h)

Sets height relative to original sprite size.

Haru, 3/19/2023.

Parameters
hThe height scale factor.

◆ SetRelScale()

void KSprite::SetRelScale ( float  w,
float  h 
)

Sets scale relative to original sprite size.

Haru, 3/19/2023.

Parameters
wThe width scale factor.
hThe height scale factor.

◆ SetRelWidth()

void KSprite::SetRelWidth ( float  w)

Sets width relative to original sprite size.

Haru, 3/19/2023.

Parameters
wThe width scale factor.

◆ SetRot()

void KSprite::SetRot ( float  angle)

Sets the rotation angle of the sprite.

Haru, 3/19/2023.

Parameters
angleThe angle in radians.

◆ UpdateScale()

void KSprite::UpdateScale ( )
private

◆ UpdateWorld()

void KSprite::UpdateWorld ( )
private

Member Data Documentation

◆ m_pivotTrans

Matrix KSprite::m_pivotTrans
private

◆ m_relHeight

float KSprite::m_relHeight
private

◆ m_relWidth

float KSprite::m_relWidth
private

◆ m_rot

Matrix KSprite::m_rot
private

◆ m_rotAngle

float KSprite::m_rotAngle
private

◆ m_scale

Matrix KSprite::m_scale
private

◆ m_trans

Matrix KSprite::m_trans
private

◆ m_world

Matrix KSprite::m_world
private

◆ p_goSprite

GraphicsObject_Sprite* KSprite::p_goSprite
private

◆ p_image

Image* KSprite::p_image
private

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