SDL_ListModes sorting

Hi,

I’m in the process of porting SDL to the QNX Neutrino OS (Unix variant, real-time OS). I find the specification for ‘SDL_ListModes’ to be vague:

/*

  • Return a pointer to an array of available screen dimensions for the
  • given format and video flags, sorted largest to smallest. Returns
  • NULL if there are no dimensions available for a particular format,
  • or (SDL_Rect *)-1 if any dimension is okay for the given format.
  • If ‘format’ is NULL, the mode list will be for the format given
  • by SDL_GetVideoInfo()->vfmt
    */

sorted largest to smallest? I guess what is meant is from greatest resolution and pixel depth to least resolution and pixel depth?

Thanks,

Patrick Trainor

Multimedia Developer

QNX Software Systems

Hi,

I’m in the process of porting SDL to the QNX Neutrino OS (Unix variant, real-time OS).

Glad to hear it! :slight_smile:

I find the specification for ‘SDL_ListModes’ to be vague:

sorted largest to smallest? I guess what is meant is from greatest resolution and pixel depth to least resolution and pixel depth?

SDL_ListModes() returns a list of resolution rectangles for a given pixel
format (depth). They are sorted from greatest resolution to least resolution.

BTW, SDL’s definition of PixelFormat::BitDepth is a little vague. It was
originally intended to reflect depth, but is now used as bytes-per-pixel*8.
I may fix it so it reflects depth, but it would take a while.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

/*

  • Return a pointer to an array of available screen dimensions for the
  • given format and video flags, sorted largest to smallest. Returns
  • NULL if there are no dimensions available for a particular format,
  • or (SDL_Rect **)-1 if any dimension is okay for the given format.
  • If ‘format’ is NULL, the mode list will be for the format given
  • by SDL_GetVideoInfo()->vfmt
    */

sorted largest to smallest? I guess what is meant is from greatest resolution and pixel depth to least resolution and pixel depth?

No, the pixel depth is implied in the format parameter, so it should just
be sorted by resolution.