The
AG_DriverSwClass structure describes a "single-window" graphics driver
(i.e., a dumb framebuffer,
or any other interface where Agar will need to provide its own window manager).
AG_DriverSwClass inherits from
AG_DriverClass and is defined as follows:
typedef struct ag_driver_sw_class {
struct ag_driver_class _inherit;
Uint flags;
int (*openVideo)(void *drv, Uint w, Uint h, int depth,
Uint flags);
int (*openVideoContext)(void *drv, void *ctx, Uint flags);
int (*setVideoContext)(void *drv, void *ctx);
void (*closeVideo)(void *drv);
int (*videoResize)(void *drv, Uint w, Uint h);
int (*videoCapture)(void *drv, AG_Surface **);
void (*videoClear)(void *drv, AG_Color c);
} AG_DriverSwClass;
|
At this time, there are no flag options and
flags should be initialized to 0.
The
openVideo() operation opens a new graphics display of specified dimensions
w, h in pixels, and
depth in bits per pixel.
The
flags argument defines the various flags options passed by
AG_InitVideo() (see
AG_InitVideo(3) for a description of those options).
The
openVideoContext() operation "attaches" Agar to an existing display context, passed as
ctx. For example, drivers for the SDL library will accept a pointer to a
SDL_Surface(3) as
ctx. The
flags argument specifies video options (see
AG_InitVideo(3) for the list of options).
The
closeVideo() operation should "close" or detach from a graphics display, releasing any
resources previously allocated by
openVideo() or
openVideoContext().
The
videoResize() operation resizes the video display to the specified geometry in pixels.
It should return -1 if the display cannot be resized, or 0 on success.
videoCapture() captures the content of the video display to an
AG_Surface(3). The function should return 0 on success or -1 on failure.
videoClear() clears the video background with the specified color
c.
setVideoContext() changes the existing display context (assumes
openVideoContext() has been called before).
If the surface size has changed, Agar windows are clamped, moved or
resized as appropriate.
|