SYNOPSIS
#include <agar/core.h> #include <agar/gui.h>
DESCRIPTION
If 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_FULLSCREEN | Start up application in full-screen mode |
| AG_VIDEO_RESIZABLE | If a window manager is available, request that the application be resizable. This is the default. |
| AG_VIDEO_FIXED | If a window manager is available, request that the window be non-resizable. |
| AG_VIDEO_BORDERLESS | If a window manager is available, disable window decorations. |
| AG_VIDEO_NOFRAME | Alias for AG_VIDEO_BORDERLESS. |
| AG_VIDEO_BGPOPUPMENU | Whenever 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_OPENGL | Require OpenGL mode. If OpenGL is not available, initialization will fail. |
| AG_VIDEO_OPENGL_OR_SDL | Try OpenGL mode if available, otherwise fallback to SDL frame-buffer mode. |
| AG_VIDEO_OVERLAY | Run 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 ↑
AG_Core(3), AG_DriverSDLFB(3), AG_DriverSDLGL(3), AG_DriverSDL2FB(3), AG_DriverSDL2GL(3), AG_DriverSDL2MW(3), AG_InitGraphics(3), AG_InitVideoSDL(3), AG_Intro(3)
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.
