GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
Enumerations | Functions
gp_sdl.h File Reference

A SDL backend. More...

#include <stdint.h>
#include <backends/gp_backend.h>

Go to the source code of this file.

Enumerations

enum  gp_sdl_flags { GP_SDL_FULLSCREEN = 0x01 , GP_SDL_RESIZABLE = 0x02 }
 SDL backend init flags. More...
 

Functions

gp_backendgp_sdl_init (gp_size w, gp_size h, uint8_t bpp, enum gp_sdl_flags flags, const char *caption)
 Initalizes SDL as drawing backend.
 

Detailed Description

A SDL backend.

SDL doesn't expose file descriptors, so the backend does polling.

The backend is thread safe (the critical parts are guarded with a mutex).

The backend is singleton, you can't have two SDL backends running at the same time.

Definition in file gp_sdl.h.

Enumeration Type Documentation

◆ gp_sdl_flags

SDL backend init flags.

Enumerator
GP_SDL_FULLSCREEN 

Start as a full screen.

GP_SDL_RESIZABLE 

Allow for the backend to be resizable.

Definition at line 24 of file gp_sdl.h.

Function Documentation

◆ gp_sdl_init()

gp_backend * gp_sdl_init ( gp_size  w,
gp_size  h,
uint8_t  bpp,
enum gp_sdl_flags  flags,
const char *  caption 
)

Initalizes SDL as drawing backend.

When backend is allready initalized, this function ignores it's parameters and returns pointer to allready initalized SDL backend.

The parameters w h and bpp are directly passed to SDL_SetVideoMode().

If w, h and/or bpp are set to zero, SDL tries to do best fit.

Parameters
wA requested window width.
hA requested window height.
bppA requested depth, bits per pixel.
flagsA SDL backend init flags.
captionA window caption.
Returns
An initialized SDL backend or NULL on a failure, or if SDL wasn't compiled in.