mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-01-26 12:59:18 +01:00
WinRT: moved the WinRT SDL_VideoDevice out of SDL_WinRTApp
This was done to help pave the way for XAML support.
This commit is contained in:
parent
253b9aae89
commit
6dc2a410eb
@ -40,6 +40,7 @@ extern "C" {
|
|||||||
#include "SDL_winrtapp.h"
|
#include "SDL_winrtapp.h"
|
||||||
|
|
||||||
extern SDL_Window * WINRT_GlobalSDLWindow;
|
extern SDL_Window * WINRT_GlobalSDLWindow;
|
||||||
|
extern SDL_VideoDevice * WINRT_GlobalSDLVideoDevice;
|
||||||
|
|
||||||
|
|
||||||
// Compile-time debugging options:
|
// Compile-time debugging options:
|
||||||
@ -145,8 +146,7 @@ static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *n
|
|||||||
|
|
||||||
SDL_WinRTApp::SDL_WinRTApp() :
|
SDL_WinRTApp::SDL_WinRTApp() :
|
||||||
m_windowClosed(false),
|
m_windowClosed(false),
|
||||||
m_windowVisible(true),
|
m_windowVisible(true)
|
||||||
m_sdlVideoDevice(NULL)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,9 +306,9 @@ void SDL_WinRTApp::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEven
|
|||||||
// 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 resizedDisplayMode = CalcCurrentDisplayMode();
|
SDL_DisplayMode resizedDisplayMode = CalcCurrentDisplayMode();
|
||||||
m_sdlVideoDevice->displays[0].current_mode = resizedDisplayMode;
|
WINRT_GlobalSDLVideoDevice->displays[0].current_mode = resizedDisplayMode;
|
||||||
m_sdlVideoDevice->displays[0].desktop_mode = resizedDisplayMode;
|
WINRT_GlobalSDLVideoDevice->displays[0].desktop_mode = resizedDisplayMode;
|
||||||
m_sdlVideoDevice->displays[0].display_modes[0] = resizedDisplayMode;
|
WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0] = resizedDisplayMode;
|
||||||
|
|
||||||
// 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);
|
||||||
@ -487,8 +487,3 @@ SDL_DisplayMode SDL_WinRTApp::CalcCurrentDisplayMode()
|
|||||||
|
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_WinRTApp::SetSDLVideoDevice(const SDL_VideoDevice * videoDevice)
|
|
||||||
{
|
|
||||||
m_sdlVideoDevice = videoDevice;
|
|
||||||
}
|
|
||||||
|
@ -16,7 +16,6 @@ internal:
|
|||||||
// SDL-specific methods
|
// SDL-specific methods
|
||||||
SDL_DisplayMode CalcCurrentDisplayMode();
|
SDL_DisplayMode CalcCurrentDisplayMode();
|
||||||
void PumpEvents();
|
void PumpEvents();
|
||||||
void SetSDLVideoDevice(const SDL_VideoDevice * videoDevice);
|
|
||||||
Windows::Foundation::Point TransformCursor(Windows::Foundation::Point rawPosition);
|
Windows::Foundation::Point TransformCursor(Windows::Foundation::Point rawPosition);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -40,5 +39,4 @@ protected:
|
|||||||
private:
|
private:
|
||||||
bool m_windowClosed;
|
bool m_windowClosed;
|
||||||
bool m_windowVisible;
|
bool m_windowVisible;
|
||||||
const SDL_VideoDevice* m_sdlVideoDevice;
|
|
||||||
};
|
};
|
||||||
|
@ -79,6 +79,11 @@ struct SDL_WindowData
|
|||||||
SDL_Window * WINRT_GlobalSDLWindow = NULL;
|
SDL_Window * WINRT_GlobalSDLWindow = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/* The global, WinRT, video device.
|
||||||
|
*/
|
||||||
|
SDL_VideoDevice * WINRT_GlobalSDLVideoDevice = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* WinRT driver bootstrap functions */
|
/* WinRT driver bootstrap functions */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -90,7 +95,9 @@ WINRT_Available(void)
|
|||||||
static void
|
static void
|
||||||
WINRT_DeleteDevice(SDL_VideoDevice * device)
|
WINRT_DeleteDevice(SDL_VideoDevice * device)
|
||||||
{
|
{
|
||||||
SDL_WinRTGlobalApp->SetSDLVideoDevice(NULL);
|
if (device == WINRT_GlobalSDLVideoDevice) {
|
||||||
|
WINRT_GlobalSDLVideoDevice = NULL;
|
||||||
|
}
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +125,7 @@ WINRT_CreateDevice(int devindex)
|
|||||||
device->PumpEvents = WINRT_PumpEvents;
|
device->PumpEvents = WINRT_PumpEvents;
|
||||||
device->GetWindowWMInfo = WINRT_GetWindowWMInfo;
|
device->GetWindowWMInfo = WINRT_GetWindowWMInfo;
|
||||||
device->free = WINRT_DeleteDevice;
|
device->free = WINRT_DeleteDevice;
|
||||||
SDL_WinRTGlobalApp->SetSDLVideoDevice(device);
|
WINRT_GlobalSDLVideoDevice = NULL;
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user