The NEW Pong Game  V13.2.1
An interesting implemnettaion of the pong game
renderers.hpp
Go to the documentation of this file.
1 
8 #ifndef RENDER_HPP
9 #define RENDER_HPP
10 
11 #include <SDL.h>
12 #include <SDL_ttf.h>
13 #include <algorithm>
14 
19 namespace Utilities
20 {
30  void render_button(SDL_Renderer *renderer, TTF_Font *font, const char *text,
31  const SDL_Rect &button, const SDL_Color &color);
32 }
33 
41 {
51  void operator()(SDL_Renderer *renderer, float pos_x, float pos_y, float size, SDL_Color color) const;
52 
53 private:
62  void DrawFilledCircle(SDL_Renderer *renderer, int32_t center_x, int32_t center_y, int32_t radius) const;
63 };
64 
72 {
82  void operator()(SDL_Renderer *renderer, float pos_x, float pos_y, float size, SDL_Color color) const;
83 };
84 
92 {
102  void operator()(SDL_Renderer *renderer, float pos_x, float pos_y, float size, SDL_Color color) const;
103 };
104 
105 #endif
SDL_Renderer * renderer
Definition: ball_test.cpp:25
TTF_Font * font
Definition: letter_test.cpp:24
Utility functions for rendering common UI elements.
Definition: renderers.cpp:12
void render_button(SDL_Renderer *renderer, TTF_Font *font, const char *text, const SDL_Rect &button, const SDL_Color &color)
Renders a text button on screen.
Definition: renderers.cpp:25
Functor for rendering circular shapes.
Definition: renderers.hpp:41
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.
Definition: renderers.cpp:104
void DrawFilledCircle(SDL_Renderer *renderer, int32_t center_x, int32_t center_y, int32_t radius) const
Helper method to draw a filled circle.
Definition: renderers.cpp:57
Functor for rendering square shapes.
Definition: renderers.hpp:72
void operator()(SDL_Renderer *renderer, float pos_x, float pos_y, float size, SDL_Color color) const
Renders a square shape at the specified position.
Definition: renderers.cpp:122
Functor for rendering triangle shapes.
Definition: renderers.hpp:92
void operator()(SDL_Renderer *renderer, float pos_x, float pos_y, float size, SDL_Color color) const
Renders a triangle shape at the specified position.
Definition: renderers.cpp:144