Agar Logo by @eightbit

Agar 1.8 Manual

(Printable Version)
AG_InitVideoSDL2(3)

SYNOPSIS

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

DESCRIPTION

ScreenshotIf Agar was compiled with SDL 2.x support (--with-sdl2), the "sdl2fb" (frame-buffer), "sdl2gl" (single-window GL) and "sdl2mw" (multi-window GL) drivers become available.

INITIALIZATION


int AG_InitVideoSDL2 (SDL_Surface *display, Uint flags)

int AG_SetVideoSurfaceSDL2 (SDL_Surface *display)


The AG_InitVideoSDL() function initializes the GUI to attach to an existing SDL2 display surface. It accepts the following flags options:
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.
AG_VIDEO_FIXEDIf a window manager is available, request that the window be non-resizable.
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)).

Note: When creating a new SDL display (as opposed to attaching to an existing one), consider calling AG_InitGraphics(3) with the "<SDL2>" argument instead of using AG_InitVideoSDL2().

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

Note: The AG_InitVideoSDL2() and AG_SetVideoSurfaceSDL2() functions are only available if Agar has been compiled with SDL2 support (to find out at compile-time, include "<agar/config/have_sdl2.h>" and test for HAVE_SDL2).


SEE ALSO


HISTORY

SDL1 support first appeared in Agar 1.0. The "sdlfb" and "sdlgl" driver modules first appeared in Agar 1.4.0. SDL2 support with the "sdl2fb", "sdl2gl" and "sdl2mw" driver modules appeared in Agar 1.7.0.

Csoft.net ElectronTubeStore