VEGO-Engine  0.1
Loading...
Searching...
No Matches
ColliderComponent Class Reference

Adds a collision box to an entity when added via entity.addComponent() More...

#include <ColliderComponent.h>

Public Member Functions

SDL_Rect & getCollider ()
 
const char * getTag () const
 
bool hasCollision () const
 
 ColliderComponent (const char *tag)
 Constructor for ColliderComponent.
 
 ColliderComponent (const char *tag, float hitboxScale)
 Constructor for ColliderComponent.
 
void removeCollision ()
 Removes the collision of an entity.
 

Detailed Description

Adds a collision box to an entity when added via entity.addComponent()

Constructor & Destructor Documentation

◆ ColliderComponent() [1/2]

ColliderComponent::ColliderComponent ( const char * tag)

Constructor for ColliderComponent.

Parameters
tagThe tag of the collider, can be any char*

◆ ColliderComponent() [2/2]

ColliderComponent::ColliderComponent ( const char * tag,
float hitboxScale )

Constructor for ColliderComponent.

Parameters
tagThe tag of the collider, can be any char*
hitboxScaleThe scale of the collider, used to scale the collider size (this is independent of the sprite size), default is 1.0f and takes up the 32x32 pixels

Member Function Documentation

◆ getCollider()

SDL_Rect & ColliderComponent::getCollider ( )
inline
Returns
the collider of the entity

◆ getTag()

const char * ColliderComponent::getTag ( ) const
inline
Returns
the tag of the entity

◆ hasCollision()

bool ColliderComponent::hasCollision ( ) const
inline
Returns
the collision state of the entity

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