souleng
Game engine providing full Python scripting support
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
Collision2DComponent Struct Reference

Component for handling 2D collisions. More...

#include <Collision2DComponent.hpp>

Inheritance diagram for Collision2DComponent:
Component

Public Member Functions

void Input () override
 Called once per frame to handle any new input.
 
void Update (float dt) override
 
void Render () override
 
void SetWidth (float w)
 
void SetHeight (float h)
 
Vector2 GetPosition ()
 
void MoveTo (float x, float y)
 
SDL_FRect GetRect () const
 Gets a copy of the underlying rectangle used for collison.
 
- Public Member Functions inherited from Component
void SetGameObject (std::weak_ptr< GameObject > ent)
 Sets the GameObject this component is attached to.
 
std::shared_ptr< GameObjectGetGameObject ()
 Retrieves the GameObject this component is attached to, behind a shared pointer.
 
template<typename T >
std::shared_ptr< T > GetComponent ()
 Alias for GetGameObject()->GetComponent<T>(), for easier scripting.
 

Static Public Member Functions

static ComponentType GetType ()
 Returns the type of this component to make querying GetComponent easier.
 
- Static Public Member Functions inherited from Component
static ComponentType GetType ()
 Returns the type of this component to make querying GetComponent easier.
 

Additional Inherited Members

- Protected Attributes inherited from Component
std::weak_ptr< GameObjectmGameObject
 

Detailed Description

Component for handling 2D collisions.

Member Function Documentation

◆ GetPosition()

Vector2 Collision2DComponent::GetPosition ( )

Gets the current position of the collider attached to this component,

Returns
position of this collider's top left corner

◆ GetType()

ComponentType Collision2DComponent::GetType ( )
static

Returns the type of this component to make querying GetComponent easier.

◆ Input()

void Collision2DComponent::Input ( )
overridevirtual

Called once per frame to handle any new input.

Reimplemented from Component.

◆ MoveTo()

void Collision2DComponent::MoveTo ( float x,
float y )

Moves the collider's top left corner to the specified location

Parameters
x,yThe coordinates to move the collider to

◆ Render()

void Collision2DComponent::Render ( )
overridevirtual

Called once per frame to render any necessary parts of this component to the screen

Reimplemented from Component.

◆ SetHeight()

void Collision2DComponent::SetHeight ( float h)

Sets the height of the collider attached to this component

Parameters
hNew height for the collider

◆ SetWidth()

void Collision2DComponent::SetWidth ( float w)

Sets the width of the collider attached to this component

Parameters
wNew width for the collider

◆ Update()

void Collision2DComponent::Update ( float dt)
overridevirtual

Called once per frame for any timing specific logic

Parameters
deltaTimeThe tick rate of the game, in seconds. Useful for things like velocity calculations

Reimplemented from Component.


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