sdlGetHintBoolean function

bool sdlGetHintBoolean(
  1. String? name,
  2. bool defaultValue
)

Get the boolean value of a hint variable.

\param name the name of the hint to get the boolean value from \param default_value the value to return if the hint does not exist \returns the boolean value of a hint or the provided default value if the hint does not exist.

\since This function is available since SDL 2.0.5.

\sa SDL_GetHint \sa SDL_SetHint

extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value)

Implementation

bool sdlGetHintBoolean(String? name, bool defaultValue) {
  final sdlGetHintBooleanLookupFunction = libSdl2.lookupFunction<
      Int32 Function(Pointer<Utf8> name, Int32 defaultValue),
      int Function(Pointer<Utf8> name, int defaultValue)>('SDL_GetHintBoolean');
  final namePointer = name != null ? name.toNativeUtf8() : nullptr;
  final result =
      sdlGetHintBooleanLookupFunction(namePointer, defaultValue ? 1 : 0) == 1;
  calloc.free(namePointer);
  return result;
}