mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
WinRT: made all SDL_Windows get sized to the WinRT-defined window size
This change removes some code that attempted to allow non-standard window sizes, the idea of which was to do display scaling, and a hackish one at that. If display scaling is needed, use SDL_Renderer as appropriate.
This commit is contained in:
parent
409d9b1ce7
commit
065b2cf470
@ -300,10 +300,12 @@ void SDL_WinRTApp::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEven
|
|||||||
// window-resize event as it appeared the SDL window didn't change
|
// window-resize event as it appeared the SDL window didn't change
|
||||||
// size, and the Direct3D 11.1 renderer wouldn't resize its swap
|
// size, and the Direct3D 11.1 renderer wouldn't resize its swap
|
||||||
// chain.
|
// chain.
|
||||||
//
|
SDL_DisplayMode newDisplayMode = GetMainDisplayMode();
|
||||||
// TODO, WinRT: consider dropping old display modes after the fullscreen window changes size (from rotations, etc.)
|
m_sdlVideoDevice->displays[0].current_mode = newDisplayMode;
|
||||||
m_sdlWindowData->sdlWindow->fullscreen_mode = GetMainDisplayMode();
|
m_sdlVideoDevice->displays[0].desktop_mode = newDisplayMode;
|
||||||
SDL_AddDisplayMode(&m_sdlVideoDevice->displays[0], &m_sdlWindowData->sdlWindow->fullscreen_mode);
|
m_sdlVideoDevice->displays[0].display_modes[0] = newDisplayMode;
|
||||||
|
|
||||||
|
m_sdlWindowData->sdlWindow->fullscreen_mode = newDisplayMode;
|
||||||
|
|
||||||
// Send the window-resize event to the rest of SDL, and to apps:
|
// Send the window-resize event to the rest of SDL, and to apps:
|
||||||
const int windowWidth = (int) ceil(args->Size.Width);
|
const int windowWidth = (int) ceil(args->Size.Width);
|
||||||
|
@ -187,31 +187,14 @@ WINRT_CreateWindow(_THIS, SDL_Window * window)
|
|||||||
SDL_WINDOW_MAXIMIZED |
|
SDL_WINDOW_MAXIMIZED |
|
||||||
SDL_WINDOW_INPUT_GRABBED;
|
SDL_WINDOW_INPUT_GRABBED;
|
||||||
|
|
||||||
/* HACK from DLudwig: The following line of code prevents
|
/* WinRT does not, as of this writing, appear to support app-adjustable
|
||||||
SDL_CreateWindow and SDL_UpdateFullscreenMode from trying to resize
|
window sizes. Set the window size to whatever the native WinRT
|
||||||
the window after the call to WINRT_CreateWindow returns.
|
CoreWindow is set at.
|
||||||
|
|
||||||
This hack should allow a window to be created in virtually any size,
|
TODO, WinRT: if and when non-fullscreen XAML control support is added to SDL, consider making those resizable via SDL_Window's interfaces.
|
||||||
and more importantly, it allows a window's framebuffer, as created and
|
|
||||||
retrieved via SDL_GetWindowSurface, to be in any size. This can be
|
|
||||||
utilized by apps centered around software rendering, such as ports
|
|
||||||
of older apps. The app can have SDL create a framebuffer in any size
|
|
||||||
it chooses. SDL will scale the framebuffer to the native
|
|
||||||
screen size on the GPU (via SDL_UpdateWindowSurface).
|
|
||||||
*/
|
*/
|
||||||
_this->displays[0].fullscreen_window = window;
|
window->w = _this->displays[0].current_mode.w;
|
||||||
|
window->h = _this->displays[0].current_mode.h;
|
||||||
/* Further prevent any display resizing, and make sure SDL_GetWindowDisplayMode
|
|
||||||
can report the correct size of windows, by creating a new display
|
|
||||||
mode in the requested size. To note, if the window is being created in
|
|
||||||
the device's native screen size, SDL_AddDisplayMode will do nothing.
|
|
||||||
*/
|
|
||||||
window->fullscreen_mode = SDL_WinRTGlobalApp->GetMainDisplayMode();
|
|
||||||
window->fullscreen_mode.w = window->w;
|
|
||||||
window->fullscreen_mode.h = window->h;
|
|
||||||
SDL_AddDisplayMode(&_this->displays[0], &window->fullscreen_mode);
|
|
||||||
|
|
||||||
/* TODO: Consider removing custom display modes in WINRT_DestroyWindow. */
|
|
||||||
|
|
||||||
/* Make sure the WinRT app's IFramworkView can post events on
|
/* Make sure the WinRT app's IFramworkView can post events on
|
||||||
behalf of SDL:
|
behalf of SDL:
|
||||||
|
Loading…
Reference in New Issue
Block a user