SDL Wiki

SDL_DisplayMode

A structure that contains the description of a display mode.

Data Fields

Uint32

format

one of the SDL_PixelFormatEnum values

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);
}
SDL_GetClosestDisplayMode
SDL_GetCurrentDisplayMode
SDL_GetDesktopDisplayMode
SDL_GetDisplayMode
SDL_GetNumDisplayModes
SDL_GetWindowDisplayMode
SDL_SetWindowDisplayMode

CategoryStruct, CategoryVideo


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.