Rhythm
Game Engines Final Project
Loading...
Searching...
No Matches
components::collision_rect::ComponentCollisionRect Class Reference

A component that handles collision detection using a rectangle. More...

Inheritance diagram for components::collision_rect::ComponentCollisionRect:

Public Member Functions

 this (GameObject *owner)
 Constructor for ComponentCollisionRect.
 
override void Update ()
 Updates the collision rectangle, deriving it from the texture if necessary.
 
override void Render (SDL_Renderer *renderer)
 Renders the collision rectangle for debugging purposes.
 
 typeof (this) SetCenter(SDL_Point center)
 Sets the center point of the collision rectangle.
 
 typeof (this) SetRadius(uint radius)
 Sets the radius of the collision rectangle.
 
SDL_Point GetCenter ()
 Gets the center point of the collision rectangle.
 
SDL_Rect * GetRect ()
 Gets the SDL_Rect representing the collision rectangle.
 
uint GetRadius ()
 Gets the radius of the collision rectangle.
 
void SetColliding ()
 Sets the colliding state to true.
 
 typeof (this) DeriveFromTexture()
 Derives the collision rectangle from the texture component.
 
 typeof (this) OnTouch(void delegate(GameObject *self
 Registers a callback for when the object touches another object.
 
void Touch (GameObject *object)
 Triggers the touch callbacks when the object touches another object.
 

Public Attributes

GameObject *object callback
 

Detailed Description

A component that handles collision detection using a rectangle.

Constructor & Destructor Documentation

◆ this()

components::collision_rect::ComponentCollisionRect::this ( GameObject * owner)
inline

Constructor for ComponentCollisionRect.

Parameters
ownerPointer to the GameObject that owns this component.

Member Function Documentation

◆ GetCenter()

SDL_Point components::collision_rect::ComponentCollisionRect::GetCenter ( )
inline

Gets the center point of the collision rectangle.

Returns
The SDL_Point representing the center.

◆ GetRadius()

uint components::collision_rect::ComponentCollisionRect::GetRadius ( )
inline

Gets the radius of the collision rectangle.

Returns
The radius value.

◆ GetRect()

SDL_Rect * components::collision_rect::ComponentCollisionRect::GetRect ( )
inline

Gets the SDL_Rect representing the collision rectangle.

Returns
A pointer to the SDL_Rect.

◆ Render()

override void components::collision_rect::ComponentCollisionRect::Render ( SDL_Renderer * renderer)
inline

Renders the collision rectangle for debugging purposes.

Parameters
rendererPointer to the SDL_Renderer.

◆ Touch()

void components::collision_rect::ComponentCollisionRect::Touch ( GameObject * object)
inline

Triggers the touch callbacks when the object touches another object.

Parameters
objectPointer to the other GameObject.

◆ typeof() [1/4]

components::collision_rect::ComponentCollisionRect::typeof ( this )
inline

Derives the collision rectangle from the texture component.

Returns
A reference to this ComponentCollisionRect.

◆ typeof() [2/4]

components::collision_rect::ComponentCollisionRect::typeof ( this )

Registers a callback for when the object touches another object.

Parameters
callbackThe callback to register.
Returns
A reference to this ComponentCollisionRect.

◆ typeof() [3/4]

components::collision_rect::ComponentCollisionRect::typeof ( this )
inline

Sets the center point of the collision rectangle.

Parameters
centerThe SDL_Point representing the center.
Returns
A reference to this ComponentCollisionRect.

◆ typeof() [4/4]

components::collision_rect::ComponentCollisionRect::typeof ( this )
inline

Sets the radius of the collision rectangle.

Parameters
radiusThe radius value.
Returns
A reference to this ComponentCollisionRect.

Member Data Documentation

◆ callback

GameObject* object components::collision_rect::ComponentCollisionRect::callback
Initial value:
{
mCallbacksOnTouch ~= callback

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