|
casse-brick
|
The PLATFORM class represents a movable platform object. More...
#include <platform.h>
Public Member Functions | |
| PLATFORM (std::shared_ptr< SDL_Renderer > renderer, int x, int y, int min, int max, int speed) | |
| Constructs a new PLATFORM object with specified parameters. | |
| void | input (SDL_KeyboardEvent event, bool up) |
| Handles input events for moving the platform. | |
| void | render (std::shared_ptr< SDL_Renderer > renderer, SDL_Color color1, SDL_Color color2) override |
| Renders the platform on the screen. | |
| void | handleCollisions (point collision) override |
| Handles collisions with other objects. | |
| void | move () override |
| Moves the platform horizontally. | |
Public Member Functions inherited from MovingObject | |
| MovingObject (int x, int y, int radius, const std::string &id) | |
| Constructs a new MovingObject with a circular collider. | |
| MovingObject (int x, int y, int width, int height, const std::string &id) | |
| Constructs a new MovingObject with a rectangular collider. | |
| virtual void | move ()=0 |
| Moves the object. | |
Public Member Functions inherited from CollidingObject | |
| 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. | |
Private Attributes | |
| int | max_width |
| The maximum width of the platform's movement range. | |
| int | min_width |
| The minimum width of the platform's movement range. | |
| int | speed |
| The speed at which the platform moves. | |
| std::shared_ptr< SDL_Renderer > | renderer |
| A shared pointer to the SDL renderer. | |
Additional Inherited Members | |
Data Fields inherited from MovingObject | |
| point | Velocity |
| The velocity of the object. | |
Protected Attributes inherited from CollidingObject | |
| std::shared_ptr< Collider > | collider |
| The collider associated with the object. | |
The PLATFORM class represents a movable platform object.
The PLATFORM class inherits from the MovingObject class and represents a platform that can move horizontally.
Definition at line 20 of file platform.h.
| PLATFORM::PLATFORM | ( | std::shared_ptr< SDL_Renderer > | renderer, |
| int | x, | ||
| int | y, | ||
| int | min, | ||
| int | max, | ||
| int | speed | ||
| ) |
Constructs a new PLATFORM object with specified parameters.
| renderer | A shared pointer to the SDL renderer used for rendering. |
| x | The initial x-coordinate of the platform's position. |
| y | The initial y-coordinate of the platform's position. |
| min | The minimum width of the platform's movement range. |
| max | The maximum width of the platform's movement range. |
| speed | The speed at which the platform moves. |
Definition at line 9 of file platform.cpp.
|
inlineoverridevirtual |
Handles collisions with other objects.
| collision | The point of collision. |
Implements CollidingObject.
Definition at line 62 of file platform.h.
| void PLATFORM::input | ( | SDL_KeyboardEvent | event, |
| bool | up | ||
| ) |
Handles input events for moving the platform.
| event | The SDL keyboard event. |
| up | A boolean indicating whether the keyboard key has been released or pressed. |
Definition at line 13 of file platform.cpp.
|
overridevirtual |
Moves the platform horizontally.
Implements MovingObject.
Definition at line 31 of file platform.cpp.
|
overridevirtual |
Renders the platform on the screen.
| renderer | A shared pointer to the SDL renderer used for rendering. |
| color1 | The primary color of the platform. |
| color2 | The secondary color of the platform. |
Implements CollidingObject.
Definition at line 26 of file platform.cpp.
|
private |
The maximum width of the platform's movement range.
Definition at line 22 of file platform.h.
|
private |
The minimum width of the platform's movement range.
Definition at line 23 of file platform.h.
|
private |
A shared pointer to the SDL renderer.
Definition at line 25 of file platform.h.
|
private |
The speed at which the platform moves.
Definition at line 24 of file platform.h.