using System;
using System.Runtime.InteropServices;
namespace DotSDL.Sdl {
///
/// Contains the necessary constants and function imports from SDL.h.
///
internal static class Init {
[Flags]
internal enum SubsystemFlags : uint {
/// No subsystem.
None = 0x0000000,
/// Timer subsystem.
Timer = 0x0000001,
/// Audio subsystem.
Audio = 0x0000010,
/// Video subsystem; automatically initializes the events subsystem.
Video = 0x0000020,
/// Joystick subsystem; automatically initializes the events subsystem.
Joystick = 0x0000200,
/// Haptic (force feedback) subsystem.
Haptic = 0x0001000,
/// Controller subsystem; automatically initializes the joystick subsystem.
GameController = 0x0002000,
/// Events subsystem.
Events = 0x0004000,
/// Compatibility; this flag is ignored.
NoParachute = 0x0010000,
/// All of the above subsystems.
Everything = Timer | Audio | Video | Joystick | Haptic | GameController | Events | NoParachute
}
///
/// This function initalizes the subsystems specified by .
///
/// Flags indicating which subsystem or subsystems to initialize.
/// 0 on success or a negative error code on failure.
[DllImport(Meta.DllName, EntryPoint = "SDL_Init", CallingConvention = CallingConvention.Cdecl)]
internal static extern int Initialize(SubsystemFlags flags);
///
/// This function initializes specific SDL subsystems
///
/// 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.
///
/// Flags indicating which subsystem or subsystems to initialize.
/// 0 on success or a negative error code on failure.
[DllImport(Meta.DllName, EntryPoint = "SDL_InitSubSystem", CallingConvention = CallingConvention.Cdecl)]
internal static extern int InitSubSystem(SubsystemFlags flags);
///
/// This function cleans up specific SDL subsystems
///
/// Flags indicating which subsystem or subsystems to quit.
/// 0 on success or a negative error code on failure.
[DllImport(Meta.DllName, EntryPoint = "SDL_QuitSubSystem", CallingConvention = CallingConvention.Cdecl)]
internal static extern int QuitSubSystem(SubsystemFlags flags);
///
/// This function returns a mask of the specified subsystems which have
/// previously been initialized.
///
/// If is 0, it returns a mask of all initialized subsystems.
///
/// Flags indicating which subsystem or subsystems to query.
/// A set of all initialized subsystems.
[DllImport(Meta.DllName, EntryPoint = "SDL_WasInit", CallingConvention = CallingConvention.Cdecl)]
internal static extern SubsystemFlags WasInit(SubsystemFlags flags);
///
/// This function cleans up all initialized subsystems. You should call it upon all
/// exit conditions.
///
[DllImport(Meta.DllName, EntryPoint = "SDL_Quit", CallingConvention = CallingConvention.Cdecl)]
internal static extern void Quit();
}
}