Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
AG_DRIVERSW(3)		     Library Functions Manual		  AG_DRIVERSW(3)

NAME
     AG_DriverSw -- agar single-window driver class

SYNOPSIS
     #include <agar/core.h>
     #include <agar/gui.h>

DESCRIPTION
     AG_DriverSw  is  a  subclass  of  AG_Driver(3) for "single-window" drivers.
     This class of drivers includes dumb framebuffers and  any	other  interface
     where Agar needs to implement a window manager internally.

INHERITANCE HIERARCHY
     AG_Driver(3)-> AG_DriverSw.

INTERNAL API
     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 dimen-
     sions w, h in pixels, and depth in bits per pixel.  The flags argument  de-
     fines   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 ac-
     cept 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 dis-
     play, releasing any resources previously allocated by openVideo() or  open-
     VideoContext().

     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_Sur-
     face(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  openVideo-
     Context()	has  been called before).  If the surface size has changed, Agar
     windows are clamped, moved or resized as appropriate.

STRUCTURE DATA
     For the AG_DriverSw (driver instance) object:

     Uint flags   Option flags.  Possible flags include:

		  AG_DRIVER_SW_OVERLAY	    Enables "overlay" mode, forcing  the
					    OpenGL  state  to be completely ini-
					    tialized and released at every  ren-
					    dering cycle.

		  AG_DRIVER_SW_BGPOPUP	    Display   a  generic  "window  list"
					    popup menu on right-click over empty
					    background.

		  AG_DRIVER_SW_FULLSCREEN   The driver	is  currently  in  full-
					    screen mode (read-only).

     Uint rNom	  Nominal display refresh rate in ms.

     int rCur	  Effective display refresh rate in ms.

     Uint winop   Modal  window-manager  operation  in	effect,  may  be  set to
		  AG_WINOP_NONE (normal operation), AG_WINOP_MOVE (a  window  is
		  being  moved)  or  AG_WINOP_[LRH]RESIZE (a window is being re-
		  sized left/right/horizontally).

SEE ALSO
     AG_Driver(3), AG_DriverMw(3), AG_InitGraphics(3), AG_Intro(3)

HISTORY
     The AG_DriverSw class first appeared in Agar 1.4.0.

Agar 1.7			February 18, 2023		  AG_DRIVERSW(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=AG_DriverSw&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help