MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / SDL_InitSubSystem

Function SDL_InitSubSystem

deps/SDL2/src/SDL.c:141–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141int
142SDL_InitSubSystem(Uint32 flags)
143{
144 if (!SDL_MainIsReady) {
145 SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?");
146 return -1;
147 }
148
149 /* Clear the error message */
150 SDL_ClearError();
151
152 if ((flags & SDL_INIT_GAMECONTROLLER)) {
153 /* game controller implies joystick */
154 flags |= SDL_INIT_JOYSTICK;
155 }
156
157 if ((flags & (SDL_INIT_VIDEO|SDL_INIT_JOYSTICK))) {
158 /* video or joystick implies events */
159 flags |= SDL_INIT_EVENTS;
160 }
161
162#if SDL_VIDEO_DRIVER_WINDOWS
163 if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
164 if (SDL_HelperWindowCreate() < 0) {
165 return -1;
166 }
167 }
168#endif
169
170#if !SDL_TIMERS_DISABLED
171 SDL_TicksInit();
172#endif
173
174 /* Initialize the event subsystem */
175 if ((flags & SDL_INIT_EVENTS)) {
176#if !SDL_EVENTS_DISABLED
177 if (SDL_PrivateShouldInitSubsystem(SDL_INIT_EVENTS)) {
178 if (SDL_EventsInit() < 0) {
179 return (-1);
180 }
181 }
182 SDL_PrivateSubsystemRefCountIncr(SDL_INIT_EVENTS);
183#else
184 return SDL_SetError("SDL not built with events support");
185#endif
186 }
187
188 /* Initialize the timer subsystem */
189 if ((flags & SDL_INIT_TIMER)){
190#if !SDL_TIMERS_DISABLED
191 if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) {
192 if (SDL_TimerInit() < 0) {
193 return (-1);
194 }
195 }
196 SDL_PrivateSubsystemRefCountIncr(SDL_INIT_TIMER);
197#else
198 return SDL_SetError("SDL not built with timer support");

Callers 12

_audioSetUpFunction · 0.85
_timerSetUpFunction · 0.85
SDL_InitFunction · 0.85
SDL_WinRTInitXAMLAppFunction · 0.85
SDL_OpenAudioFunction · 0.85
SDLTest_SetTestTimeoutFunction · 0.85
SDL_SensorInitFunction · 0.85
SDL_VideoInitFunction · 0.85
SDL_JoystickInitFunction · 0.85

Calls 14

SDL_SetErrorFunction · 0.85
SDL_ClearErrorFunction · 0.85
SDL_HelperWindowCreateFunction · 0.85
SDL_EventsInitFunction · 0.85
SDL_TimerInitFunction · 0.85
SDL_VideoInitFunction · 0.85
SDL_AudioInitFunction · 0.85
SDL_JoystickInitFunction · 0.85
SDL_GameControllerInitFunction · 0.85
SDL_HapticInitFunction · 0.85

Tested by 6

_audioSetUpFunction · 0.68
_timerSetUpFunction · 0.68
SDLTest_SetTestTimeoutFunction · 0.68