SDL Utility
RenderTarget Class Reference

Acts as a wrapper for SDL_Renderer*. You can't (and shouldn't) instantiate this, but rather derive from it. More...

#include <RenderTarget.hpp>

Inheritance diagram for RenderTarget:
RenderWindow

Public Member Functions

virtual ~RenderTarget ()
 
void Clear (const Color &color=Color::Black)
 Clears the display. More...
 
void Draw (const Drawable &drawable)
 Draws a sdlu::Drawable to the SDL_Renderer. More...
 
void Display ()
 Display the current state of the renderer to the screen. More...
 
void SetMaxFramerate (Uint32 max)
 Sets a maximum framerate on the display function. More...
 

Protected Member Functions

 RenderTarget (SDL_Window *target)
 Create Renderer and bind it to a window. More...
 
 RenderTarget (SDL_Surface *target)
 Create Renderer and bind it to a texture. More...
 

Protected Attributes

SDL_Renderer * renderer
 The renderer object. More...
 

Detailed Description

Acts as a wrapper for SDL_Renderer*. You can't (and shouldn't) instantiate this, but rather derive from it.

Constructor & Destructor Documentation

◆ ~RenderTarget()

virtual RenderTarget::~RenderTarget ( )
virtual

◆ RenderTarget() [1/2]

RenderTarget::RenderTarget ( SDL_Window *  target)
protected

Create Renderer and bind it to a window.

Parameters
[in]targetThe SDL_Window to bind to

◆ RenderTarget() [2/2]

RenderTarget::RenderTarget ( SDL_Surface *  target)
protected

Create Renderer and bind it to a texture.

Parameters
[in]targetThe SDL_Surface to bind to

Member Function Documentation

◆ Clear()

void RenderTarget::Clear ( const Color color = Color::Black)

Clears the display.

Parameters
[in]colorThe color to clear the display with

◆ Display()

void RenderTarget::Display ( )

Display the current state of the renderer to the screen.

◆ Draw()

void RenderTarget::Draw ( const Drawable drawable)

Draws a sdlu::Drawable to the SDL_Renderer.

Parameters
[in]drawableA reference to a derived class of Drawable

◆ SetMaxFramerate()

void RenderTarget::SetMaxFramerate ( Uint32  max)

Sets a maximum framerate on the display function.

If the maximum framerate is not 0, SDL_Delay() will be called after each Display() to ensure that the time between displays is not shorter than the framerate limit.

Parameters
[in]maxThe new maximum framerate

Member Data Documentation

◆ renderer

SDL_Renderer* RenderTarget::renderer
protected

The renderer object.


The documentation for this class was generated from the following file: