FifeGUI 0.2.0
A C++ GUI library designed for games.
fcn::sdl2 Namespace Reference

Classes

class  Graphics
class  Image
class  ImageLoader
class  Input
class  TrueTypeFont

Typedefs

using Graphics = fcn::sdl2::Graphics
using Image = fcn::sdl2::Image
using ImageLoader = fcn::sdl2::ImageLoader
using Input = fcn::sdl2::Input
using TrueTypeFont = fcn::sdl2::TrueTypeFont

Functions

std::shared_ptr< SDL_Renderer > makeSDLSharedPtr (SDL_Renderer *renderer)
std::shared_ptr< SDL_Surface > makeSDLSharedPtr (SDL_Surface *surface)
std::shared_ptr< SDL_Texture > makeSDLSharedPtr (SDL_Texture *texture)
std::shared_ptr< SDL_Window > makeSDLSharedPtr (SDL_Window *window)
template<typename T>
SDLBlend (T source, T dest, unsigned char alpha)
template<typename T>
SDLBlendColor (T src, T dst, unsigned char alpha, SDL_PixelFormat const *f)
Color SDLgetPixel (SDL_Surface *surface, int x, int y)
void SDLputPixel (SDL_Surface *surface, int x, int y, Color const &color)
void SDLputPixelAlpha (SDL_Surface *surface, int x, int y, Color const &color)

Detailed Description

Unified header for the SDL backend.

Typedef Documentation

◆ Graphics

using fcn::sdl2::Graphics = fcn::sdl2::Graphics

Backend alias for the SDL2 graphics implementation.

Definition at line 25 of file sdl.hpp.

◆ Image

using fcn::sdl2::Image = fcn::sdl2::Image

Backend alias for the SDL image implementation.

Definition at line 28 of file sdl.hpp.

◆ ImageLoader

using fcn::sdl2::ImageLoader = fcn::sdl2::ImageLoader

Backend alias for the SDL image loader.

Definition at line 31 of file sdl.hpp.

◆ Input

using fcn::sdl2::Input = fcn::sdl2::Input

Backend alias for the SDL input implementation.

Definition at line 34 of file sdl.hpp.

◆ TrueTypeFont

using fcn::sdl2::TrueTypeFont = fcn::sdl2::TrueTypeFont

Backend alias for the SDL TrueType font wrapper.

Definition at line 37 of file sdl.hpp.

Function Documentation

◆ makeSDLSharedPtr() [1/4]

std::shared_ptr< SDL_Renderer > fcn::sdl2::makeSDLSharedPtr ( SDL_Renderer * renderer)
inline

Create a shared_ptr that will destroy the SDL_Renderer when released.

Definition at line 50 of file sdl.hpp.

◆ makeSDLSharedPtr() [2/4]

std::shared_ptr< SDL_Surface > fcn::sdl2::makeSDLSharedPtr ( SDL_Surface * surface)
inline

Create a shared_ptr that will free the SDL_Surface when released.

Definition at line 60 of file sdl.hpp.

◆ makeSDLSharedPtr() [3/4]

std::shared_ptr< SDL_Texture > fcn::sdl2::makeSDLSharedPtr ( SDL_Texture * texture)
inline

Create a shared_ptr that will destroy the SDL_Texture when released.

Definition at line 70 of file sdl.hpp.

◆ makeSDLSharedPtr() [4/4]

std::shared_ptr< SDL_Window > fcn::sdl2::makeSDLSharedPtr ( SDL_Window * window)
inline

Create a shared_ptr that will destroy the SDL_Window when released.

Definition at line 40 of file sdl.hpp.

◆ SDLBlend()

template<typename T>
T fcn::sdl2::SDLBlend ( T source,
T dest,
unsigned char alpha )
inline

Blends two color components together.

Parameters
sourcethe source color component.
destthe destination color component.
alphaalpha value (0-255) used for blending.

Definition at line 155 of file pixel.hpp.

Referenced by SDLBlendColor(), and SDLputPixelAlpha().

◆ SDLBlendColor()

template<typename T>
T fcn::sdl2::SDLBlendColor ( T src,
T dst,
unsigned char alpha,
SDL_PixelFormat const * f )
inline

Blends two packed color values together using the supplied pixel format.

Parameters
srcthe source packed color value.
dstthe destination packed color value.
alphaalpha value (0-255) used for blending.
fpixel format describing masks/shifts for color components.

Definition at line 169 of file pixel.hpp.

References SDLBlend().

Referenced by SDLputPixelAlpha().

◆ SDLgetPixel()

Color fcn::sdl2::SDLgetPixel ( SDL_Surface * surface,
int x,
int y )
inline

Checks a pixels color of an SDL_Surface.

Parameters
surfacean SDL_Surface where to check for a pixel color.
xthe x coordinate on the surface.
ythe y coordinate on the surface.
Returns
a color of a pixel.

Definition at line 27 of file pixel.hpp.

Referenced by fcn::sdl2::Image::getPixel().

◆ SDLputPixel()

void fcn::sdl2::SDLputPixel ( SDL_Surface * surface,
int x,
int y,
Color const & color )
inline

Puts a pixel on an SDL_Surface.

Parameters
surfaceThe SDL_Surface to write the pixel to.
xthe x coordinate on the surface.
ythe y coordinate on the surface.
colorthe color the pixel should be in.

Definition at line 95 of file pixel.hpp.

References fcn::Color::b, fcn::Color::g, and fcn::Color::r.

Referenced by fcn::sdl2::Image::putPixel(), and SDLputPixelAlpha().

◆ SDLputPixelAlpha()

void fcn::sdl2::SDLputPixelAlpha ( SDL_Surface * surface,
int x,
int y,
Color const & color )
inline

Puts a pixel on an SDL_Surface with alpha blending.

Parameters
surfaceThe SDL_Surface to write the pixel to.
xthe x coordinate on the surface.
ythe y coordinate on the surface.
colorthe color the pixel should be in (including alpha).

Definition at line 197 of file pixel.hpp.

References fcn::Color::a, fcn::Color::b, fcn::Color::g, fcn::Color::r, SDLBlend(), SDLBlendColor(), and SDLputPixel().