mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-17 02:08:27 +00:00
The refresh rate in SDL_DisplayMode is now a float
This commit is contained in:
parent
851b0e16be
commit
e3c1749f5b
32 changed files with 107 additions and 83 deletions
|
@ -430,7 +430,7 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
|
|||
if (!argv[index]) {
|
||||
return -1;
|
||||
}
|
||||
state->refresh_rate = SDL_atoi(argv[index]);
|
||||
state->refresh_rate = (float)SDL_atof(argv[index]);
|
||||
return 2;
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--vsync") == 0) {
|
||||
|
@ -1137,7 +1137,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
|
|||
SDL_GetDesktopDisplayMode(i, &mode);
|
||||
SDL_GetMasksForPixelFormatEnum(mode.format, &bpp, &Rmask, &Gmask,
|
||||
&Bmask, &Amask);
|
||||
SDL_Log(" Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
|
||||
SDL_Log(" Current mode: %dx%d@%gHz, %d bits-per-pixel (%s)\n",
|
||||
mode.w, mode.h, mode.refresh_rate, bpp,
|
||||
SDL_GetPixelFormatName(mode.format));
|
||||
if (Rmask || Gmask || Bmask) {
|
||||
|
@ -1159,7 +1159,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
|
|||
SDL_GetDisplayMode(i, j, &mode);
|
||||
SDL_GetMasksForPixelFormatEnum(mode.format, &bpp, &Rmask,
|
||||
&Gmask, &Bmask, &Amask);
|
||||
SDL_Log(" Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
|
||||
SDL_Log(" Mode %d: %dx%d@%gHz, %d bits-per-pixel (%s)\n",
|
||||
j, mode.w, mode.h, mode.refresh_rate, bpp,
|
||||
SDL_GetPixelFormatName(mode.format));
|
||||
if (Rmask || Gmask || Bmask) {
|
||||
|
@ -2252,7 +2252,7 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, in
|
|||
textY += lineHeight;
|
||||
|
||||
if (0 == SDL_GetWindowDisplayMode(window, &mode)) {
|
||||
(void)SDL_snprintf(text, sizeof text, "SDL_GetWindowDisplayMode: %dx%d@%dHz (%s)",
|
||||
(void)SDL_snprintf(text, sizeof text, "SDL_GetWindowDisplayMode: %dx%d@%gHz (%s)",
|
||||
mode.w, mode.h, mode.refresh_rate, SDL_GetPixelFormatName(mode.format));
|
||||
SDLTest_DrawString(renderer, 0, textY, text);
|
||||
textY += lineHeight;
|
||||
|
@ -2282,15 +2282,15 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, in
|
|||
}
|
||||
|
||||
if (0 == SDL_GetCurrentDisplayMode(windowDisplayIndex, &mode)) {
|
||||
(void)SDL_snprintf(text, sizeof text, "SDL_GetCurrentDisplayMode: %dx%d@%d",
|
||||
mode.w, mode.h, mode.refresh_rate);
|
||||
(void)SDL_snprintf(text, sizeof text, "SDL_GetCurrentDisplayMode: %dx%d@%gHz (%s)",
|
||||
mode.w, mode.h, mode.refresh_rate, SDL_GetPixelFormatName(mode.format));
|
||||
SDLTest_DrawString(renderer, 0, textY, text);
|
||||
textY += lineHeight;
|
||||
}
|
||||
|
||||
if (0 == SDL_GetDesktopDisplayMode(windowDisplayIndex, &mode)) {
|
||||
(void)SDL_snprintf(text, sizeof text, "SDL_GetDesktopDisplayMode: %dx%d@%d",
|
||||
mode.w, mode.h, mode.refresh_rate);
|
||||
(void)SDL_snprintf(text, sizeof text, "SDL_GetDesktopDisplayMode: %dx%d@%gHz (%s)",
|
||||
mode.w, mode.h, mode.refresh_rate, SDL_GetPixelFormatName(mode.format));
|
||||
SDLTest_DrawString(renderer, 0, textY, text);
|
||||
textY += lineHeight;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue