souleng
Game engine providing full Python scripting support
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
Renderer Struct Reference

#include <Renderer.hpp>

Public Member Functions

void SetRenderDrawColor (Uint8 r, Uint8 b, Uint8 g, Uint8 a)
 
void RenderClear ()
 Clears the entire render target.
 
void RenderPresent ()
 Updates the window with any rendered textures.
 
SDL_Texture * CreateTextureFromSurface (SDL_Surface *pixels)
 
void RenderTexture (SDL_Texture *tex, SDL_FRect *srcRect, SDL_FRect *targetRect)
 
void RenderRect (SDL_FRect *rect)
 

Static Public Member Functions

static Rendererinitialize (SDL_Window *window)
 
static Rendererinstance ()
 Singleton accessor function for the Renderer.
 

Detailed Description

Singleton class for assisting with rendering. This class prevents the need to pass an SDL_Renderer to every object, but more importantly, it allows calling rendering related code from Python.

Member Function Documentation

◆ CreateTextureFromSurface()

SDL_Texture * Renderer::CreateTextureFromSurface ( SDL_Surface * pixels)

Creates an SDL_Texture from a buffer of pixels

Parameters
pixelsThe buffer of pixels to use

◆ initialize()

Renderer * Renderer::initialize ( SDL_Window * window)
static

Initialize the SDL_Renderer by providing a window. Must be called before any rendering code.

Parameters
windowThe window being rendered to

◆ RenderRect()

void Renderer::RenderRect ( SDL_FRect * rect)

Renders a simple rectangle to the screen, as a plain white outline

Parameters
rectThe area of the rectangle to render

◆ RenderTexture()

void Renderer::RenderTexture ( SDL_Texture * tex,
SDL_FRect * srcRect,
SDL_FRect * targetRect )

Renders a texture to the screen

Parameters
texThe texture to render
srcRectSelects the region of the texture to render, or renders all of it if NULL
destRectThe region of the viewport to render the texture to

◆ SetRenderDrawColor()

void Renderer::SetRenderDrawColor ( Uint8 r,
Uint8 b,
Uint8 g,
Uint8 a )

Sets the background color for the window

Parameters
r,g,b,aThe RGBA components of the color

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