WinRT: more minor code cleanups
authorDavid Ludwig <dludwig@pobox.com>
Fri, 22 Feb 2013 23:53:37 -0500
changeset 8437 d6a6c3ebdf3e
parent 8436 6d2329b6f7c7
child 8438 ad359570c7cc
WinRT: more minor code cleanups
src/video/windowsrt/SDL_WinRTApp.cpp
src/video/windowsrt/SDL_WinRTApp.h
src/video/windowsrt/SDL_winrtmouse.cpp
src/video/windowsrt/SDL_winrtvideo.cpp
--- a/src/video/windowsrt/SDL_WinRTApp.cpp	Fri Feb 22 23:44:34 2013 -0500
+++ b/src/video/windowsrt/SDL_WinRTApp.cpp	Fri Feb 22 23:53:37 2013 -0500
@@ -49,6 +49,34 @@
 // 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 @@
 {
     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;
-}
--- a/src/video/windowsrt/SDL_WinRTApp.h	Fri Feb 22 23:44:34 2013 -0500
+++ b/src/video/windowsrt/SDL_WinRTApp.h	Fri Feb 22 23:53:37 2013 -0500
@@ -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 @@
     const SDL_VideoDevice* m_sdlVideoDevice;
     bool m_useRelativeMouseMode;
 };
-
-ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
-{
-public:
-    virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
-};
--- a/src/video/windowsrt/SDL_winrtmouse.cpp	Fri Feb 22 23:44:34 2013 -0500
+++ b/src/video/windowsrt/SDL_winrtmouse.cpp	Fri Feb 22 23:53:37 2013 -0500
@@ -32,6 +32,7 @@
 #include "SDL_WinRTApp.h"
 #include "SDL_winrtmouse.h"
 
+using namespace Windows::UI::Core;
 using Windows::UI::Core::CoreCursor;
 
 extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;
--- a/src/video/windowsrt/SDL_winrtvideo.cpp	Fri Feb 22 23:44:34 2013 -0500
+++ b/src/video/windowsrt/SDL_winrtvideo.cpp	Fri Feb 22 23:53:37 2013 -0500
@@ -43,6 +43,8 @@
 #include "SDL_winrtevents_c.h"
 #include "SDL_winrtmouse.h"
 
+using namespace Windows::UI::Core;
+
 /* On Windows, windows.h defines CreateWindow */
 #ifdef CreateWindow
 #undef CreateWindow