casse-brick
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
HexagonCollider Class Reference

The HexagonCollider class represents a hexagonal collider object. More...

#include <CollidingObject.h>

Inheritance diagram for HexagonCollider:
Collider

Public Member Functions

 HexagonCollider (point p, int h, int w, std::vector< point > corner, std::string id)
 Constructs a new HexagonCollider object with specified parameters.
 
std::tuple< bool, float, float > collided (const Collider &other) const override
 Checks for collision with another collider.
 
std::string getType () const override
 Gets the type of the collider.
 
void fillHexagon (const std::shared_ptr< SDL_Renderer > &renderer)
 Fills the hexagon shape with the current renderer.
 
void render (std::shared_ptr< SDL_Renderer > renderer, SDL_Color color1, SDL_Color color2) override
 Renders the collider on the screen.
 
- Public Member Functions inherited from Collider
void move (point newPoint)
 Moves the collider to a new position.
 
void moveTo (point newPoint)
 Moves the collider to an absolute position.
 
virtual ~Collider ()=default
 Virtual destructor for the Collider class.
 
virtual std::tuple< bool, float, float > collided (const Collider &other) const =0
 Checks for collision with another collider.
 
virtual std::string getType () const =0
 Gets the type of the collider.
 
virtual void render (std::shared_ptr< SDL_Renderer > renderer, SDL_Color color1, SDL_Color color2)=0
 Renders the collider on the screen.
 

Data Fields

std::vector< pointcorner
 The vertices of the hexagonal collider.
 
int height
 The height of the hexagonal collider.
 
int width
 The width of the hexagonal collider.
 
- Data Fields inherited from Collider
std::string id
 The unique identifier of the collider.
 
point p
 The position of the collider.
 

Detailed Description

The HexagonCollider class represents a hexagonal collider object.

The HexagonCollider class inherits from the Collider class and represents a collider with a hexagonal shape.

Definition at line 265 of file CollidingObject.h.

Constructor & Destructor Documentation

◆ HexagonCollider()

HexagonCollider::HexagonCollider ( point  p,
int  h,
int  w,
std::vector< point corner,
std::string  id 
)
inline

Constructs a new HexagonCollider object with specified parameters.

Parameters
pThe position of the hexagonal collider.
hThe height of the hexagonal collider.
wThe width of the hexagonal collider.
cornerThe vertices of the hexagon.
idThe unique identifier of the collider.

Definition at line 280 of file CollidingObject.h.

Member Function Documentation

◆ collided()

std::tuple< bool, float, float > HexagonCollider::collided ( const Collider other) const
overridevirtual

Checks for collision with another collider.

Parameters
otherThe other collider to check for collision with.
Returns
A tuple containing a boolean indicating collision, and optional float values for collision parameters.

Implements Collider.

Definition at line 279 of file CollidingObject.cpp.

◆ fillHexagon()

void HexagonCollider::fillHexagon ( const std::shared_ptr< SDL_Renderer > &  renderer)

Fills the hexagon shape with the current renderer.

Parameters
rendererA shared pointer to the SDL renderer used for rendering.

Definition at line 287 of file CollidingObject.cpp.

◆ getType()

std::string HexagonCollider::getType ( ) const
overridevirtual

Gets the type of the collider.

Returns
A string representing the type of the collider.

Implements Collider.

Definition at line 283 of file CollidingObject.cpp.

◆ render()

void HexagonCollider::render ( std::shared_ptr< SDL_Renderer >  renderer,
SDL_Color  color1,
SDL_Color  color2 
)
overridevirtual

Renders the collider on the screen.

Parameters
rendererA shared pointer to the SDL renderer used for rendering.
color1The primary color of the collider.
color2The secondary color of the collider.

Implements Collider.

Definition at line 323 of file CollidingObject.cpp.

Field Documentation

◆ corner

std::vector<point> HexagonCollider::corner

The vertices of the hexagonal collider.

Definition at line 267 of file CollidingObject.h.

◆ height

int HexagonCollider::height

The height of the hexagonal collider.

Definition at line 268 of file CollidingObject.h.

◆ width

int HexagonCollider::width

The width of the hexagonal collider.

Definition at line 269 of file CollidingObject.h.


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