The CollidingObject class represents a generic colliding object.
More...
#include <CollidingObject.h>
|
| | CollidingObject (int x, int y, int radius, const std::string &id) |
| | Constructs a new CollidingObject with a circular collider.
|
| |
| | CollidingObject (int x, int y, int width, int height, const std::string &id) |
| | Constructs a new CollidingObject with a rectangular collider.
|
| |
| | CollidingObject (int x, int y, int width, int height, bool isTop, const std::string &id) |
| | Constructs a new CollidingObject with a triangular collider.
|
| |
| | CollidingObject (int x, int y, int width, int height, int edges, const std::string &id) |
| | Constructs a new CollidingObject with a hexagonal collider.
|
| |
| std::shared_ptr< Collider > | getCollider () |
| | Gets the collider associated with the object.
|
| |
| virtual void | handleCollisions (point collision)=0 |
| | Handles collisions with other objects.
|
| |
| virtual void | render (std::shared_ptr< SDL_Renderer > renderer, SDL_Color color1, SDL_Color color2)=0 |
| | Renders the object on the screen.
|
| |
The CollidingObject class represents a generic colliding object.
The CollidingObject class provides functionality for handling collisions and rendering in a game environment.
Definition at line 377 of file CollidingObject.h.
◆ CollidingObject() [1/4]
| CollidingObject::CollidingObject |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
radius, |
|
|
const std::string & |
id |
|
) |
| |
|
inline |
Constructs a new CollidingObject with a circular collider.
- Parameters
-
| x | The x-coordinate of the object's position. |
| y | The y-coordinate of the object's position. |
| radius | The radius of the circular collider. |
| id | The unique identifier of the collider. |
Definition at line 390 of file CollidingObject.h.
◆ CollidingObject() [2/4]
| CollidingObject::CollidingObject |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
width, |
|
|
int |
height, |
|
|
const std::string & |
id |
|
) |
| |
|
inline |
Constructs a new CollidingObject with a rectangular collider.
- Parameters
-
| x | The x-coordinate of the object's position. |
| y | The y-coordinate of the object's position. |
| width | The width of the rectangular collider. |
| height | The height of the rectangular collider. |
| id | The unique identifier of the collider. |
Definition at line 404 of file CollidingObject.h.
◆ CollidingObject() [3/4]
| CollidingObject::CollidingObject |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
width, |
|
|
int |
height, |
|
|
bool |
isTop, |
|
|
const std::string & |
id |
|
) |
| |
|
inline |
Constructs a new CollidingObject with a triangular collider.
- Parameters
-
| x | The x-coordinate of the object's position. |
| y | The y-coordinate of the object's position. |
| width | The width of the triangular collider. |
| height | The height of the triangular collider. |
| isTop | Flag indicating whether the object is a top object. |
| id | The unique identifier of the collider. |
Definition at line 419 of file CollidingObject.h.
◆ CollidingObject() [4/4]
| CollidingObject::CollidingObject |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
width, |
|
|
int |
height, |
|
|
int |
edges, |
|
|
const std::string & |
id |
|
) |
| |
|
inline |
Constructs a new CollidingObject with a hexagonal collider.
- Parameters
-
| x | The x-coordinate of the object's position. |
| y | The y-coordinate of the object's position. |
| width | The width of the hexagonal collider. |
| height | The height of the hexagonal collider. |
| edges | The number of edges of the hexagon. |
| id | The unique identifier of the collider. |
Definition at line 444 of file CollidingObject.h.
◆ getCollider()
| std::shared_ptr< Collider > CollidingObject::getCollider |
( |
| ) |
|
Gets the collider associated with the object.
- Returns
- A shared pointer to the collider.
Definition at line 16 of file CollidingObject.cpp.
◆ handleCollisions()
| virtual void CollidingObject::handleCollisions |
( |
point |
collision | ) |
|
|
pure virtual |
Handles collisions with other objects.
- Parameters
-
| collision | The point of collision. |
Implemented in Ball, Brique, PLATFORM, and WALL.
◆ render()
| virtual void CollidingObject::render |
( |
std::shared_ptr< SDL_Renderer > |
renderer, |
|
|
SDL_Color |
color1, |
|
|
SDL_Color |
color2 |
|
) |
| |
|
pure virtual |
Renders the object on the screen.
- Parameters
-
| renderer | A shared pointer to the SDL renderer used for rendering. |
| color1 | The primary color of the object. |
| color2 | The secondary color of the object. |
Implemented in Ball, Hexagon, PLATFORM, Rectangle, Triangle, and WALL.
◆ collider
| std::shared_ptr<Collider> CollidingObject::collider |
|
protected |
The documentation for this class was generated from the following files: