sdlRegisterApp function

int sdlRegisterApp(
  1. String? name,
  2. int style,
  3. Pointer<NativeType> hInst
)

Register a win32 window class for SDL's use.

This can be called to set the application window class at startup. It is safe to call this multiple times, as long as every call is eventually paired with a call to SDL_UnregisterApp, but a second registration attempt while a previous registration is still active will be ignored, other than to increment a counter.

Most applications do not need to, and should not, call this directly; SDL will call it when initializing the video subsystem.

\param name the window class name, in UTF-8 encoding. If NULL, SDL currently uses "SDL_app" but this isn't guaranteed. \param style the value to use in WNDCLASSEX::style. If name is NULL, SDL currently uses (CS_BYTEALIGNCLIENT | CS_OWNDC) regardless of what is specified here. \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL will use GetModuleHandle(NULL) instead. \returns 0 on success, -1 on error. SDL_GetError() may have details.

\since This function is available since SDL 2.0.2.

extern DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst)

Implementation

int sdlRegisterApp(String? name, int style, Pointer<NativeType> hInst) {
  final sdlRegisterAppLookupFunction = libSdl2.lookupFunction<
      Int32 Function(
          Pointer<Utf8> name, Uint32 style, Pointer<NativeType> hInst),
      int Function(Pointer<Utf8> name, int style,
          Pointer<NativeType> hInst)>('SDL_RegisterApp');
  final namePointer = name != null ? name.toNativeUtf8() : nullptr;
  final result = sdlRegisterAppLookupFunction(namePointer, style, hInst);
  calloc.free(namePointer);
  return result;
}