|
casse-brick
|
The TriangleCollider class represents a triangular collider object. More...
#include <CollidingObject.h>
Public Member Functions | |
| TriangleCollider (point p, int h, int w, point p1, point p2, point p3, std::string id) | |
| Constructs a new TriangleCollider 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 | fillTriangle (const std::shared_ptr< SDL_Renderer > &renderer) |
| Fills the triangle 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< point > | corner |
| The vertices of the triangular collider. | |
| int | height |
| The height of the triangular collider. | |
| int | width |
| The width of the triangular collider. | |
Data Fields inherited from Collider | |
| std::string | id |
| The unique identifier of the collider. | |
| point | p |
| The position of the collider. | |
The TriangleCollider class represents a triangular collider object.
The TriangleCollider class inherits from the Collider class and represents a collider with a triangular shape.
Definition at line 201 of file CollidingObject.h.
|
inline |
Constructs a new TriangleCollider object with specified parameters.
| p | The position of the triangular collider. |
| h | The height of the triangular collider. |
| w | The width of the triangular collider. |
| p1 | The first vertex of the triangle. |
| p2 | The second vertex of the triangle. |
| p3 | The third vertex of the triangle. |
| id | The unique identifier of the collider. |
Definition at line 218 of file CollidingObject.h.
|
overridevirtual |
Checks for collision with another collider.
| other | The other collider to check for collision with. |
Implements Collider.
Definition at line 227 of file CollidingObject.cpp.
| void TriangleCollider::fillTriangle | ( | const std::shared_ptr< SDL_Renderer > & | renderer | ) |
Fills the triangle shape with the current renderer.
| renderer | A shared pointer to the SDL renderer used for rendering. |
Definition at line 250 of file CollidingObject.cpp.
|
overridevirtual |
Gets the type of the collider.
Implements Collider.
Definition at line 246 of file CollidingObject.cpp.
|
overridevirtual |
Renders the collider on the screen.
| renderer | A shared pointer to the SDL renderer used for rendering. |
| color1 | The primary color of the collider. |
| color2 | The secondary color of the collider. |
Implements Collider.
Definition at line 264 of file CollidingObject.cpp.
| std::vector<point> TriangleCollider::corner |
The vertices of the triangular collider.
Definition at line 203 of file CollidingObject.h.
| int TriangleCollider::height |
The height of the triangular collider.
Definition at line 204 of file CollidingObject.h.
| int TriangleCollider::width |
The width of the triangular collider.
Definition at line 205 of file CollidingObject.h.