This is new wiki software and old wiki content. It's a work in progress!
Here's the explanation.
Be gentle, report bugs, leave feedback on pages, or just edit them yourself! Thanks!

SDL Wiki


Get information about a specific display mode.


int SDL_GetDisplayMode(int displayIndex, int modeIndex,
                       SDL_DisplayMode * mode);

Function Parameters


the index of the display to query


the index of the display mode to query


an SDL_DisplayMode structure filled in with the mode at modeIndex

Return Value

Returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.


The display modes are sorted in this priority:

Code Examples

    int display_count = 0, display_index = 0, mode_index = 0;
    SDL_DisplayMode mode = { SDL_PIXELFORMAT_UNKNOWN, 0, 0, 0, 0 };

    if ((display_count = SDL_GetNumVideoDisplays()) < 1) {
        SDL_Log("SDL_GetNumVideoDisplays returned: %i", display_count);
        return 1;

    if (SDL_GetDisplayMode(display_index, mode_index, &mode) != 0) {
        SDL_Log("SDL_GetDisplayMode failed: %s", SDL_GetError());
        return 1;       
    SDL_Log("SDL_GetDisplayMode(0, 0, &mode):\t\t%i bpp\t%i x %i",
    SDL_BITSPERPIXEL(mode.format), mode.w, mode.h);

CategoryAPI, 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.