Component for handling 2D collisions.
More...
#include <Collision2DComponent.hpp>
|
| 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.
|
| |
|
void | SetGameObject (std::weak_ptr< GameObject > ent) |
| | Sets the GameObject this component is attached to.
|
| |
|
std::shared_ptr< GameObject > | GetGameObject () |
| | 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 ComponentType | GetType () |
| | Returns the type of this component to make querying GetComponent easier.
|
| |
|
static ComponentType | GetType () |
| | Returns the type of this component to make querying GetComponent easier.
|
| |
Component for handling 2D collisions.
◆ 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,y | The 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
-
| h | New height for the collider |
◆ SetWidth()
| void Collision2DComponent::SetWidth |
( |
float | w | ) |
|
Sets the width of the collider attached to this component
- Parameters
-
| w | New width for the collider |
◆ Update()
| void Collision2DComponent::Update |
( |
float | dt | ) |
|
|
overridevirtual |
Called once per frame for any timing specific logic
- Parameters
-
| deltaTime | The 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: