sdlGetScancodeFromName function
Get a scancode from a human-readable name.
\param name the human-readable scancode name.
\returns the SDL_Scancode, or SDL_SCANCODE_UNKNOWN
if the name wasn't
recognized; call SDL_GetError() for more information.
\threadsafety This function is not thread safe.
\since This function is available since SDL 3.1.3.
\sa SDL_GetKeyFromName \sa SDL_GetScancodeFromKey \sa SDL_GetScancodeName
extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name)
Implementation
int sdlGetScancodeFromName(String? name) {
final sdlGetScancodeFromNameLookupFunction = libSdl3.lookupFunction<
Int32 Function(Pointer<Utf8> name),
int Function(Pointer<Utf8> name)>('SDL_GetScancodeFromName');
final namePointer = name != null ? name.toNativeUtf8() : nullptr;
final result = sdlGetScancodeFromNameLookupFunction(namePointer);
calloc.free(namePointer);
return result;
}