The NEW Pong Game V13.2.1
An interesting implemnettaion of the pong game
Loading...
Searching...
No Matches
circle_renderer Struct Reference

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.
 

Detailed Description

Functor for rendering circular shapes.

This struct provides an operator to render filled circles at specified positions

Member Function Documentation

◆ DrawFilledCircle()

void circle_renderer::DrawFilledCircle ( SDL_Renderer * renderer,
int32_t center_x,
int32_t center_y,
int32_t radius ) const
private

Helper method to draw a filled circle.

Parameters
rendererThe SDL renderer used for drawing
center_xThe x coordinate of the circle's center
center_yThe y coordinate of the circle's center
radiusThe radius of the circle

Uses the midpoint circle algorithm to efficiently render a filled circle.

Parameters
rendererThe SDL renderer used for drawing
center_xThe x coordinate of the circle's center
center_yThe y coordinate of the circle's center
radiusThe radius of the circle

◆ operator()()

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.

Parameters
rendererThe SDL renderer used for drawing
pos_xThe x coordinate of the circle's center
pos_yThe y coordinate of the circle's center
sizeThe diameter of the circle
colorThe 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

Parameters
rendererThe SDL renderer used for drawing
pos_xThe x coordinate of the circle's center
pos_yThe y coordinate of the circle's center
sizeThe diameter of the circle
colorThe color to fill the circle with

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