sdlGetDisplayMode function

int sdlGetDisplayMode(
  1. int displayIndex,
  2. int modeIndex,
  3. Pointer<SdlDisplayMode> mode
)

Get information about a specific display mode.

The display modes are sorted in this priority:

  • width -> largest to smallest
  • height -> largest to smallest
  • bits per pixel -> more colors to fewer colors
  • packed pixel layout -> largest to smallest
  • refresh rate -> highest to lowest

\param displayIndex the index of the display to query \param modeIndex the index of the display mode to query \param mode an SDL_DisplayMode structure filled in with the mode at modeIndex \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_GetNumDisplayModes

extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, SDL_DisplayMode * mode)

Implementation

int sdlGetDisplayMode(
    int displayIndex, int modeIndex, Pointer<SdlDisplayMode> mode) {
  final sdlGetDisplayModeLookupFunction = libSdl2.lookupFunction<
      Int32 Function(
          Int32 displayIndex, Int32 modeIndex, Pointer<SdlDisplayMode> mode),
      int Function(int displayIndex, int modeIndex,
          Pointer<SdlDisplayMode> mode)>('SDL_GetDisplayMode');
  return sdlGetDisplayModeLookupFunction(displayIndex, modeIndex, mode);
}