Wiki Page Content

SDL_DisplayMode

A structure that contains the description of a display mode.

Data Fields

Uint32

format

one of the SDL_PixelFormatEnum values; see Remarks for details

int

w

width, in screen coordinates

int

h

height, in screen coordinates

int

refresh_rate

refresh rate (in Hz), or 0 for unspecified

void*

driverdata

driver-specific data, initialize to 0

Code Examples

    static int display_in_use = 0; /* Only using first display */

    int i, display_mode_count;
    SDL_DisplayMode mode;
    Uint32 f;

    SDL_Log("SDL_GetNumVideoDisplays(): %i", SDL_GetNumVideoDisplays());

    display_mode_count = SDL_GetNumDisplayModes(display_in_use);
    if (display_mode_count < 1) {
        SDL_Log("SDL_GetNumDisplayModes failed: %s", SDL_GetError());
        return 1;
    }
    SDL_Log("SDL_GetNumDisplayModes: %i", display_mode_count);

    for (i = 0; i < display_mode_count; ++i) {
        if (SDL_GetDisplayMode(display_in_use, i, &mode) != 0) {
            SDL_Log("SDL_GetDisplayMode failed: %s", SDL_GetError());
            return 1;
        }
        f = mode.format;

        SDL_Log("Mode %i\tbpp %i\t%s\t%i x %i", i,
        SDL_BITSPERPIXEL(f), SDL_GetPixelFormatName(f), mode.w, mode.h);
    }

Remarks

format may be one of the following:

SDL_PIXELFORMAT_UNKNOWN

SDL_PIXELFORMAT_INDEX1LSB

SDL_PIXELFORMAT_INDEX1MSB

SDL_PIXELFORMAT_INDEX4LSB

SDL_PIXELFORMAT_INDEX4MSB

SDL_PIXELFORMAT_INDEX8

SDL_PIXELFORMAT_RGB332

SDL_PIXELFORMAT_RGB444

SDL_PIXELFORMAT_RGB555

SDL_PIXELFORMAT_BGR555

SDL_PIXELFORMAT_ARGB4444

SDL_PIXELFORMAT_RGBA4444

SDL_PIXELFORMAT_ABGR4444

SDL_PIXELFORMAT_BGRA4444

SDL_PIXELFORMAT_ARGB1555

SDL_PIXELFORMAT_RGBA5551

SDL_PIXELFORMAT_ABGR1555

SDL_PIXELFORMAT_BGRA5551

SDL_PIXELFORMAT_RGB565

SDL_PIXELFORMAT_BGR565

SDL_PIXELFORMAT_RGB24

SDL_PIXELFORMAT_BGR24

SDL_PIXELFORMAT_RGB888

SDL_PIXELFORMAT_RGBX8888

SDL_PIXELFORMAT_BGR888

SDL_PIXELFORMAT_BGRX8888

SDL_PIXELFORMAT_ARGB8888

SDL_PIXELFORMAT_RGBA8888

SDL_PIXELFORMAT_ABGR8888

SDL_PIXELFORMAT_BGRA8888

SDL_PIXELFORMAT_ARGB2101010

SDL_PIXELFORMAT_RGBA32

alias for RGBA byte array of color data, for the current platform (>= SDL 2.0.5)

SDL_PIXELFORMAT_ARGB32

alias for ARGB byte array of color data, for the current platform (>= SDL 2.0.5)

SDL_PIXELFORMAT_BGRA32

alias for BGRA byte array of color data, for the current platform (>= SDL 2.0.5)

SDL_PIXELFORMAT_ABGR32

alias for ABGR byte array of color data, for the current platform (>= SDL 2.0.5)

SDL_PIXELFORMAT_YV12

planar mode: Y + V + U (3 planes)

SDL_PIXELFORMAT_IYUV

planar mode: Y + U + V (3 planes)

SDL_PIXELFORMAT_YUY2

packed mode: Y0+U0+Y1+V0 (1 plane)

SDL_PIXELFORMAT_UYVY

packed mode: U0+Y0+V0+Y1 (1 plane)

SDL_PIXELFORMAT_YVYU

packed mode: Y0+V0+Y1+U0 (1 plane)

SDL_PIXELFORMAT_NV12

planar mode: Y + U/V interleaved (2 planes) (>= SDL 2.0.4)

SDL_PIXELFORMAT_NV21

planar mode: Y + V/U interleaved (2 planes) (>= SDL 2.0.4)


CategoryStruct, CategoryVideo

None: SDL_DisplayMode (last edited 2016-01-01 18:18:43 by PhilippWiesemann)

Feedback
Please include your contact information if you'd like to receive a reply.
Submit