souleng
Game engine providing full Python scripting support
|
#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 Renderer * | initialize (SDL_Window *window) |
static Renderer * | instance () |
Singleton accessor function for the Renderer. | |
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.
SDL_Texture * Renderer::CreateTextureFromSurface | ( | SDL_Surface * | pixels | ) |
Creates an SDL_Texture
from a buffer of pixels
pixels | The buffer of pixels to use |
|
static |
Initialize the SDL_Renderer
by providing a window. Must be called before any rendering code.
window | The window being rendered to |
void Renderer::RenderRect | ( | SDL_FRect * | rect | ) |
Renders a simple rectangle to the screen, as a plain white outline
rect | The area of the rectangle to render |
void Renderer::RenderTexture | ( | SDL_Texture * | tex, |
SDL_FRect * | srcRect, | ||
SDL_FRect * | targetRect ) |
Renders a texture to the screen
tex | The texture to render |
srcRect | Selects the region of the texture to render, or renders all of it if NULL |
destRect | The region of the viewport to render the texture to |
void Renderer::SetRenderDrawColor | ( | Uint8 | r, |
Uint8 | b, | ||
Uint8 | g, | ||
Uint8 | a ) |
Sets the background color for the window
r,g,b,a | The RGBA components of the color |