SDL Utility
RenderTarget.hpp
Go to the documentation of this file.
1 
7 #pragma once
8 #include <chrono>
9 
10 #include "structures/Color.hpp"
12 
13 struct SDL_Window;
14 struct SDL_Surface;
15 
22 {
23 public:
24  virtual ~RenderTarget();
25 
31  void Clear(const Color& color = Color::Black);
32 
38  void Draw(const Drawable& drawable);
39 
43  void Display();
44 
55 
56 protected:
62  RenderTarget(SDL_Window* target);
63 
69  RenderTarget(SDL_Surface* target);
70 
71 protected:
72  SDL_Renderer* renderer;
73 
74 private:
75  Uint32 m_oFramerate;
76 
77  std::chrono::steady_clock::time_point m_oTimeSinceLastDisplay;
78 };
79 SDLU_END
Provides utility for creating and handling colors.
The base class of everything renderable by RenderTarget.
#define SDLU_BEGIN
Definition: Util.hpp:32
uint32_t Uint32
Definition: Util.hpp:23
Everything that can be rendered derives from this class.
Definition: Drawable.hpp:18
Acts as a wrapper for SDL_Renderer*. You can't (and shouldn't) instantiate this, but rather derive fr...
Definition: RenderTarget.hpp:22
void Draw(const Drawable &drawable)
Draws a sdlu::Drawable to the SDL_Renderer.
virtual ~RenderTarget()
void SetMaxFramerate(Uint32 max)
Sets a maximum framerate on the display function.
RenderTarget(SDL_Surface *target)
Create Renderer and bind it to a texture.
SDL_Renderer * renderer
The renderer object.
Definition: RenderTarget.hpp:72
void Display()
Display the current state of the renderer to the screen.
void Clear(const Color &color=Color::Black)
Clears the display.
RenderTarget(SDL_Window *target)
Create Renderer and bind it to a window.
A structure holding color data.
Definition: Color.hpp:20
static const Color Black
Default Color Black (#000000FF)
Definition: Color.hpp:65