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
33
#include <
SDL3/SDL_begin_code.h
>
34
/* Set up for C function definitions, even when using C++ */
35
#ifdef __cplusplus
36
extern
"C"
{
37
#endif
38
39
/* As of version 0.5, SDL is loaded dynamically into the application */
40
41
/**
42
* Initialization flags for SDL_Init and/or SDL_InitSubSystem
43
*
44
* These are the flags which may be passed to SDL_Init(). You should
45
* specify the subsystems which you will be using in your application.
46
*
47
* \sa SDL_Init
48
* \sa SDL_Quit
49
* \sa SDL_InitSubSystem
50
* \sa SDL_QuitSubSystem
51
* \sa SDL_WasInit
52
*/
53
typedef
enum
54
{
55
SDL_INIT_TIMER
= 0x00000001,
56
SDL_INIT_AUDIO
= 0x00000010,
/**< `SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS` */
57
SDL_INIT_VIDEO
= 0x00000020,
/**< `SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS` */
58
SDL_INIT_JOYSTICK
= 0x00000200,
/**< `SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS` */
59
SDL_INIT_HAPTIC
= 0x00001000,
60
SDL_INIT_GAMEPAD
= 0x00002000,
/**< `SDL_INIT_GAMEPAD` implies `SDL_INIT_JOYSTICK` */
61
SDL_INIT_EVENTS
= 0x00004000,
62
SDL_INIT_SENSOR
= 0x00008000,
/**< `SDL_INIT_SENSOR` implies `SDL_INIT_EVENTS` */
63
SDL_INIT_CAMERA
= 0x00010000
/**< `SDL_INIT_CAMERA` implies `SDL_INIT_EVENTS` */
64
}
SDL_InitFlags
;
65
66
/**
67
* Initialize the SDL library.
68
*
69
* SDL_Init() simply forwards to calling SDL_InitSubSystem(). Therefore, the
70
* two may be used interchangeably. Though for readability of your code
71
* SDL_InitSubSystem() might be preferred.
72
*
73
* The file I/O (for example: SDL_IOFromFile) and threading (SDL_CreateThread)
74
* subsystems are initialized by default. Message boxes
75
* (SDL_ShowSimpleMessageBox) also attempt to work without initializing the
76
* video subsystem, in hopes of being useful in showing an error dialog when
77
* SDL_Init fails. You must specifically initialize other subsystems if you
78
* use them in your application.
79
*
80
* Logging (such as SDL_Log) works without initialization, too.
81
*
82
* `flags` may be any of the following OR'd together:
83
*
84
* - `SDL_INIT_TIMER`: timer subsystem
85
* - `SDL_INIT_AUDIO`: audio subsystem
86
* - `SDL_INIT_VIDEO`: video subsystem; automatically initializes the events
87
* subsystem
88
* - `SDL_INIT_JOYSTICK`: joystick subsystem; automatically initializes the
89
* events subsystem
90
* - `SDL_INIT_HAPTIC`: haptic (force feedback) subsystem
91
* - `SDL_INIT_GAMEPAD`: gamepad subsystem; automatically initializes the
92
* joystick subsystem
93
* - `SDL_INIT_EVENTS`: events subsystem
94
* - `SDL_INIT_SENSOR`: sensor subsystem
95
*
96
* Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem()
97
* for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or
98
* call SDL_Quit() to force shutdown). If a subsystem is already loaded then
99
* this call will increase the ref-count and return.
100
*
101
* \param flags subsystem initialization flags
102
* \returns 0 on success or a negative error code on failure; call
103
* SDL_GetError() for more information.
104
*
105
* \since This function is available since SDL 3.0.0.
106
*
107
* \sa SDL_InitSubSystem
108
* \sa SDL_Quit
109
* \sa SDL_SetMainReady
110
* \sa SDL_WasInit
111
*/
112
extern
DECLSPEC
int
SDLCALL
SDL_Init
(
Uint32
flags);
113
114
/**
115
* Compatibility function to initialize the SDL library.
116
*
117
* This function and SDL_Init() are interchangeable.
118
*
119
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
120
* \returns 0 on success or a negative error code on failure; call
121
* SDL_GetError() for more information.
122
*
123
* \since This function is available since SDL 3.0.0.
124
*
125
* \sa SDL_Init
126
* \sa SDL_Quit
127
* \sa SDL_QuitSubSystem
128
*/
129
extern
DECLSPEC
int
SDLCALL
SDL_InitSubSystem
(
Uint32
flags);
130
131
/**
132
* Shut down specific SDL subsystems.
133
*
134
* You still need to call SDL_Quit() even if you close all open subsystems
135
* with SDL_QuitSubSystem().
136
*
137
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
138
*
139
* \since This function is available since SDL 3.0.0.
140
*
141
* \sa SDL_InitSubSystem
142
* \sa SDL_Quit
143
*/
144
extern
DECLSPEC
void
SDLCALL
SDL_QuitSubSystem
(
Uint32
flags);
145
146
/**
147
* Get a mask of the specified subsystems which are currently initialized.
148
*
149
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
150
* \returns a mask of all initialized subsystems if `flags` is 0, otherwise it
151
* returns the initialization status of the specified subsystems.
152
*
153
* \since This function is available since SDL 3.0.0.
154
*
155
* \sa SDL_Init
156
* \sa SDL_InitSubSystem
157
*/
158
extern
DECLSPEC
Uint32
SDLCALL
SDL_WasInit
(
Uint32
flags);
159
160
/**
161
* Clean up all initialized subsystems.
162
*
163
* You should call this function even if you have already shutdown each
164
* initialized subsystem with SDL_QuitSubSystem(). It is safe to call this
165
* function even in the case of errors in initialization.
166
*
167
* You can use this function with atexit() to ensure that it is run when your
168
* application is shutdown, but it is not wise to do this from a library or
169
* other dynamically loaded code.
170
*
171
* \since This function is available since SDL 3.0.0.
172
*
173
* \sa SDL_Init
174
* \sa SDL_QuitSubSystem
175
*/
176
extern
DECLSPEC
void
SDLCALL
SDL_Quit
(
void
);
177
178
/* Ends C function definitions when using C++ */
179
#ifdef __cplusplus
180
}
181
#endif
182
#include <
SDL3/SDL_close_code.h
>
183
184
#endif
/* SDL_init_h_ */
SDL_begin_code.h
SDL_close_code.h
SDL_WasInit
Uint32 SDL_WasInit(Uint32 flags)
SDL_InitSubSystem
int SDL_InitSubSystem(Uint32 flags)
SDL_InitFlags
SDL_InitFlags
Definition
SDL_init.h:54
SDL_INIT_HAPTIC
@ SDL_INIT_HAPTIC
Definition
SDL_init.h:59
SDL_INIT_JOYSTICK
@ SDL_INIT_JOYSTICK
Definition
SDL_init.h:58
SDL_INIT_CAMERA
@ SDL_INIT_CAMERA
Definition
SDL_init.h:63
SDL_INIT_GAMEPAD
@ SDL_INIT_GAMEPAD
Definition
SDL_init.h:60
SDL_INIT_SENSOR
@ SDL_INIT_SENSOR
Definition
SDL_init.h:62
SDL_INIT_TIMER
@ SDL_INIT_TIMER
Definition
SDL_init.h:55
SDL_INIT_AUDIO
@ SDL_INIT_AUDIO
Definition
SDL_init.h:56
SDL_INIT_VIDEO
@ SDL_INIT_VIDEO
Definition
SDL_init.h:57
SDL_INIT_EVENTS
@ SDL_INIT_EVENTS
Definition
SDL_init.h:61
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:174
include
SDL3
SDL_init.h
Generated by
1.9.8