FreeBASIC  0.91.0
GFXDRIVER Struct Reference

#include <fb_gfx.h>

Data Fields

char * name
 Name of the graphics driver. More...
 
int(* init )(char *title, int w, int h, int depth, int refresh_rate, int flags)
 Driver initialization function pointer. More...
 
void(* exit )(void)
 Driver exit function pointer. More...
 
void(* lock )(void)
 Driver lock function pointer. More...
 
void(* unlock )(void)
 Driver unlock function pointer. More...
 
void(* set_palette )(int index, int r, int g, int b)
 Driver set palette function pointer. More...
 
void(* wait_vsync )(void)
 Driver wait for vertical synchronization function pointer. More...
 
int(* get_mouse )(int *x, int *y, int *z, int *buttons, int *clip)
 Driver get mouse state function pointer. More...
 
void(* set_mouse )(int x, int y, int cursor, int clip)
 Driver set mouse state function pointer. More...
 
void(* set_window_title )(char *title)
 Driver set window title function pointer. More...
 
int(* set_window_pos )(int x, int y)
 Driver set/get window position function pointer. More...
 
int *(* fetch_modes )(int depth, int *size)
 Driver fetch mode list function pointer. More...
 
void(* flip )(void)
 Driver page flip function pointer. More...
 
void(* poll_events )(void)
 Driver poll events function pointer. More...
 

Detailed Description

Definition at line 257 of file fb_gfx.h.

Field Documentation

void(* GFXDRIVER::exit)(void)

Driver exit function pointer.

This function is called when a driver should clean up all allocated resources and restore the graphics device to its state before the driver was initialized.

In some cases this function will be called even when a driver failed to initialize. It is the driver's responsibility to track which resources it has or has not allocated so that such resources are not released twice if the exit function is called when the init function failed.

This function pointer must not be NULL.

Definition at line 301 of file fb_gfx.h.

int*(* GFXDRIVER::fetch_modes)(int depth, int *size)

Driver fetch mode list function pointer.

This function returns a list of available modes for this driver. The list need not be sorted or ordered in any way.

Can be NULL if this driver cannot obtain a list of available modes.

Parameters
[in]depthbits per pixel for which to retrieve modes
[in]sizecount of ints returned
Returns
array of size ints allocated by malloc(), each containing (height | (width << 16)) for one of the available modes

Definition at line 393 of file fb_gfx.h.

void(* GFXDRIVER::flip)(void)

Driver page flip function pointer.

This function flips the drawing page with the visible page. It is only needed for OpenGL drivers and can be NULL otherwise.

Definition at line 400 of file fb_gfx.h.

int(* GFXDRIVER::get_mouse)(int *x, int *y, int *z, int *buttons, int *clip)

Driver get mouse state function pointer.

The driver should fill the parameters with the current mouse state. The driver can assume that all of the pointers are valid (non-null).

Can be NULL if the driver cannot get the mouse state.

Parameters
[out]xx position in pixels relative to the graphics drawing area
[out]yy position in pixels relative to the graphics drawing area
[out]zscroll wheel position; initially 0
[out]buttonsbitfield with each bit representing the state of one button (1 if the button is pressed, 0 if not)
[out]clipcurrent mouse clipping status (1 if the mouse is currently clipped to the graphics drawing area; 0 if it is not)
Returns
0 on success; -1 on failure

Definition at line 353 of file fb_gfx.h.

int(* GFXDRIVER::init)(char *title, int w, int h, int depth, int refresh_rate, int flags)

Driver initialization function pointer.

This function is called from fb_GfxScreen or fb_GfxScreenRes; the driver should first check to see if there are any flags that it does not support (for example, DRIVER_OPENGL). If all flags specified are supported by this driver, the driver should attempt to set the requested mode.

This function pointer must not be NULL.

Parameters
[in]titleinitial window title
[in]wdesired display mode width in pixels
[in]hdesired display mode height in pixels
[in]refresh_ratedesired refresh rate in Hz
[in]flagsDRIVER_ flags
Returns
-1 on failure; 0 on success

Definition at line 287 of file fb_gfx.h.

void(* GFXDRIVER::lock)(void)

Driver lock function pointer.

The driver must not update the display from the internal framebuffer between calls to lock and unlock.

This function pointer must not be NULL.

Definition at line 310 of file fb_gfx.h.

char* GFXDRIVER::name

Name of the graphics driver.

This string is compared case-insensitively with the FBGFX environment variable and/or the ScreenControl SET_DRIVER_NAME string, if those have been set, to override the automatic driver selection.

This string must also be human-readable.

Definition at line 267 of file fb_gfx.h.

void(* GFXDRIVER::poll_events)(void)

Driver poll events function pointer.

This function should poll for event and post those that are available with fb_hPostEvent. It is only needed for OpenGL drivers and can be NULL otherwise.

Definition at line 407 of file fb_gfx.h.

void(* GFXDRIVER::set_mouse)(int x, int y, int cursor, int clip)

Driver set mouse state function pointer.

Can be NULL if the driver cannot set the mouse state.

Parameters
[in]xx position in pixels relative to the graphics drawing area; if >= 0, the mouse cursor should be moved here; otherwise, this parameter should be ignored
[in]yy position in pixels relative to the graphics drawing area; if >= 0, the mouse cursor should be moved here; otherwise, this parameter should be ignored
[in]cursorcursor visibility state; if 0, the mouse cursor should be hidden; if > 0, the mouse cursor should be shown; otherwise, this parameter should be ignored
[in]clipcursor clip state; if 0, the mouse cursor should be unclipped; if > 0, the mouse cursor should be clipped to the graphics drawing area; otherwise, this parameter should be ignored

Definition at line 364 of file fb_gfx.h.

void(* GFXDRIVER::set_palette)(int index, int r, int g, int b)

Driver set palette function pointer.

Parameters
[in]indexindex of the palette entry to set in the range [0..255]
[in]rred value in the range [0..63]
[in]ggreen value in the range [0..63]
[in]bblue value in the range [0..63]

Definition at line 327 of file fb_gfx.h.

int(* GFXDRIVER::set_window_pos)(int x, int y)

Driver set/get window position function pointer.

Parameters
[in]xx position in pixels to move the window to, relative to the display device; if 0x80000000, ignore
[in]yy position in pixels to move the window to, relative to the display device; if 0x80000000, ignore
Returns
(current x position & 0xFFFF) | (current y position << 16)

Definition at line 380 of file fb_gfx.h.

void(* GFXDRIVER::set_window_title)(char *title)

Driver set window title function pointer.

Can be NULL if the driver cannot set the window title.

Parameters
[in]titlestring to set the window title to

Definition at line 372 of file fb_gfx.h.

void(* GFXDRIVER::unlock)(void)

Driver unlock function pointer.

This function pointer must not be NULL.

See Also
lock

Definition at line 318 of file fb_gfx.h.

void(* GFXDRIVER::wait_vsync)(void)

Driver wait for vertical synchronization function pointer.

This function should block until the next vertical retrace period. If it is not possible to use the actual hardware vertical retrace, this function should wait an amount of time equivalent to 1 / refresh_rate seconds.

Can be NULL if the driver cannot wait for vsync.

Definition at line 337 of file fb_gfx.h.


The documentation for this struct was generated from the following file: