2D bitmap graphics library with emphasis on speed and correctness
No Matches
gp_backend_init.h File Reference

General backend init. More...

#include <backends/gp_backend.h>

Go to the source code of this file.


gp_backendgp_backend_init (const char *params, gp_size pref_w, gp_size pref_h, const char *caption)
 Generic backend initialization.
static void gp_backend_init_help (void)
 Prints information about all backends and parameters.

Detailed Description

General backend init.

Simplified backend initalization interface good enough for most of the cases.

Definition in file gp_backend_init.h.

Function Documentation

◆ gp_backend_init()

gp_backend * gp_backend_init ( const char *  params,
gp_size  pref_w,
gp_size  pref_h,
const char *  caption 

Generic backend initialization.

Example usage:

const char *backend_opts = NULL;
gp_backend *backend;
while ((opt = getopt(argc, argv, "b:")) {
switch (opt) {
case 'b':
backend_opts = optarg;
backend = gp_backend_init(backend_opts, 0, 0, "Backend init example");
if (!backend)
gp_backend * gp_backend_init(const char *params, gp_size pref_w, gp_size pref_h, const char *caption)
Generic backend initialization.
A backend.
Definition gp_backend.h:72
paramsA backend init string, in most cases passed down by an user, when NULL is passed in params the library attempts to autodetect which backend to use. The params format is "backend_name:backend_params" e.g. "SDL:fs" is string for fullscreen SDL backend. If "help" is passed as a backend name a help is printed into the stderr.
pref_wPreferred width pass 0 for default.
pref_hPreferred height pass 0 for default.
captionA caption used in a case that backends runs in a window with a caption.
Initalized backend or NULL in case of failure.

Referenced by gp_backend_init_help().

◆ gp_backend_init_help()

static void gp_backend_init_help ( void  )

Prints information about all backends and parameters.

Prints information about all backends including description of their parameters into the stderr.

Definition at line 65 of file gp_backend_init.h.

References gp_backend_init().