SDL
3.0
SDL_init.h
Go to the documentation of this file.
1
/*
2
Simple DirectMedia Layer
3
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
4
5
This software is provided 'as-is', without any express or implied
6
warranty. In no event will the authors be held liable for any damages
7
arising from the use of this software.
8
9
Permission is granted to anyone to use this software for any purpose,
10
including commercial applications, and to alter it and redistribute it
11
freely, subject to the following restrictions:
12
13
1. The origin of this software must not be misrepresented; you must not
14
claim that you wrote the original software. If you use this software
15
in a product, an acknowledgment in the product documentation would be
16
appreciated but is not required.
17
2. Altered source versions must be plainly marked as such, and must not be
18
misrepresented as being the original software.
19
3. This notice may not be removed or altered from any source distribution.
20
*/
21
22
/**
23
* \file SDL_init.h
24
*
25
* Init and quit header for the SDL library
26
*/
27
28
#ifndef SDL_init_h_
29
#define SDL_init_h_
30
31
#include <
SDL3/SDL_stdinc.h
>
32
#include <
SDL3/SDL_error.h
>
33
34
#include <
SDL3/SDL_begin_code.h
>
35
/* Set up for C function definitions, even when using C++ */
36
#ifdef __cplusplus
37
extern
"C"
{
38
#endif
39
40
/* As of version 0.5, SDL is loaded dynamically into the application */
41
42
/**
43
* Initialization flags for SDL_Init and/or SDL_InitSubSystem
44
*
45
* These are the flags which may be passed to SDL_Init(). You should specify
46
* the subsystems which you will be using in your application.
47
*
48
* \since This enum is available since SDL 3.0.0.
49
*
50
* \sa SDL_Init
51
* \sa SDL_Quit
52
* \sa SDL_InitSubSystem
53
* \sa SDL_QuitSubSystem
54
* \sa SDL_WasInit
55
*/
56
typedef
enum
SDL_InitFlags
57
{
58
SDL_INIT_TIMER
= 0x00000001,
59
SDL_INIT_AUDIO
= 0x00000010,
/**< `SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS` */
60
SDL_INIT_VIDEO
= 0x00000020,
/**< `SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS` */
61
SDL_INIT_JOYSTICK
= 0x00000200,
/**< `SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS`, should be initialized on the same thread as SDL_INIT_VIDEO on Windows if you don't set SDL_HINT_JOYSTICK_THREAD */
62
SDL_INIT_HAPTIC
= 0x00001000,
63
SDL_INIT_GAMEPAD
= 0x00002000,
/**< `SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK` */
64
SDL_INIT_EVENTS
= 0x00004000,
65
SDL_INIT_SENSOR
= 0x00008000,
/**< `SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS` */
66
SDL_INIT_CAMERA
= 0x00010000
/**< `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS` */
67
}
SDL_InitFlags
;
68
69
/**
70
* Initialize the SDL library.
71
*
72
* SDL_Init() simply forwards to calling SDL_InitSubSystem(). Therefore, the
73
* two may be used interchangeably. Though for readability of your code
74
* SDL_InitSubSystem() might be preferred.
75
*
76
* The file I/O (for example: SDL_IOFromFile) and threading (SDL_CreateThread)
77
* subsystems are initialized by default. Message boxes
78
* (SDL_ShowSimpleMessageBox) also attempt to work without initializing the
79
* video subsystem, in hopes of being useful in showing an error dialog when
80
* SDL_Init fails. You must specifically initialize other subsystems if you
81
* use them in your application.
82
*
83
* Logging (such as SDL_Log) works without initialization, too.
84
*
85
* `flags` may be any of the following OR'd together:
86
*
87
* - `SDL_INIT_TIMER`: timer subsystem
88
* - `SDL_INIT_AUDIO`: audio subsystem
89
* - `SDL_INIT_VIDEO`: video subsystem; automatically initializes the events
90
* subsystem
91
* - `SDL_INIT_JOYSTICK`: joystick subsystem; automatically initializes the
92
* events subsystem
93
* - `SDL_INIT_HAPTIC`: haptic (force feedback) subsystem
94
* - `SDL_INIT_GAMEPAD`: gamepad subsystem; automatically initializes the
95
* joystick subsystem
96
* - `SDL_INIT_EVENTS`: events subsystem
97
* - `SDL_INIT_SENSOR`: sensor subsystem
98
*
99
* Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem()
100
* for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or
101
* call SDL_Quit() to force shutdown). If a subsystem is already loaded then
102
* this call will increase the ref-count and return.
103
*
104
* \param flags subsystem initialization flags
105
* \returns 0 on success or a negative error code on failure; call
106
* SDL_GetError() for more information.
107
*
108
* \since This function is available since SDL 3.0.0.
109
*
110
* \sa SDL_InitSubSystem
111
* \sa SDL_Quit
112
* \sa SDL_SetMainReady
113
* \sa SDL_WasInit
114
*/
115
extern
DECLSPEC
int
SDLCALL
SDL_Init
(
Uint32
flags);
116
117
/**
118
* Compatibility function to initialize the SDL library.
119
*
120
* This function and SDL_Init() are interchangeable.
121
*
122
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
123
* \returns 0 on success or a negative error code on failure; call
124
* SDL_GetError() for more information.
125
*
126
* \since This function is available since SDL 3.0.0.
127
*
128
* \sa SDL_Init
129
* \sa SDL_Quit
130
* \sa SDL_QuitSubSystem
131
*/
132
extern
DECLSPEC
int
SDLCALL
SDL_InitSubSystem
(
Uint32
flags);
133
134
/**
135
* Shut down specific SDL subsystems.
136
*
137
* You still need to call SDL_Quit() even if you close all open subsystems
138
* with SDL_QuitSubSystem().
139
*
140
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
141
*
142
* \since This function is available since SDL 3.0.0.
143
*
144
* \sa SDL_InitSubSystem
145
* \sa SDL_Quit
146
*/
147
extern
DECLSPEC
void
SDLCALL
SDL_QuitSubSystem
(
Uint32
flags);
148
149
/**
150
* Get a mask of the specified subsystems which are currently initialized.
151
*
152
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
153
* \returns a mask of all initialized subsystems if `flags` is 0, otherwise it
154
* returns the initialization status of the specified subsystems.
155
*
156
* \since This function is available since SDL 3.0.0.
157
*
158
* \sa SDL_Init
159
* \sa SDL_InitSubSystem
160
*/
161
extern
DECLSPEC
Uint32
SDLCALL
SDL_WasInit
(
Uint32
flags);
162
163
/**
164
* Clean up all initialized subsystems.
165
*
166
* You should call this function even if you have already shutdown each
167
* initialized subsystem with SDL_QuitSubSystem(). It is safe to call this
168
* function even in the case of errors in initialization.
169
*
170
* You can use this function with atexit() to ensure that it is run when your
171
* application is shutdown, but it is not wise to do this from a library or
172
* other dynamically loaded code.
173
*
174
* \since This function is available since SDL 3.0.0.
175
*
176
* \sa SDL_Init
177
* \sa SDL_QuitSubSystem
178
*/
179
extern
DECLSPEC
void
SDLCALL
SDL_Quit
(
void
);
180
181
/* Ends C function definitions when using C++ */
182
#ifdef __cplusplus
183
}
184
#endif
185
#include <
SDL3/SDL_close_code.h
>
186
187
#endif
/* SDL_init_h_ */
SDL_begin_code.h
SDL_close_code.h
SDL_error.h
SDL_WasInit
Uint32 SDL_WasInit(Uint32 flags)
SDL_InitSubSystem
int SDL_InitSubSystem(Uint32 flags)
SDL_InitFlags
SDL_InitFlags
Definition
SDL_init.h:57
SDL_INIT_HAPTIC
@ SDL_INIT_HAPTIC
Definition
SDL_init.h:62
SDL_INIT_JOYSTICK
@ SDL_INIT_JOYSTICK
Definition
SDL_init.h:61
SDL_INIT_CAMERA
@ SDL_INIT_CAMERA
Definition
SDL_init.h:66
SDL_INIT_GAMEPAD
@ SDL_INIT_GAMEPAD
Definition
SDL_init.h:63
SDL_INIT_SENSOR
@ SDL_INIT_SENSOR
Definition
SDL_init.h:65
SDL_INIT_TIMER
@ SDL_INIT_TIMER
Definition
SDL_init.h:58
SDL_INIT_AUDIO
@ SDL_INIT_AUDIO
Definition
SDL_init.h:59
SDL_INIT_VIDEO
@ SDL_INIT_VIDEO
Definition
SDL_init.h:60
SDL_INIT_EVENTS
@ SDL_INIT_EVENTS
Definition
SDL_init.h:64
SDL_QuitSubSystem
void SDL_QuitSubSystem(Uint32 flags)
SDL_Quit
void SDL_Quit(void)
SDL_Init
int SDL_Init(Uint32 flags)
SDL_stdinc.h
Uint32
uint32_t Uint32
Definition
SDL_stdinc.h:224
include
SDL3
SDL_init.h
Generated by
1.9.8