mirror of
https://github.com/yawut/SDL.git
synced 2026-07-26 13:11:22 -05:00
WinRT: more minor code cleanups
This commit is contained in:
parent
b0e0d9e39d
commit
c11dabbf44
|
|
@ -49,6 +49,34 @@ static SDL_WinRT_MainFunction SDL_WinRT_main = nullptr;
|
|||
// SDL_CreateWindow().
|
||||
SDL_WinRTApp ^ SDL_WinRTGlobalApp = nullptr;
|
||||
|
||||
ref class SDLApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
|
||||
{
|
||||
public:
|
||||
virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
|
||||
};
|
||||
|
||||
IFrameworkView^ SDLApplicationSource::CreateView()
|
||||
{
|
||||
// TODO, WinRT: see if this function (CreateView) can ever get called
|
||||
// more than once. For now, just prevent it from ever assigning
|
||||
// SDL_WinRTGlobalApp more than once.
|
||||
SDL_assert(!SDL_WinRTGlobalApp);
|
||||
SDL_WinRTApp ^ app = ref new SDL_WinRTApp();
|
||||
if (!SDL_WinRTGlobalApp)
|
||||
{
|
||||
SDL_WinRTGlobalApp = app;
|
||||
}
|
||||
return app;
|
||||
}
|
||||
|
||||
__declspec(dllexport) int SDL_WinRT_RunApplication(SDL_WinRT_MainFunction mainFunction)
|
||||
{
|
||||
SDL_WinRT_main = mainFunction;
|
||||
auto direct3DApplicationSource = ref new SDLApplicationSource();
|
||||
CoreApplication::Run(direct3DApplicationSource);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void WINRT_SetDisplayOrientationsPreference(const char *name, const char *oldValue, const char *newValue)
|
||||
{
|
||||
SDL_assert(SDL_strcmp(name, SDL_HINT_ORIENTATIONS) == 0);
|
||||
|
|
@ -859,25 +887,3 @@ void SDL_WinRTApp::SetSDLVideoDevice(const SDL_VideoDevice * videoDevice)
|
|||
{
|
||||
m_sdlVideoDevice = videoDevice;
|
||||
}
|
||||
|
||||
IFrameworkView^ Direct3DApplicationSource::CreateView()
|
||||
{
|
||||
// TODO, WinRT: see if this function (CreateView) can ever get called
|
||||
// more than once. For now, just prevent it from ever assigning
|
||||
// SDL_WinRTGlobalApp more than once.
|
||||
SDL_assert(!SDL_WinRTGlobalApp);
|
||||
SDL_WinRTApp ^ app = ref new SDL_WinRTApp();
|
||||
if (!SDL_WinRTGlobalApp)
|
||||
{
|
||||
SDL_WinRTGlobalApp = app;
|
||||
}
|
||||
return app;
|
||||
}
|
||||
|
||||
__declspec(dllexport) int SDL_WinRT_RunApplication(SDL_WinRT_MainFunction mainFunction)
|
||||
{
|
||||
SDL_WinRT_main = mainFunction;
|
||||
auto direct3DApplicationSource = ref new Direct3DApplicationSource();
|
||||
CoreApplication::Run(direct3DApplicationSource);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
#include "SDLmain_WinRT_common.h"
|
||||
#include "SDL_winrtvideo.h"
|
||||
#include <vector>
|
||||
|
||||
using namespace Windows::UI::Core;
|
||||
|
||||
ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFrameworkView
|
||||
{
|
||||
|
|
@ -53,9 +50,3 @@ private:
|
|||
const SDL_VideoDevice* m_sdlVideoDevice;
|
||||
bool m_useRelativeMouseMode;
|
||||
};
|
||||
|
||||
ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
|
||||
{
|
||||
public:
|
||||
virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ extern "C" {
|
|||
#include "SDL_WinRTApp.h"
|
||||
#include "SDL_winrtmouse.h"
|
||||
|
||||
using namespace Windows::UI::Core;
|
||||
using Windows::UI::Core::CoreCursor;
|
||||
|
||||
extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ extern "C" {
|
|||
#include "SDL_winrtevents_c.h"
|
||||
#include "SDL_winrtmouse.h"
|
||||
|
||||
using namespace Windows::UI::Core;
|
||||
|
||||
/* On Windows, windows.h defines CreateWindow */
|
||||
#ifdef CreateWindow
|
||||
#undef CreateWindow
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user