sdlAddHintCallback function
bool
sdlAddHintCallback(
- String? name,
- Pointer<
NativeFunction< callback,SdlHintCallback> > - Pointer<
NativeType> userdata
Add a function to watch a particular hint.
The callback function is called during this function, to provide it an initial value, and again each time the hint's value changes.
\param name the hint to watch. \param callback An SDL_HintCallback function that will be called when the hint value changes. \param userdata a pointer to pass to the callback function. \returns true on success or false on failure; call SDL_GetError() for more information.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL 3.1.3.
\sa SDL_RemoveHintCallback
extern SDL_DECLSPEC bool SDLCALL SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
Implementation
bool sdlAddHintCallback(
String? name,
Pointer<NativeFunction<SdlHintCallback>> callback,
Pointer<NativeType> userdata) {
final sdlAddHintCallbackLookupFunction = libSdl3.lookupFunction<
Uint8 Function(
Pointer<Utf8> name,
Pointer<NativeFunction<SdlHintCallback>> callback,
Pointer<NativeType> userdata),
int Function(
Pointer<Utf8> name,
Pointer<NativeFunction<SdlHintCallback>> callback,
Pointer<NativeType> userdata)>('SDL_AddHintCallback');
final namePointer = name != null ? name.toNativeUtf8() : nullptr;
final result =
sdlAddHintCallbackLookupFunction(namePointer, callback, userdata) == 1;
calloc.free(namePointer);
return result;
}