Agar Logo

Agar 1.7 Manual

(Printable Version)
AG_InitVideoSDL(3)

SYNOPSIS

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

DESCRIPTION

ScreenshotIf Agar has been compiled with SDL1 support (--with-sdl), the "sdlfb" and "sdlgl" driver modules become available, and the GUI system can be attached to an existing SDL display context. If Agar has been compiled with SDL2 support (--with-sdl2), the "sdl2fb" and "sdl2gl" drivers become available.

Note: When creating a new SDL display (as opposed to attaching to an existing one), you can call AG_InitGraphics(3) with the "<SDL>" or "<SDL2>" argument instead of using AG_InitVideoSDL().

INITIALIZATION


int AG_InitVideoSDL (SDL_Surface *display, Uint flags)

int AG_SetVideoSurfaceSDL (SDL_Surface *display)

int AG_ResizeDisplay (int w, int h)

void AG_SetVideoResizeCallback (void (*fn)(Uint w, Uint h)))


The AG_InitVideoSDL() function initializes the GUI to attach to an existing SDL display surface. If the specified surface has the SDL_OPENGL flag then the GL-capable driver "sdlgl" (or "sdl2gl") is used. Otherwise, the direct frame-buffer driver "sdlfb" (or "sdl2fb") is used instead. The AG_InitVideoSDL() function accepts the following flags options:
AG_VIDEO_HWSURFACERequest a hardware frame buffer (SDL1 only, sets SDL_HWSURFACE).
AG_VIDEO_ASYNCBLITEnable asynchronous blitting updates (SDL1 only, sets SDL_ASYNCBLIT).
AG_VIDEO_ANYFORMATDisable emulation of surface depth (SDL1 only, sets SDL_ANYFORMAT).
AG_VIDEO_HWPALETTEExclusive palette access (SDL1 only, sets SDL_HWPALETTE).
AG_VIDEO_DOUBLEBUFEnable double-buffering in frame buffer mode (SDL1 only).
AG_VIDEO_FULLSCREENStart up application in full-screen mode
AG_VIDEO_RESIZABLEIf a window manager is available, request that the application be resizable. This is the default with SDL2.
AG_VIDEO_FIXEDIf a window manager is available, request that the window be non-resizable. This is the default with SDL1.
AG_VIDEO_BORDERLESSIf a window manager is available, disable window decorations.
AG_VIDEO_NOFRAMEAlias for AG_VIDEO_BORDERLESS.
AG_VIDEO_BGPOPUPMENUWhenever the user right-clicks on an area not covered by an Agar window, display a standard pop-up menu with the list of active windows.
AG_VIDEO_OPENGLRequire OpenGL mode. If OpenGL is not available, initialization will fail.
AG_VIDEO_OPENGL_OR_SDLTry OpenGL mode if available, otherwise fallback to SDL frame-buffer mode.
AG_VIDEO_OVERLAYRun in OpenGL "overlay" mode. In this mode, Agar will never clear the background or swap GL buffers. Before rendering itself, Agar will also save the current OpenGL state and restore it completely once rendering is complete. Internally, this option causes the AG_DRIVER_SW_OVERLAY option to be set (see AG_DriverSw(3)).

The AG_SetVideoSurfaceSDL() function can be used to reattach to a different (e.g., a newly resized) SDL display surface without reinitializing the GUI.

Note: The AG_InitVideoSDL() and AG_SetVideoSurfaceSDL() functions are only available if Agar has been compiled with SDL1 support (to find out, include "<agar/config/have_sdl.h>" and test for HAVE_SDL).

The AG_ResizeDisplay() function resizes the video display to the specified dimensions in pixels. AG_SetVideoResizeCallback() registers a callback function which will be invoked whenever the display is resized. Both of these functions are only applicable to single-window drivers.

SEE ALSO


HISTORY

SDL1 support first appeared in Agar 1.0. The "sdlfb" and "sdlgl" driver modules first appeared in Agar 1.4.0. The "sdl2fb" and "sdl2gl" driver modules appeared in Agar 1.7.0.

Csoft.net ElectronTubeStore