Skip to content

Commit

Permalink
WinRT: misc code cleanups regarding touch and mouse events, and also …
Browse files Browse the repository at this point in the history
…SDL-internal globals
  • Loading branch information
DavidLudwig committed Sep 2, 2013
1 parent a94e418 commit 7e06b80
Show file tree
Hide file tree
Showing 15 changed files with 483 additions and 360 deletions.
7 changes: 7 additions & 0 deletions VisualC-WinPhone/SDL/SDL_VS2012-WinPhone.vcxproj
Expand Up @@ -198,6 +198,7 @@
<ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.h" />
<ClInclude Include="..\..\src\core\windows\SDL_windows.h" />
<ClInclude Include="..\..\src\core\winrt\SDL_winrtapp.h" />
<ClInclude Include="..\..\src\core\winrt\SDL_winrtxaml_cpp.h" />
<ClInclude Include="..\..\src\events\blank_cursor.h" />
<ClInclude Include="..\..\src\events\default_cursor.h" />
<ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h" />
Expand Down Expand Up @@ -381,6 +382,12 @@
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
</ClCompile>
<ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
</ClCompile>
<ClCompile Include="..\..\src\video\winrt\SDL_winrtvideo.cpp">
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
Expand Down
6 changes: 6 additions & 0 deletions VisualC-WinPhone/SDL/SDL_VS2012-WinPhone.vcxproj.filters
Expand Up @@ -336,6 +336,9 @@
<ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\winrt\SDL_winrtxaml_cpp.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\atomic\SDL_atomic.c">
Expand Down Expand Up @@ -599,6 +602,9 @@
<ClCompile Include="..\..\src\core\winrt\SDL_winrtxaml.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<FxCompile Include="..\..\src\render\direct3d11\SDL_D3D11_PixelShader_FixedColor.hlsl">
Expand Down
9 changes: 9 additions & 0 deletions VisualC-WinRT/SDL/SDL_VS2012-WinRT.vcxproj
Expand Up @@ -176,6 +176,14 @@
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
</ClCompile>
<ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
</ClCompile>
<ClCompile Include="..\..\src\video\winrt\SDL_winrtvideo.cpp">
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
Expand Down Expand Up @@ -244,6 +252,7 @@
<ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.h" />
<ClInclude Include="..\..\src\core\windows\SDL_windows.h" />
<ClInclude Include="..\..\src\core\winrt\SDL_winrtapp.h" />
<ClInclude Include="..\..\src\core\winrt\SDL_winrtxaml_cpp.h" />
<ClInclude Include="..\..\src\events\blank_cursor.h" />
<ClInclude Include="..\..\src\events\default_cursor.h" />
<ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h" />
Expand Down
6 changes: 6 additions & 0 deletions VisualC-WinRT/SDL/SDL_VS2012-WinRT.vcxproj.filters
Expand Up @@ -270,6 +270,9 @@
<ClCompile Include="..\..\src\joystick\winrt\SDL_xinputjoystick.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\winrt\SDL_winrtxaml.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -602,6 +605,9 @@
<ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\winrt\SDL_winrtxaml_cpp.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Header Files">
Expand Down
5 changes: 1 addition & 4 deletions src/core/winrt/SDL_winrtapp.cpp
Expand Up @@ -37,12 +37,9 @@ extern "C" {
}

#include "../../video/winrt/SDL_winrtevents_c.h"
#include "../../video/winrt/SDL_winrtvideo_cpp.h"
#include "SDL_winrtapp.h"

extern SDL_Window * WINRT_GlobalSDLWindow;
extern SDL_VideoDevice * WINRT_GlobalSDLVideoDevice;
extern SDL_DisplayMode WINRT_CalcDisplayModeUsingNativeWindow();


// Compile-time debugging options:
// To enable, uncomment; to disable, comment them out.
Expand Down
2 changes: 2 additions & 0 deletions src/core/winrt/SDL_winrtapp.h
Expand Up @@ -38,3 +38,5 @@ ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFramewo
bool m_windowClosed;
bool m_windowVisible;
};

extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;
11 changes: 3 additions & 8 deletions src/core/winrt/SDL_winrtxaml.cpp
Expand Up @@ -30,18 +30,13 @@

/* SDL includes */
#include "SDL.h"
//#include "SDL_error.h"
//#include "SDL_log.h"
//#include "SDL_main.h"
//#include "SDL_system.h"
#include "../../video/winrt/SDL_winrtevents_c.h"
#include "../../video/winrt/SDL_winrtvideo_cpp.h"
#include "SDL_winrtxaml_cpp.h"


/* External globals: */
extern SDL_Window * WINRT_GlobalSDLWindow;


/* Internal globals: */
/* SDL-internal globals: */
SDL_bool WINRT_XAMLWasEnabled = SDL_FALSE;
int (*WINRT_XAMLAppMainFunction)(int, char **) = NULL;

Expand Down
33 changes: 33 additions & 0 deletions src/core/winrt/SDL_winrtxaml_cpp.h
@@ -0,0 +1,33 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"

#ifndef _SDL_winrtxaml_h
#define _SDL_winrtxaml_h

#include "SDL_types.h"

#ifdef __cplusplus
extern SDL_bool WINRT_XAMLWasEnabled;
extern int (*WINRT_XAMLAppMainFunction)(int, char **);
#endif // ifdef __cplusplus

#endif // ifndef _SDL_winrtxaml_h
19 changes: 13 additions & 6 deletions src/video/winrt/SDL_winrtevents.cpp
Expand Up @@ -22,9 +22,19 @@

#if SDL_VIDEO_DRIVER_WINRT

/* SDL includes */
/*
* Windows includes:
*/
#include <Windows.h>
using namespace Windows::UI::Core;
using Windows::UI::Core::CoreCursor;

/*
* SDL includes:
*/
#include "SDL_winrtevents_c.h"
#include "../../core/winrt/SDL_winrtapp.h"
#include "../../core/winrt/SDL_winrtxaml_cpp.h"
#include "SDL_assert.h"
#include "SDL_system.h"

Expand All @@ -34,10 +44,8 @@ extern "C" {
}


/* Forward declarations and globals */
extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;
extern int (*WINRT_XAMLAppMainFunction)(int, char **);
extern void WINRT_YieldXAMLThread();
/* Forward declarations */
static void WINRT_YieldXAMLThread();


/* Global event management */
Expand Down Expand Up @@ -135,7 +143,6 @@ WINRT_CycleXAMLThread()
}
}


#endif /* SDL_VIDEO_DRIVER_WINRT */

/* vi: set ts=4 sw=4 expandtab: */
3 changes: 2 additions & 1 deletion src/video/winrt/SDL_winrtevents_c.h
Expand Up @@ -32,6 +32,7 @@ extern "C" {
extern "C" {
#endif

extern void WINRT_InitTouch(_THIS);
extern void WINRT_PumpEvents(_THIS);

#ifdef __cplusplus
Expand Down Expand Up @@ -60,6 +61,6 @@ extern Windows::Foundation::Point WINRT_TransformCursorPosition(SDL_Window * win
/* XAML Thread Management */
extern void WINRT_CycleXAMLThread();

#endif
#endif // ifdef __cplusplus_winrt

/* vi: set ts=4 sw=4 expandtab: */

0 comments on commit 7e06b80

Please sign in to comment.