Man page - sdl_init(3)
Packages contains this manual
Manual
SDL_Init
NAMEHEADER FILE
SYNOPSIS
DESCRIPTION
FUNCTION PARAMETERS
RETURN VALUE
AVAILABILITY
SEE ALSO
NAME
SDL_Init - Initialize the SDL library.
HEADER FILE
Defined in SDL3/SDL_init.h
SYNOPSIS
#include "SDL3/SDL.h"
bool SDL_Init(SDL_InitFlags flags);
DESCRIPTION
SDL_Init () simply forwards to calling
SDL_InitSubSystem (). Therefore, the two may be used interchangeably. Though for readability of your code
SDL_InitSubSystem () might be preferred.
The file I/O
(for example:
SDL_IOFromFile
) and threading (
SDL_CreateThread
) subsystems are initialized by
default. Message boxes (
SDL_ShowSimpleMessageBox
)
also attempt to work without initializing the video
subsystem, in hopes of being useful in showing an error
dialog when
SDL_Init
fails. You must specifically initialize other subsystems if
you use them in your application.
Logging (such as SDL_Log ) works without initialization, too. flags may be any of the following ORβd together:
β’
SDL_INIT_AUDIO
: audio subsystem; automatically
initializes the events subsystem
β’
SDL_INIT_VIDEO
: video subsystem; automatically
initializes the events subsystem, should be initialized on
the main
thread.
β’
SDL_INIT_JOYSTICK
: joystick subsystem;
automatically initializes the events subsystem
β’ SDL_INIT_HAPTIC : haptic (force feedback) subsystem
β’
SDL_INIT_GAMEPAD
: gamepad subsystem; automatically
initializes the joystick subsystem
β’ SDL_INIT_EVENTS : events subsystem
β’
SDL_INIT_SENSOR
: sensor subsystem; automatically
initializes the events subsystem
β’
SDL_INIT_CAMERA
: camera subsystem; automatically
initializes the events subsystem
Subsystem initialization is ref-counted, you must call
SDL_QuitSubSystem () for each
SDL_InitSubSystem () to correctly shutdown a subsystem manually (or call SDL_Quit () to force shutdown). If a subsystem is already loaded then this call will increase the ref-count and return.
Consider reporting some basic metadata about your application before calling SDL_Init , using either
SDL_SetAppMetadata () or
SDL_SetAppMetadataProperty ().
FUNCTION PARAMETERS
|
flags |
subsystem initialization flags. |
RETURN VALUE
Returns true on success or false on failure; call
SDL_GetError () for more information.
AVAILABILITY
This function is available since SDL 3.2.0.
SEE ALSO
β’ (3), SDL_SetAppMetadata (3), β’ (3), SDL_SetAppMetadataProperty (3), β’ (3), SDL_InitSubSystem (3), β’ (3), SDL_Quit (3), β’ (3), SDL_SetMainReady (3), β’ (3), SDL_WasInit (3)