casse-brick latest
Ce projet est réalisé dans le cadre du cours de Programmation Avancée en M1 Informatique de l'université de Strasbourg.
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
Collider Class Referenceabstract

The Collider class represents a generic collider object. More...

#include <CollidingObject.h>

Inheritance diagram for Collider:
CircleCollider HexagonCollider RectCollider TriangleCollider

Public Member Functions

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::string id
 The unique identifier of the collider.
 
point p
 The position of the collider.
 

Detailed Description

The Collider class represents a generic collider object.

The Collider class provides functionality for handling collisions and rendering in a game environment.

Definition at line 96 of file CollidingObject.h.

Constructor & Destructor Documentation

◆ ~Collider()

virtual Collider::~Collider ( )
virtualdefault

Virtual destructor for the Collider class.

Member Function Documentation

◆ collided()

virtual std::tuple< bool, float, float > Collider::collided ( const Collider other) const
pure virtual

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.

Implemented in RectCollider, TriangleCollider, HexagonCollider, and CircleCollider.

◆ getType()

virtual std::string Collider::getType ( ) const
pure virtual

Gets the type of the collider.

Returns
A string representing the type of the collider.

Implemented in RectCollider, TriangleCollider, HexagonCollider, and CircleCollider.

◆ move()

void Collider::move ( point  newPoint)

Moves the collider to a new position.

Parameters
newPointThe new position of the collider.

Definition at line 8 of file CollidingObject.cpp.

◆ moveTo()

void Collider::moveTo ( point  newPoint)

Moves the collider to an absolute position.

Parameters
newPointThe new absolute position of the collider.

Definition at line 12 of file CollidingObject.cpp.

◆ render()

virtual void Collider::render ( std::shared_ptr< SDL_Renderer >  renderer,
SDL_Color  color1,
SDL_Color  color2 
)
pure virtual

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.

Implemented in RectCollider, TriangleCollider, HexagonCollider, and CircleCollider.

Field Documentation

◆ id

std::string Collider::id

The unique identifier of the collider.

Definition at line 98 of file CollidingObject.h.

◆ p

point Collider::p

The position of the collider.

Definition at line 99 of file CollidingObject.h.


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