SdlInit
Initialize the SDL library.
Init simply forwards to calling InitSubSystem. Therefore, the two may be used interchangeably. Though for readability of your code InitSubSystem might be preferred.
The file I/O and threading subsystems are initialized by default. Message boxes also attempt to work without initializing the video subsystem, in hopes of being useful in showing an error dialog when Init fails. You must specifically initialize other subsystems if you use them in your application.
Logging works without initialization, too.
AFlags may be zero or more of the following:
TSdlInitFlag.Audio
: audio subsystem; automatically initializes the events subsystem.TSdlInitFlag.Video
: video subsystem; automatically initializes the events subsystem, should be initialized on the main thread.TSdlInitFlag.Joystick
: joystick subsystem; automatically initializes the events subsystemTSdlInitFlag.Haptic
: haptic (force feedback) subsystemTSdlInitFlag.Gamepad
: gamepad subsystem; automatically initializes the joystick subsystemTSdlInitFlag.Events
: events subsystemTSdlInitFlag.Sensor
: sensor subsystem; automatically initializes the events subsystemTSdlInitFlag.Camera
: camera subsystem; automatically initializes the events subsystem
Subsystem initialization is ref-counted, you must call QuitSubSystem for each InitSubSystem to correctly shutdown a subsystem manually (or call 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 Init, using SdlSetAppMetadata.
Definition
Unit: Neslib.Sdl3.Basics
Parameters
AFlags
: TSdlInitFlags
: Subsystem initialization flags.
Exceptions
ESdlError
: Raised on failure.