sdlShouldInit function

bool sdlShouldInit(
  1. Pointer<SdlInitState> state
)

Return whether initialization should be done.

This function checks the passed in state and if initialization should be done, sets the status to SDL_INIT_STATUS_INITIALIZING and returns true. If another thread is already modifying this state, it will wait until that's done before returning.

If this function returns true, the calling code must call SDL_SetInitialized() to complete the initialization.

\param state the initialization state to check. \returns true if initialization needs to be done, false otherwise.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

\sa SDL_SetInitialized \sa SDL_ShouldQuit

extern SDL_DECLSPEC bool SDLCALL SDL_ShouldInit(SDL_InitState *state)

Implementation

bool sdlShouldInit(Pointer<SdlInitState> state) {
  final sdlShouldInitLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlInitState> state),
      int Function(Pointer<SdlInitState> state)>('SDL_ShouldInit');
  return sdlShouldInitLookupFunction(state) == 1;
}