Polygon Dash
Loading...
Searching...
No Matches
ComponentTransform Class Reference

Contains the coordinates of the GameObject. More...

Inheritance diagram for ComponentTransform:
IComponent

Public Member Functions

 this (size_t owner, int x, int y, int width, int height)
 Initialize the GameObject's position.
 
SDL_Rect rect ()
 Get an SDL_Rect representation of x, y, width, and height.
 
override void Update ()
 Update internal state of the component.
 
override void Render (SDL_Renderer *renderer, SDL_Rect *camera)
 Render the given component.
 
bool IsVisible (const SDL_Rect *camera)
 Checks whether the GameObject is visible to the camera.
 
void SetRotationAngle (float angle)
 Sets a new rotation angle for the GameObject.
 
void IncrementRotation (float delta)
 Updates the rotation angle of the GameObject by an amount.
 
void SetSmall (bool small, bool isGravityFlipped)
 Sets whether the GameObject should render small or not.
 
bool GetSmall ()
 Whether the GameObject is rendered small or not.
 
- Public Member Functions inherited from IComponent

Public Attributes

int x
 X position of the GameObject in pixels (0 is the left side of the screen).
 
int y
 Y position of the GameObject in pixels (0 is the top of the screen).
 
int width
 Width of the GameObject in pixels.
 
int height
 Height of the GameObject in pixels.
 
float rotationAngle
 Rotation angle in degrees.
 
SDL_Point mRotationCenter
 The point about which to rotate.
 

Detailed Description

Contains the coordinates of the GameObject.

Updating x and y instance variables will move the GameObject's rendered position.

See also
IComponent
GameObject

Constructor & Destructor Documentation

◆ this()

ComponentTransform::this ( size_t owner,
int x,
int y,
int width,
int height )
inline

Initialize the GameObject's position.

Parameters
ownerthe id of the attached GameObject.
xthe initial x coordinate.
ythe initial y coordinate.
widththe width of the GameObject.
heightthe height of the GameObject.

Member Function Documentation

◆ GetSmall()

bool ComponentTransform::GetSmall ( )
inline

Whether the GameObject is rendered small or not.

Returns
true if rendering small, false if rendering normal sized.
See also
isSmall
SetSmall

◆ IncrementRotation()

void ComponentTransform::IncrementRotation ( float delta)
inline

Updates the rotation angle of the GameObject by an amount.

Parameters
deltathe angle change amount in degrees.
See also
rotationAngle
SetRotationAngle

◆ IsVisible()

bool ComponentTransform::IsVisible ( const SDL_Rect * camera)
inline

Checks whether the GameObject is visible to the camera.

Returns
true if visible, otherwise false.

◆ rect()

SDL_Rect ComponentTransform::rect ( )
inline

Get an SDL_Rect representation of x, y, width, and height.

Returns
An SDL_Rect of the GameObject's position.

◆ Render()

override void ComponentTransform::Render ( SDL_Renderer * renderer,
SDL_Rect * camera )
inline

Render the given component.

Implements IComponent.

◆ SetRotationAngle()

void ComponentTransform::SetRotationAngle ( float angle)
inline

Sets a new rotation angle for the GameObject.

Parameters
floatthe new angle value in degrees.
See also
rotationAngle
IncrementRotation

◆ SetSmall()

void ComponentTransform::SetSmall ( bool small,
bool isGravityFlipped )
inline

Sets whether the GameObject should render small or not.

Parameters
smalltrue to render small, false to render normal sized.
isGravityFlippedwhether gravity is flipped for the GameObject.
See also
isSmall
GetSmall

◆ Update()

override void ComponentTransform::Update ( )
inline

Update internal state of the component.

Implements IComponent.


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