View lcov test coverage results on http://www.ufoot.org/liquidwar/v6/doc/coverage/src/lib/gfx/index.html.
sys_context: global system context
backend: the graphical backend to use
video_mode: the video mode to use at start up
resize_callback: a callback function which will be called at each resize event
Sets up the graphical backend for good, initializing a video mode and allocating ressources. This call can typically fail if there’s no device available, if the user doesn’t have enough rights to access the hardware, and so on.
Return value: 1 on success, 0 if not
sys_context: global system context
backend: the backend to quit
Uninitializes the backend, that is, exits the graphical mode. All threads that use graphics must be closed when this is called.
Return value: none.
sys_context: global system context
backend: the backend to represent
Returns a readable version of the backend object.
Return value: a newly allocated pointer.
sys_context: global system context
backend: the backend to use
video_mode: the new video mode
This function changes the video mode. Note that the first time you set up
the graphical environment you must call lw6gfx_init
but to change the current
mode, use this function. It should reload backend data automatically if needed
(textures for instance). Note that before giving up and failing this function
will try alternate video modes, and you’re not garanteed to have the right mode
after the call, even if it returns true. To check this, use lw6gfx_get_video_mode
.
Return value: 1 on success, 0 on failure;
sys_context: global system context
backend: the backend to use
video_mode: the current video mode (will be overwritten, out parameter)
This function returns the current video mode.
Return value: 1 on success, 0 on failure;
sys_context: global system context
backend: the backend to use
fullscreen_modes: the available fullscreen modes (will be overwritten, out parameter)
This function returns the current video mode.
Return value: 1 on success, 0 on failure;
sys_context: global system context
backend: the backend to use
This function "pumps" events, that is gets pending events, puts them in queues, maintains internal states up to date. You really must call this very often or no input will be processed at all.
Return value: a pointer on the internal input state, musn’t be freed.
sys_context: global system context
backend: the graphical backend to use
mask: display flag, tells what to display
look: the look, the skin, contains display options
level: the level to display
game_struct: the game_struct associated with the level
game_state: the game_state associated with the level
local_cursors: the cursor to center the focus on
menu: the menu to display
progress: the value of the progress indicator
fps: the number of frames per second to display
mps: the number of moves per second to display
log_list: log messages to display
capture: wether to enable capture mode or not
gfx_debug: wether to enable gfx debugging tools
debug_team_id: for debug display, team to display informations about
debug_layer_id: for debug display, layer to display
This is the major drawing function, the one that encapsulates all others. As the program uses a separate thread to display things, we just pass this function many parameters, and let it do its job alone. So many parameters might sometimes be useless. It also allows the graphics backend decide wether menus and hud and background should interact. Or not.
Return value: 1 on success, 0 on failure.
sys_context: global system context
argc: argc, as passed to main
argv: argv, as passed to main
List available gfx backends. The hash contains pairs with id and name for each backend. The id is the technical key you can use to load the backend, the name is something more readable you can display in an interface. The backend objects themselves are not instanciated by this (in fact, they are, but released on the fly) you need to load and initialize them afterwards.
Return value: hash containing id/name pairs.
sys_context: global system context
argc: argc, as passed to main
argv: argv, as passed to main
name: string containing gfx key, typically got from lw6gfx_get_backends
Creates a gfx backend, this is just about loading the dynamic library if needed, and/or check gfx engine is available, and connect to it. It does not perform initialization.
Return value: gfx backend.
sys_context: global system context
backend: gfx backend to destroy
Frees the ressources associated to a gfx, which must have been properly uninitialized before.
Return value: none.
sys_context: global system context
mode: test mode (bitmask)
Registers all tests for the libgfx module.
Return value: 1 if test is successfull, 0 on error.
sys_context: global system context
mode: test mode (bitmask)
Runs the gfx
module test suite, testing most (if not all...)
functions.
Return value: 1 if test is successfull, 0 on error.
The gfx backend is the first argument passed to any gfx function, it contains reference to all the functions which can be used as well as a pointer on associated data. In OO, this would just be an object, with members and methods, using polymorphism through opaque pointers.
Type: lw6dyn_dl_handle_t *
Definition: lw6dyn_dl_handle_t* lw6gfx_backend_s::dl_handle
Handle on dynamic library (if it makes sense).
Type: void *
Definition: void* lw6gfx_backend_s::gfx_context
Gfx specific data, what is behind this pointer really depends on the gfx engine.
Type: int
Definition: int lw6gfx_backend_s::argc
The argc value passed to main.
Type: const char **
Definition: const char** lw6gfx_backend_s::argv
The argv value passed to main.
Type: lw6sys_mutex_t *
Definition: lw6sys_mutex_t* lw6gfx_backend_s::call_lock
Lock used to avoid concurrent access to underlying libs.
Type: u_int32_t
Definition: u_int32_t lw6gfx_backend_s::id
The id of the object, this is non-zero and unique within one run session, incremented at each object creation.
Type: void *(*
Definition: void*(* lw6gfx_backend_s::init)(lw6sys_context_t *sys_context, int argc, const char *argv[], lw6gui_video_mode_t *video_mode, lw6gui_resize_callback_func_t resize_callback)
Pointer on lw6gfx_init callback code.
Type: void(*
Definition: void(* lw6gfx_backend_s::quit)(lw6sys_context_t *sys_context, void *gfx_context)
Pointer on lw6gfx_quit callback code.
Type: char *(*
Definition: char*(* lw6gfx_backend_s::repr)(lw6sys_context_t *sys_context, void *gfx_context, u_int32_t id)
Pointer on lw6gfx_repr callback code.
Type: int(*
Definition: int(* lw6gfx_backend_s::set_video_mode)(lw6sys_context_t *sys_context, void *gfx_context, lw6gui_video_mode_t *video_mode)
Pointer on lw6gfx_set_video_mode callback code.
Type: int(*
Definition: int(* lw6gfx_backend_s::get_video_mode)(lw6sys_context_t *sys_context, void *gfx_context, lw6gui_video_mode_t *video_mode)
Pointer on lw6gfx_get_video_mode callback code.
Type: int(*
Definition: int(* lw6gfx_backend_s::get_fullscreen_modes)(lw6sys_context_t *sys_context, void *gfx_context, lw6gui_fullscreen_modes_t *modes)
Pointer on lw6gfx_get_fullscreen_modes callback code.
Type: lw6gui_input_t *(*
Definition: lw6gui_input_t*(* lw6gfx_backend_s::pump_events)(lw6sys_context_t *sys_context, void *gfx_context)
Pointer on lw6gfx_pump_events code.
Type: int(*
Definition: int(* lw6gfx_backend_s::display)(lw6sys_context_t *sys_context, void *gfx_context, int mask, const lw6gui_look_t *look, const lw6map_level_t *level, const lw6ker_game_struct_t *game_struct, const lw6ker_game_state_t *game_state, lw6pil_local_cursors_t *local_cursors, lw6gui_menu_t *menu, float progress, float fps, float mps, const char **log_list, int capture, int gfx_debug, int debug_team_id, int debug_layer_id)
Pointer on lw6gfx_display code.