![]() |
The NEW Pong Game V13.2.1
An interesting implemnettaion of the pong game
|
Functor for rendering circular shapes. More...
#include <renderers.hpp>
Public Member Functions | |
void | operator() (SDL_Renderer *renderer, float pos_x, float pos_y, float size, SDL_Color color) const |
Renders a circular shape at the specified position. | |
Private Member Functions | |
void | DrawFilledCircle (SDL_Renderer *renderer, int32_t center_x, int32_t center_y, int32_t radius) const |
Helper method to draw a filled circle. | |
Functor for rendering circular shapes.
This struct provides an operator to render filled circles at specified positions
|
private |
Helper method to draw a filled circle.
renderer | The SDL renderer used for drawing |
center_x | The x coordinate of the circle's center |
center_y | The y coordinate of the circle's center |
radius | The radius of the circle |
Uses the midpoint circle algorithm to efficiently render a filled circle.
renderer | The SDL renderer used for drawing |
center_x | The x coordinate of the circle's center |
center_y | The y coordinate of the circle's center |
radius | The radius of the circle |
void circle_renderer::operator() | ( | SDL_Renderer * | renderer, |
float | pos_x, | ||
float | pos_y, | ||
float | size, | ||
SDL_Color | color ) const |
Renders a circular shape at the specified position.
Functors encapsulate the shape rendering logic.
renderer | The SDL renderer used for drawing |
pos_x | The x coordinate of the circle's center |
pos_y | The y coordinate of the circle's center |
size | The diameter of the circle |
color | The color to fill the circle with |
Using functors allows us to easily add new shape types and test them individually. This approach greatly accelerated development by enabling isolated testing of renderers.
Renders a circular shape at the specified position
renderer | The SDL renderer used for drawing |
pos_x | The x coordinate of the circle's center |
pos_y | The y coordinate of the circle's center |
size | The diameter of the circle |
color | The color to fill the circle with |