mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-10 22:24:33 +00:00
Updated version of OTHGMars' updated window and resolution options modes.
Additional changes include disabling certain options when they are not valid(ie, resolution is disabled when in borderless mode)
This commit is contained in:
parent
d76c73c252
commit
26ef40950b
12 changed files with 559 additions and 152 deletions
|
|
@ -143,6 +143,74 @@ RectI PlatformWindowManagerSDL::getMonitorRect(U32 index)
|
|||
return RectI(sdlRect.x, sdlRect.y, sdlRect.w, sdlRect.h);
|
||||
}
|
||||
|
||||
RectI PlatformWindowManagerSDL::getMonitorUsableRect(U32 index)
|
||||
{
|
||||
SDL_Rect sdlRect;
|
||||
if (0 != SDL_GetDisplayUsableBounds(index, &sdlRect))
|
||||
{
|
||||
Con::errorf("SDL_GetDisplayUsableBounds() failed: %s", SDL_GetError());
|
||||
return RectI(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
return RectI(sdlRect.x, sdlRect.y, sdlRect.w, sdlRect.h);
|
||||
}
|
||||
|
||||
U32 PlatformWindowManagerSDL::getMonitorModeCount(U32 monitorIndex)
|
||||
{
|
||||
S32 modeCount = SDL_GetNumDisplayModes(monitorIndex);
|
||||
if (modeCount < 0)
|
||||
{
|
||||
Con::errorf("SDL_GetNumDisplayModes(%d) failed: %s", monitorIndex, SDL_GetError());
|
||||
modeCount = 0;
|
||||
}
|
||||
|
||||
return (U32)modeCount;
|
||||
}
|
||||
|
||||
const String PlatformWindowManagerSDL::getMonitorMode(U32 monitorIndex, U32 modeIndex)
|
||||
{
|
||||
SDL_DisplayMode mode = { SDL_PIXELFORMAT_UNKNOWN, 0, 0, 0, 0 };
|
||||
if (SDL_GetDisplayMode(monitorIndex, modeIndex, &mode) != 0)
|
||||
{
|
||||
Con::errorf("SDL_GetDisplayMode(%d, %d) failed: %s", monitorIndex, modeIndex, SDL_GetError());
|
||||
return String::EmptyString;
|
||||
}
|
||||
|
||||
GFXVideoMode vm;
|
||||
vm.resolution.set(mode.w, mode.h);
|
||||
vm.refreshRate = mode.refresh_rate;
|
||||
vm.bitDepth = 32;
|
||||
vm.antialiasLevel = 0;
|
||||
vm.fullScreen = false;
|
||||
vm.wideScreen = false;
|
||||
|
||||
return vm.toString();
|
||||
}
|
||||
|
||||
const String PlatformWindowManagerSDL::getMonitorDesktopMode(U32 monitorIndex)
|
||||
{
|
||||
SDL_DisplayMode mode = { SDL_PIXELFORMAT_UNKNOWN, 0, 0, 0, 0 };
|
||||
if (SDL_GetDesktopDisplayMode(monitorIndex, &mode) != 0)
|
||||
{
|
||||
Con::errorf("SDL_GetDesktopDisplayMode(%d) failed: %s", monitorIndex, SDL_GetError());
|
||||
return String::EmptyString;
|
||||
}
|
||||
|
||||
GFXVideoMode vm;
|
||||
vm.resolution.set(mode.w, mode.h);
|
||||
vm.refreshRate = mode.refresh_rate;
|
||||
|
||||
int bbp;
|
||||
unsigned int r, g, b, a;
|
||||
SDL_PixelFormatEnumToMasks(mode.format, &bbp, &r, &g, &b, &a);
|
||||
vm.bitDepth = bbp;
|
||||
vm.antialiasLevel = 0;
|
||||
vm.fullScreen = false;
|
||||
vm.wideScreen = ((mode.w / 16) * 9) == mode.h;
|
||||
|
||||
return vm.toString();
|
||||
}
|
||||
|
||||
void PlatformWindowManagerSDL::getMonitorRegions(Vector<RectI> ®ions)
|
||||
{
|
||||
SDL_Rect sdlRect;
|
||||
|
|
@ -251,6 +319,9 @@ PlatformWindow *PlatformWindowManagerSDL::createWindow(GFXDevice *device, const
|
|||
|
||||
linkWindow(window);
|
||||
|
||||
SDL_SetWindowMinimumSize(window->mWindowHandle, Con::getIntVariable("$Video::minimumXResolution", 1024),
|
||||
Con::getIntVariable("$Video::minimumYResolution", 720));
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
|
|
@ -513,3 +584,4 @@ AFTER_MODULE_INIT(gfx)
|
|||
SDL_StopTextInput();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue