From 369350caa01e068a566f5f3244ed612d2fb8778c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 12 Dec 2008 06:46:20 +0000 Subject: [PATCH] Added current_w and current_h to SDL_VideoInfo for SDL 1.2 compatibility --- include/SDL_compat.h | 3 +++ src/SDL_compat.c | 2 ++ test/testvidinfo.c | 1 + 3 files changed, 6 insertions(+) diff --git a/include/SDL_compat.h b/include/SDL_compat.h index d036ded71..9294d74a0 100644 --- a/include/SDL_compat.h +++ b/include/SDL_compat.h @@ -88,6 +88,9 @@ typedef struct SDL_VideoInfo Uint32 video_mem; SDL_PixelFormat *vfmt; + + int current_w; + int current_h; } SDL_VideoInfo; /* The most common video overlay formats. diff --git a/src/SDL_compat.c b/src/SDL_compat.c index 8996cf148..838d0d4d1 100644 --- a/src/SDL_compat.c +++ b/src/SDL_compat.c @@ -76,6 +76,8 @@ SDL_GetVideoInfo(void) SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); info.vfmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask); + info.current_w = mode.w; + info.current_h = mode.h; } return &info; } diff --git a/test/testvidinfo.c b/test/testvidinfo.c index 9463e4b8b..29b8ad07f 100644 --- a/test/testvidinfo.c +++ b/test/testvidinfo.c @@ -520,6 +520,7 @@ main(int argc, char *argv[]) if (info->blit_fill) { printf("Color fills on hardware surfaces are accelerated\n"); } + printf("Current resolution: %dx%d\n", info->current_w, info->current_h); #if 0 if (argv[1] && (strcmp(argv[1], "-benchmark") == 0)) { RunVideoTests();