Integrated David Ludwig's support for Windows RT
authorSam Lantinga <slouken@libsdl.org>
Sun, 09 Mar 2014 11:36:47 -0700
changeset 8583fb2933ca805f
parent 8303 7ee46ffa9c24
parent 8582 c3e9a2b93517
child 8584 58a69af25ccc
Integrated David Ludwig's support for Windows RT
VisualC/SDL/SDL_VS2012.vcxproj
Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
include/SDL_config.h
include/SDL_cpuinfo.h
include/SDL_egl.h
include/SDL_hints.h
include/SDL_main.h
include/SDL_opengles2.h
include/SDL_platform.h
include/SDL_stdinc.h
include/SDL_system.h
include/SDL_syswm.h
include/SDL_types.h
include/begin_code.h
include/close_code.h
src/SDL_assert.c
src/SDL_log.c
src/atomic/SDL_spinlock.c
src/audio/xaudio2/SDL_xaudio2.c
src/core/windows/SDL_windows.c
src/core/windows/SDL_windows.h
src/events/SDL_events.c
src/file/SDL_rwops.c
src/joystick/SDL_gamecontroller.c
src/joystick/SDL_gamecontrollerdb.h
src/joystick/SDL_sysjoystick.h
src/joystick/android/SDL_sysjoystick.c
src/loadso/windows/SDL_sysloadso.c
src/render/SDL_render.c
src/render/SDL_sysrender.h
src/render/opengles2/SDL_render_gles2.c
src/stdlib/SDL_stdlib.c
src/thread/SDL_thread_c.h
src/timer/windows/SDL_systimer.c
src/video/SDL_egl.c
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/uikit/SDL_uikitopengles.m
src/video/uikit/SDL_uikitview.m
src/video/uikit/SDL_uikitwindow.m
test/loopwave.c
test/testthread.c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj	Sun Mar 09 11:36:47 2014 -0700
     1.3 @@ -0,0 +1,404 @@
     1.4 +<?xml version="1.0" encoding="utf-8"?>
     1.5 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     1.6 +  <ItemGroup Label="ProjectConfigurations">
     1.7 +    <ProjectConfiguration Include="Debug|Win32">
     1.8 +      <Configuration>Debug</Configuration>
     1.9 +      <Platform>Win32</Platform>
    1.10 +    </ProjectConfiguration>
    1.11 +    <ProjectConfiguration Include="Debug|ARM">
    1.12 +      <Configuration>Debug</Configuration>
    1.13 +      <Platform>ARM</Platform>
    1.14 +    </ProjectConfiguration>
    1.15 +    <ProjectConfiguration Include="Release|Win32">
    1.16 +      <Configuration>Release</Configuration>
    1.17 +      <Platform>Win32</Platform>
    1.18 +    </ProjectConfiguration>
    1.19 +    <ProjectConfiguration Include="Release|ARM">
    1.20 +      <Configuration>Release</Configuration>
    1.21 +      <Platform>ARM</Platform>
    1.22 +    </ProjectConfiguration>
    1.23 +  </ItemGroup>
    1.24 +  <PropertyGroup Label="Globals">
    1.25 +    <ProjectGuid>{33048af1-031a-4ce6-b61e-fad2db832e9e}</ProjectGuid>
    1.26 +    <RootNamespace>SDL</RootNamespace>
    1.27 +    <DefaultLanguage>en-US</DefaultLanguage>
    1.28 +    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
    1.29 +    <ProjectName>SDL-WinPhone</ProjectName>
    1.30 +  </PropertyGroup>
    1.31 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
    1.32 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    1.33 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
    1.34 +    <UseDebugLibraries>true</UseDebugLibraries>
    1.35 +    <PlatformToolset>v110_wp80</PlatformToolset>
    1.36 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
    1.37 +  </PropertyGroup>
    1.38 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
    1.39 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
    1.40 +    <UseDebugLibraries>true</UseDebugLibraries>
    1.41 +    <PlatformToolset>v110_wp80</PlatformToolset>
    1.42 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
    1.43 +  </PropertyGroup>
    1.44 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    1.45 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
    1.46 +    <UseDebugLibraries>false</UseDebugLibraries>
    1.47 +    <WholeProgramOptimization>true</WholeProgramOptimization>
    1.48 +    <PlatformToolset>v110_wp80</PlatformToolset>
    1.49 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
    1.50 +  </PropertyGroup>
    1.51 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
    1.52 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
    1.53 +    <UseDebugLibraries>false</UseDebugLibraries>
    1.54 +    <WholeProgramOptimization>true</WholeProgramOptimization>
    1.55 +    <PlatformToolset>v110_wp80</PlatformToolset>
    1.56 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
    1.57 +  </PropertyGroup>
    1.58 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
    1.59 +  <ImportGroup Label="PropertySheets">
    1.60 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    1.61 +  </ImportGroup>
    1.62 +  <PropertyGroup Label="UserMacros" />
    1.63 +  <PropertyGroup>
    1.64 +    <GenerateManifest>false</GenerateManifest>
    1.65 +  </PropertyGroup>
    1.66 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    1.67 +    <ClCompile>
    1.68 +      <PreprocessorDefinitions>_USRDLL;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.69 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
    1.70 +      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
    1.71 +      <CompileAsWinRT>false</CompileAsWinRT>
    1.72 +      <AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
    1.73 +      <AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
    1.74 +      <MinimalRebuild>false</MinimalRebuild>
    1.75 +    </ClCompile>
    1.76 +    <Link>
    1.77 +      <SubSystem>Console</SubSystem>
    1.78 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
    1.79 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
    1.80 +      <GenerateDebugInformation>true</GenerateDebugInformation>
    1.81 +      <AdditionalDependencies>d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
    1.82 +    </Link>
    1.83 +  </ItemDefinitionGroup>
    1.84 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    1.85 +    <ClCompile>
    1.86 +      <PreprocessorDefinitions>_USRDLL;UNICODE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.87 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
    1.88 +      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
    1.89 +      <CompileAsWinRT>false</CompileAsWinRT>
    1.90 +      <AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
    1.91 +      <AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
    1.92 +    </ClCompile>
    1.93 +    <Link>
    1.94 +      <SubSystem>Console</SubSystem>
    1.95 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
    1.96 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
    1.97 +      <GenerateDebugInformation>true</GenerateDebugInformation>
    1.98 +      <AdditionalDependencies>d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
    1.99 +    </Link>
   1.100 +  </ItemDefinitionGroup>
   1.101 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
   1.102 +    <ClCompile>
   1.103 +      <PreprocessorDefinitions>_USRDLL;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   1.104 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   1.105 +      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
   1.106 +      <CompileAsWinRT>false</CompileAsWinRT>
   1.107 +      <AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
   1.108 +      <AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
   1.109 +      <MinimalRebuild>false</MinimalRebuild>
   1.110 +    </ClCompile>
   1.111 +    <Link>
   1.112 +      <SubSystem>Console</SubSystem>
   1.113 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   1.114 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   1.115 +      <GenerateDebugInformation>true</GenerateDebugInformation>
   1.116 +      <AdditionalDependencies>d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
   1.117 +    </Link>
   1.118 +  </ItemDefinitionGroup>
   1.119 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
   1.120 +    <ClCompile>
   1.121 +      <PreprocessorDefinitions>_USRDLL;UNICODE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   1.122 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   1.123 +      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
   1.124 +      <CompileAsWinRT>false</CompileAsWinRT>
   1.125 +      <AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
   1.126 +      <AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
   1.127 +    </ClCompile>
   1.128 +    <Link>
   1.129 +      <SubSystem>Console</SubSystem>
   1.130 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   1.131 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   1.132 +      <GenerateDebugInformation>true</GenerateDebugInformation>
   1.133 +      <AdditionalDependencies>d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
   1.134 +    </Link>
   1.135 +  </ItemDefinitionGroup>
   1.136 +  <ItemGroup>
   1.137 +    <Reference Include="Windows">
   1.138 +      <IsWinMDFile>true</IsWinMDFile>
   1.139 +    </Reference>
   1.140 +    <Reference Include="platform.winmd">
   1.141 +      <IsWinMDFile>true</IsWinMDFile>
   1.142 +      <Private>false</Private>
   1.143 +    </Reference>
   1.144 +  </ItemGroup>
   1.145 +  <ItemGroup>
   1.146 +    <ClInclude Include="..\..\include\begin_code.h" />
   1.147 +    <ClInclude Include="..\..\include\close_code.h" />
   1.148 +    <ClInclude Include="..\..\include\SDL.h" />
   1.149 +    <ClInclude Include="..\..\include\SDL_assert.h" />
   1.150 +    <ClInclude Include="..\..\include\SDL_atomic.h" />
   1.151 +    <ClInclude Include="..\..\include\SDL_audio.h" />
   1.152 +    <ClInclude Include="..\..\include\SDL_blendmode.h" />
   1.153 +    <ClInclude Include="..\..\include\SDL_clipboard.h" />
   1.154 +    <ClInclude Include="..\..\include\SDL_config.h" />
   1.155 +    <ClInclude Include="..\..\include\SDL_config_minimal.h" />
   1.156 +    <ClInclude Include="..\..\include\SDL_config_winrt.h" />
   1.157 +    <ClInclude Include="..\..\include\SDL_copying.h" />
   1.158 +    <ClInclude Include="..\..\include\SDL_cpuinfo.h" />
   1.159 +    <ClInclude Include="..\..\include\SDL_endian.h" />
   1.160 +    <ClInclude Include="..\..\include\SDL_error.h" />
   1.161 +    <ClInclude Include="..\..\include\SDL_events.h" />
   1.162 +    <ClInclude Include="..\..\include\SDL_filesystem.h" />
   1.163 +    <ClInclude Include="..\..\include\SDL_haptic.h" />
   1.164 +    <ClInclude Include="..\..\include\SDL_hints.h" />
   1.165 +    <ClInclude Include="..\..\include\SDL_input.h" />
   1.166 +    <ClInclude Include="..\..\include\SDL_joystick.h" />
   1.167 +    <ClInclude Include="..\..\include\SDL_keyboard.h" />
   1.168 +    <ClInclude Include="..\..\include\SDL_keycode.h" />
   1.169 +    <ClInclude Include="..\..\include\SDL_loadso.h" />
   1.170 +    <ClInclude Include="..\..\include\SDL_log.h" />
   1.171 +    <ClInclude Include="..\..\include\SDL_main.h" />
   1.172 +    <ClInclude Include="..\..\include\SDL_mouse.h" />
   1.173 +    <ClInclude Include="..\..\include\SDL_mutex.h" />
   1.174 +    <ClInclude Include="..\..\include\SDL_name.h" />
   1.175 +    <ClInclude Include="..\..\include\SDL_pixels.h" />
   1.176 +    <ClInclude Include="..\..\include\SDL_platform.h" />
   1.177 +    <ClInclude Include="..\..\include\SDL_power.h" />
   1.178 +    <ClInclude Include="..\..\include\SDL_quit.h" />
   1.179 +    <ClInclude Include="..\..\include\SDL_rect.h" />
   1.180 +    <ClInclude Include="..\..\include\SDL_render.h" />
   1.181 +    <ClInclude Include="..\..\include\SDL_revision.h" />
   1.182 +    <ClInclude Include="..\..\include\SDL_rwops.h" />
   1.183 +    <ClInclude Include="..\..\include\SDL_scancode.h" />
   1.184 +    <ClInclude Include="..\..\include\SDL_shape.h" />
   1.185 +    <ClInclude Include="..\..\include\SDL_stdinc.h" />
   1.186 +    <ClInclude Include="..\..\include\SDL_surface.h" />
   1.187 +    <ClInclude Include="..\..\include\SDL_system.h" />
   1.188 +    <ClInclude Include="..\..\include\SDL_syswm.h" />
   1.189 +    <ClInclude Include="..\..\include\SDL_thread.h" />
   1.190 +    <ClInclude Include="..\..\include\SDL_timer.h" />
   1.191 +    <ClInclude Include="..\..\include\SDL_touch.h" />
   1.192 +    <ClInclude Include="..\..\include\SDL_types.h" />
   1.193 +    <ClInclude Include="..\..\include\SDL_version.h" />
   1.194 +    <ClInclude Include="..\..\include\SDL_video.h" />
   1.195 +    <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h" />
   1.196 +    <ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h" />
   1.197 +    <ClInclude Include="..\..\src\audio\SDL_audiodev_c.h" />
   1.198 +    <ClInclude Include="..\..\src\audio\SDL_audiomem.h" />
   1.199 +    <ClInclude Include="..\..\src\audio\SDL_audio_c.h" />
   1.200 +    <ClInclude Include="..\..\src\audio\SDL_sysaudio.h" />
   1.201 +    <ClInclude Include="..\..\src\audio\SDL_wave.h" />
   1.202 +    <ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.h" />
   1.203 +    <ClInclude Include="..\..\src\core\windows\SDL_windows.h" />
   1.204 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_common.h" />
   1.205 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.h" />
   1.206 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_xaml.h" />
   1.207 +    <ClInclude Include="..\..\src\events\blank_cursor.h" />
   1.208 +    <ClInclude Include="..\..\src\events\default_cursor.h" />
   1.209 +    <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h" />
   1.210 +    <ClInclude Include="..\..\src\events\SDL_dropevents_c.h" />
   1.211 +    <ClInclude Include="..\..\src\events\SDL_events_c.h" />
   1.212 +    <ClInclude Include="..\..\src\events\SDL_keyboard_c.h" />
   1.213 +    <ClInclude Include="..\..\src\events\SDL_mouse_c.h" />
   1.214 +    <ClInclude Include="..\..\src\events\SDL_sysevents.h" />
   1.215 +    <ClInclude Include="..\..\src\events\SDL_touch_c.h" />
   1.216 +    <ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
   1.217 +    <ClInclude Include="..\..\src\haptic\SDL_haptic_c.h" />
   1.218 +    <ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
   1.219 +    <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
   1.220 +    <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
   1.221 +    <ClInclude Include="..\..\src\render\mmx.h" />
   1.222 +    <ClInclude Include="..\..\src\render\SDL_sysrender.h" />
   1.223 +    <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h" />
   1.224 +    <ClInclude Include="..\..\src\render\software\SDL_blendfillrect.h" />
   1.225 +    <ClInclude Include="..\..\src\render\software\SDL_blendline.h" />
   1.226 +    <ClInclude Include="..\..\src\render\software\SDL_blendpoint.h" />
   1.227 +    <ClInclude Include="..\..\src\render\software\SDL_draw.h" />
   1.228 +    <ClInclude Include="..\..\src\render\software\SDL_drawline.h" />
   1.229 +    <ClInclude Include="..\..\src\render\software\SDL_drawpoint.h" />
   1.230 +    <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
   1.231 +    <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
   1.232 +    <ClInclude Include="..\..\src\SDL_assert_c.h" />
   1.233 +    <ClInclude Include="..\..\src\SDL_error_c.h" />
   1.234 +    <ClInclude Include="..\..\src\SDL_fatal.h" />
   1.235 +    <ClInclude Include="..\..\src\SDL_hints_c.h" />
   1.236 +    <ClInclude Include="..\..\src\thread\SDL_systhread.h" />
   1.237 +    <ClInclude Include="..\..\src\thread\SDL_thread_c.h" />
   1.238 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h" />
   1.239 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h" />
   1.240 +    <ClInclude Include="..\..\src\timer\SDL_timer_c.h" />
   1.241 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h" />
   1.242 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullframebuffer_c.h" />
   1.243 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullvideo.h" />
   1.244 +    <ClInclude Include="..\..\src\video\SDL_blit.h" />
   1.245 +    <ClInclude Include="..\..\src\video\SDL_blit_auto.h" />
   1.246 +    <ClInclude Include="..\..\src\video\SDL_blit_copy.h" />
   1.247 +    <ClInclude Include="..\..\src\video\SDL_blit_slow.h" />
   1.248 +    <ClInclude Include="..\..\src\video\SDL_pixels_c.h" />
   1.249 +    <ClInclude Include="..\..\src\video\SDL_rect_c.h" />
   1.250 +    <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
   1.251 +    <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
   1.252 +    <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
   1.253 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
   1.254 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
   1.255 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
   1.256 +  </ItemGroup>
   1.257 +  <ItemGroup>
   1.258 +    <ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
   1.259 +    <ClCompile Include="..\..\src\atomic\SDL_spinlock.c" />
   1.260 +    <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c" />
   1.261 +    <ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c" />
   1.262 +    <ClCompile Include="..\..\src\audio\SDL_audio.c" />
   1.263 +    <ClCompile Include="..\..\src\audio\SDL_audiocvt.c" />
   1.264 +    <ClCompile Include="..\..\src\audio\SDL_audiodev.c" />
   1.265 +    <ClCompile Include="..\..\src\audio\SDL_audiotypecvt.c" />
   1.266 +    <ClCompile Include="..\..\src\audio\SDL_mixer.c" />
   1.267 +    <ClCompile Include="..\..\src\audio\SDL_wave.c" />
   1.268 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c" />
   1.269 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.cpp">
   1.270 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   1.271 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   1.272 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   1.273 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   1.274 +    </ClCompile>
   1.275 +    <ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
   1.276 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_common.cpp">
   1.277 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   1.278 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   1.279 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   1.280 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   1.281 +    </ClCompile>
   1.282 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.cpp">
   1.283 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   1.284 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   1.285 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   1.286 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   1.287 +    </ClCompile>
   1.288 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_xaml.cpp">
   1.289 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   1.290 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   1.291 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   1.292 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   1.293 +    </ClCompile>
   1.294 +    <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
   1.295 +    <ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
   1.296 +    <ClCompile Include="..\..\src\events\SDL_dropevents.c" />
   1.297 +    <ClCompile Include="..\..\src\events\SDL_events.c" />
   1.298 +    <ClCompile Include="..\..\src\events\SDL_gesture.c" />
   1.299 +    <ClCompile Include="..\..\src\events\SDL_keyboard.c" />
   1.300 +    <ClCompile Include="..\..\src\events\SDL_mouse.c" />
   1.301 +    <ClCompile Include="..\..\src\events\SDL_quit.c" />
   1.302 +    <ClCompile Include="..\..\src\events\SDL_touch.c" />
   1.303 +    <ClCompile Include="..\..\src\events\SDL_windowevents.c" />
   1.304 +    <ClCompile Include="..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp">
   1.305 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   1.306 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   1.307 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   1.308 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   1.309 +    </ClCompile>
   1.310 +    <ClCompile Include="..\..\src\file\SDL_rwops.c" />
   1.311 +    <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c" />
   1.312 +    <ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
   1.313 +    <ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c" />
   1.314 +    <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
   1.315 +    <ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
   1.316 +    <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
   1.317 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.cpp">
   1.318 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   1.319 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   1.320 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   1.321 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   1.322 +    </ClCompile>
   1.323 +    <ClCompile Include="..\..\src\render\SDL_render.c" />
   1.324 +    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
   1.325 +    <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
   1.326 +    <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
   1.327 +    <ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
   1.328 +    <ClCompile Include="..\..\src\render\software\SDL_blendpoint.c" />
   1.329 +    <ClCompile Include="..\..\src\render\software\SDL_drawline.c" />
   1.330 +    <ClCompile Include="..\..\src\render\software\SDL_drawpoint.c" />
   1.331 +    <ClCompile Include="..\..\src\render\software\SDL_render_sw.c" />
   1.332 +    <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
   1.333 +    <ClCompile Include="..\..\src\SDL.c" />
   1.334 +    <ClCompile Include="..\..\src\SDL_assert.c" />
   1.335 +    <ClCompile Include="..\..\src\SDL_error.c" />
   1.336 +    <ClCompile Include="..\..\src\SDL_hints.c" />
   1.337 +    <ClCompile Include="..\..\src\SDL_log.c" />
   1.338 +    <ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
   1.339 +    <ClCompile Include="..\..\src\stdlib\SDL_iconv.c" />
   1.340 +    <ClCompile Include="..\..\src\stdlib\SDL_malloc.c" />
   1.341 +    <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
   1.342 +    <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
   1.343 +    <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
   1.344 +    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c" />
   1.345 +    <ClCompile Include="..\..\src\thread\SDL_thread.c" />
   1.346 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp" />
   1.347 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp" />
   1.348 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp" />
   1.349 +    <ClCompile Include="..\..\src\timer\SDL_timer.c" />
   1.350 +    <ClCompile Include="..\..\src\timer\windows\SDL_systimer.c" />
   1.351 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c" />
   1.352 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullframebuffer.c" />
   1.353 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullvideo.c" />
   1.354 +    <ClCompile Include="..\..\src\video\SDL_blit.c" />
   1.355 +    <ClCompile Include="..\..\src\video\SDL_blit_0.c" />
   1.356 +    <ClCompile Include="..\..\src\video\SDL_blit_1.c" />
   1.357 +    <ClCompile Include="..\..\src\video\SDL_blit_A.c" />
   1.358 +    <ClCompile Include="..\..\src\video\SDL_blit_auto.c" />
   1.359 +    <ClCompile Include="..\..\src\video\SDL_blit_copy.c" />
   1.360 +    <ClCompile Include="..\..\src\video\SDL_blit_N.c" />
   1.361 +    <ClCompile Include="..\..\src\video\SDL_blit_slow.c" />
   1.362 +    <ClCompile Include="..\..\src\video\SDL_bmp.c" />
   1.363 +    <ClCompile Include="..\..\src\video\SDL_clipboard.c" />
   1.364 +    <ClCompile Include="..\..\src\video\SDL_fillrect.c" />
   1.365 +    <ClCompile Include="..\..\src\video\SDL_pixels.c" />
   1.366 +    <ClCompile Include="..\..\src\video\SDL_rect.c" />
   1.367 +    <ClCompile Include="..\..\src\video\SDL_RLEaccel.c" />
   1.368 +    <ClCompile Include="..\..\src\video\SDL_shape.c" />
   1.369 +    <ClCompile Include="..\..\src\video\SDL_stretch.c" />
   1.370 +    <ClCompile Include="..\..\src\video\SDL_surface.c" />
   1.371 +    <ClCompile Include="..\..\src\video\SDL_video.c" />
   1.372 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
   1.373 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   1.374 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   1.375 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   1.376 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   1.377 +    </ClCompile>
   1.378 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtkeyboard.cpp">
   1.379 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   1.380 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   1.381 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   1.382 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   1.383 +    </ClCompile>
   1.384 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtmouse.cpp">
   1.385 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   1.386 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   1.387 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   1.388 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   1.389 +    </ClCompile>
   1.390 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
   1.391 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   1.392 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   1.393 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   1.394 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   1.395 +    </ClCompile>
   1.396 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtvideo.cpp">
   1.397 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   1.398 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   1.399 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   1.400 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   1.401 +    </ClCompile>
   1.402 +  </ItemGroup>
   1.403 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   1.404 +  <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsPhone\v$(TargetPlatformVersion)\Microsoft.Cpp.WindowsPhone.$(TargetPlatformVersion).targets" />
   1.405 +  <ImportGroup Label="ExtensionTargets">
   1.406 +  </ImportGroup>
   1.407 +</Project>
   1.408 \ No newline at end of file
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj.filters	Sun Mar 09 11:36:47 2014 -0700
     2.3 @@ -0,0 +1,612 @@
     2.4 +<?xml version="1.0" encoding="utf-8"?>
     2.5 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     2.6 +  <ItemGroup>
     2.7 +    <Filter Include="Header Files">
     2.8 +      <UniqueIdentifier>{02b21b9a-45a7-41ee-a8a6-e45d14aa28da}</UniqueIdentifier>
     2.9 +    </Filter>
    2.10 +    <Filter Include="Source Files">
    2.11 +      <UniqueIdentifier>{abc3a7e6-f955-4cb5-8340-fae0f653e9c1}</UniqueIdentifier>
    2.12 +    </Filter>
    2.13 +  </ItemGroup>
    2.14 +  <ItemGroup>
    2.15 +    <ClInclude Include="..\..\include\begin_code.h">
    2.16 +      <Filter>Header Files</Filter>
    2.17 +    </ClInclude>
    2.18 +    <ClInclude Include="..\..\include\close_code.h">
    2.19 +      <Filter>Header Files</Filter>
    2.20 +    </ClInclude>
    2.21 +    <ClInclude Include="..\..\include\SDL.h">
    2.22 +      <Filter>Header Files</Filter>
    2.23 +    </ClInclude>
    2.24 +    <ClInclude Include="..\..\include\SDL_assert.h">
    2.25 +      <Filter>Header Files</Filter>
    2.26 +    </ClInclude>
    2.27 +    <ClInclude Include="..\..\include\SDL_atomic.h">
    2.28 +      <Filter>Header Files</Filter>
    2.29 +    </ClInclude>
    2.30 +    <ClInclude Include="..\..\include\SDL_audio.h">
    2.31 +      <Filter>Header Files</Filter>
    2.32 +    </ClInclude>
    2.33 +    <ClInclude Include="..\..\include\SDL_blendmode.h">
    2.34 +      <Filter>Header Files</Filter>
    2.35 +    </ClInclude>
    2.36 +    <ClInclude Include="..\..\include\SDL_clipboard.h">
    2.37 +      <Filter>Header Files</Filter>
    2.38 +    </ClInclude>
    2.39 +    <ClInclude Include="..\..\include\SDL_config.h">
    2.40 +      <Filter>Header Files</Filter>
    2.41 +    </ClInclude>
    2.42 +    <ClInclude Include="..\..\include\SDL_config_minimal.h">
    2.43 +      <Filter>Header Files</Filter>
    2.44 +    </ClInclude>
    2.45 +    <ClInclude Include="..\..\include\SDL_copying.h">
    2.46 +      <Filter>Header Files</Filter>
    2.47 +    </ClInclude>
    2.48 +    <ClInclude Include="..\..\include\SDL_cpuinfo.h">
    2.49 +      <Filter>Header Files</Filter>
    2.50 +    </ClInclude>
    2.51 +    <ClInclude Include="..\..\include\SDL_endian.h">
    2.52 +      <Filter>Header Files</Filter>
    2.53 +    </ClInclude>
    2.54 +    <ClInclude Include="..\..\include\SDL_error.h">
    2.55 +      <Filter>Header Files</Filter>
    2.56 +    </ClInclude>
    2.57 +    <ClInclude Include="..\..\include\SDL_events.h">
    2.58 +      <Filter>Header Files</Filter>
    2.59 +    </ClInclude>
    2.60 +    <ClInclude Include="..\..\include\SDL_haptic.h">
    2.61 +      <Filter>Header Files</Filter>
    2.62 +    </ClInclude>
    2.63 +    <ClInclude Include="..\..\include\SDL_hints.h">
    2.64 +      <Filter>Header Files</Filter>
    2.65 +    </ClInclude>
    2.66 +    <ClInclude Include="..\..\include\SDL_input.h">
    2.67 +      <Filter>Header Files</Filter>
    2.68 +    </ClInclude>
    2.69 +    <ClInclude Include="..\..\include\SDL_joystick.h">
    2.70 +      <Filter>Header Files</Filter>
    2.71 +    </ClInclude>
    2.72 +    <ClInclude Include="..\..\include\SDL_keyboard.h">
    2.73 +      <Filter>Header Files</Filter>
    2.74 +    </ClInclude>
    2.75 +    <ClInclude Include="..\..\include\SDL_keycode.h">
    2.76 +      <Filter>Header Files</Filter>
    2.77 +    </ClInclude>
    2.78 +    <ClInclude Include="..\..\include\SDL_loadso.h">
    2.79 +      <Filter>Header Files</Filter>
    2.80 +    </ClInclude>
    2.81 +    <ClInclude Include="..\..\include\SDL_log.h">
    2.82 +      <Filter>Header Files</Filter>
    2.83 +    </ClInclude>
    2.84 +    <ClInclude Include="..\..\include\SDL_main.h">
    2.85 +      <Filter>Header Files</Filter>
    2.86 +    </ClInclude>
    2.87 +    <ClInclude Include="..\..\include\SDL_mouse.h">
    2.88 +      <Filter>Header Files</Filter>
    2.89 +    </ClInclude>
    2.90 +    <ClInclude Include="..\..\include\SDL_mutex.h">
    2.91 +      <Filter>Header Files</Filter>
    2.92 +    </ClInclude>
    2.93 +    <ClInclude Include="..\..\include\SDL_name.h">
    2.94 +      <Filter>Header Files</Filter>
    2.95 +    </ClInclude>
    2.96 +    <ClInclude Include="..\..\include\SDL_pixels.h">
    2.97 +      <Filter>Header Files</Filter>
    2.98 +    </ClInclude>
    2.99 +    <ClInclude Include="..\..\include\SDL_platform.h">
   2.100 +      <Filter>Header Files</Filter>
   2.101 +    </ClInclude>
   2.102 +    <ClInclude Include="..\..\include\SDL_power.h">
   2.103 +      <Filter>Header Files</Filter>
   2.104 +    </ClInclude>
   2.105 +    <ClInclude Include="..\..\include\SDL_quit.h">
   2.106 +      <Filter>Header Files</Filter>
   2.107 +    </ClInclude>
   2.108 +    <ClInclude Include="..\..\include\SDL_rect.h">
   2.109 +      <Filter>Header Files</Filter>
   2.110 +    </ClInclude>
   2.111 +    <ClInclude Include="..\..\include\SDL_render.h">
   2.112 +      <Filter>Header Files</Filter>
   2.113 +    </ClInclude>
   2.114 +    <ClInclude Include="..\..\include\SDL_revision.h">
   2.115 +      <Filter>Header Files</Filter>
   2.116 +    </ClInclude>
   2.117 +    <ClInclude Include="..\..\include\SDL_rwops.h">
   2.118 +      <Filter>Header Files</Filter>
   2.119 +    </ClInclude>
   2.120 +    <ClInclude Include="..\..\include\SDL_scancode.h">
   2.121 +      <Filter>Header Files</Filter>
   2.122 +    </ClInclude>
   2.123 +    <ClInclude Include="..\..\include\SDL_shape.h">
   2.124 +      <Filter>Header Files</Filter>
   2.125 +    </ClInclude>
   2.126 +    <ClInclude Include="..\..\include\SDL_stdinc.h">
   2.127 +      <Filter>Header Files</Filter>
   2.128 +    </ClInclude>
   2.129 +    <ClInclude Include="..\..\include\SDL_surface.h">
   2.130 +      <Filter>Header Files</Filter>
   2.131 +    </ClInclude>
   2.132 +    <ClInclude Include="..\..\include\SDL_system.h">
   2.133 +      <Filter>Header Files</Filter>
   2.134 +    </ClInclude>
   2.135 +    <ClInclude Include="..\..\include\SDL_syswm.h">
   2.136 +      <Filter>Header Files</Filter>
   2.137 +    </ClInclude>
   2.138 +    <ClInclude Include="..\..\include\SDL_thread.h">
   2.139 +      <Filter>Header Files</Filter>
   2.140 +    </ClInclude>
   2.141 +    <ClInclude Include="..\..\include\SDL_timer.h">
   2.142 +      <Filter>Header Files</Filter>
   2.143 +    </ClInclude>
   2.144 +    <ClInclude Include="..\..\include\SDL_touch.h">
   2.145 +      <Filter>Header Files</Filter>
   2.146 +    </ClInclude>
   2.147 +    <ClInclude Include="..\..\include\SDL_types.h">
   2.148 +      <Filter>Header Files</Filter>
   2.149 +    </ClInclude>
   2.150 +    <ClInclude Include="..\..\include\SDL_version.h">
   2.151 +      <Filter>Header Files</Filter>
   2.152 +    </ClInclude>
   2.153 +    <ClInclude Include="..\..\include\SDL_video.h">
   2.154 +      <Filter>Header Files</Filter>
   2.155 +    </ClInclude>
   2.156 +    <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h">
   2.157 +      <Filter>Source Files</Filter>
   2.158 +    </ClInclude>
   2.159 +    <ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h">
   2.160 +      <Filter>Source Files</Filter>
   2.161 +    </ClInclude>
   2.162 +    <ClInclude Include="..\..\src\audio\SDL_audiodev_c.h">
   2.163 +      <Filter>Source Files</Filter>
   2.164 +    </ClInclude>
   2.165 +    <ClInclude Include="..\..\src\audio\SDL_audiomem.h">
   2.166 +      <Filter>Source Files</Filter>
   2.167 +    </ClInclude>
   2.168 +    <ClInclude Include="..\..\src\audio\SDL_audio_c.h">
   2.169 +      <Filter>Source Files</Filter>
   2.170 +    </ClInclude>
   2.171 +    <ClInclude Include="..\..\src\audio\SDL_sysaudio.h">
   2.172 +      <Filter>Source Files</Filter>
   2.173 +    </ClInclude>
   2.174 +    <ClInclude Include="..\..\src\audio\SDL_wave.h">
   2.175 +      <Filter>Source Files</Filter>
   2.176 +    </ClInclude>
   2.177 +    <ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.h">
   2.178 +      <Filter>Source Files</Filter>
   2.179 +    </ClInclude>
   2.180 +    <ClInclude Include="..\..\src\core\windows\SDL_windows.h">
   2.181 +      <Filter>Source Files</Filter>
   2.182 +    </ClInclude>
   2.183 +    <ClInclude Include="..\..\src\events\blank_cursor.h">
   2.184 +      <Filter>Source Files</Filter>
   2.185 +    </ClInclude>
   2.186 +    <ClInclude Include="..\..\src\events\default_cursor.h">
   2.187 +      <Filter>Source Files</Filter>
   2.188 +    </ClInclude>
   2.189 +    <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h">
   2.190 +      <Filter>Source Files</Filter>
   2.191 +    </ClInclude>
   2.192 +    <ClInclude Include="..\..\src\events\SDL_dropevents_c.h">
   2.193 +      <Filter>Source Files</Filter>
   2.194 +    </ClInclude>
   2.195 +    <ClInclude Include="..\..\src\events\SDL_events_c.h">
   2.196 +      <Filter>Source Files</Filter>
   2.197 +    </ClInclude>
   2.198 +    <ClInclude Include="..\..\src\events\SDL_keyboard_c.h">
   2.199 +      <Filter>Source Files</Filter>
   2.200 +    </ClInclude>
   2.201 +    <ClInclude Include="..\..\src\events\SDL_mouse_c.h">
   2.202 +      <Filter>Source Files</Filter>
   2.203 +    </ClInclude>
   2.204 +    <ClInclude Include="..\..\src\events\SDL_sysevents.h">
   2.205 +      <Filter>Source Files</Filter>
   2.206 +    </ClInclude>
   2.207 +    <ClInclude Include="..\..\src\events\SDL_touch_c.h">
   2.208 +      <Filter>Source Files</Filter>
   2.209 +    </ClInclude>
   2.210 +    <ClInclude Include="..\..\src\events\SDL_windowevents_c.h">
   2.211 +      <Filter>Source Files</Filter>
   2.212 +    </ClInclude>
   2.213 +    <ClInclude Include="..\..\src\haptic\SDL_haptic_c.h">
   2.214 +      <Filter>Source Files</Filter>
   2.215 +    </ClInclude>
   2.216 +    <ClInclude Include="..\..\src\haptic\SDL_syshaptic.h">
   2.217 +      <Filter>Source Files</Filter>
   2.218 +    </ClInclude>
   2.219 +    <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h">
   2.220 +      <Filter>Source Files</Filter>
   2.221 +    </ClInclude>
   2.222 +    <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h">
   2.223 +      <Filter>Source Files</Filter>
   2.224 +    </ClInclude>
   2.225 +    <ClInclude Include="..\..\src\render\mmx.h">
   2.226 +      <Filter>Source Files</Filter>
   2.227 +    </ClInclude>
   2.228 +    <ClInclude Include="..\..\src\render\SDL_sysrender.h">
   2.229 +      <Filter>Source Files</Filter>
   2.230 +    </ClInclude>
   2.231 +    <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h">
   2.232 +      <Filter>Source Files</Filter>
   2.233 +    </ClInclude>
   2.234 +    <ClInclude Include="..\..\src\render\software\SDL_blendfillrect.h">
   2.235 +      <Filter>Source Files</Filter>
   2.236 +    </ClInclude>
   2.237 +    <ClInclude Include="..\..\src\render\software\SDL_blendline.h">
   2.238 +      <Filter>Source Files</Filter>
   2.239 +    </ClInclude>
   2.240 +    <ClInclude Include="..\..\src\render\software\SDL_blendpoint.h">
   2.241 +      <Filter>Source Files</Filter>
   2.242 +    </ClInclude>
   2.243 +    <ClInclude Include="..\..\src\render\software\SDL_draw.h">
   2.244 +      <Filter>Source Files</Filter>
   2.245 +    </ClInclude>
   2.246 +    <ClInclude Include="..\..\src\render\software\SDL_drawline.h">
   2.247 +      <Filter>Source Files</Filter>
   2.248 +    </ClInclude>
   2.249 +    <ClInclude Include="..\..\src\render\software\SDL_drawpoint.h">
   2.250 +      <Filter>Source Files</Filter>
   2.251 +    </ClInclude>
   2.252 +    <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h">
   2.253 +      <Filter>Source Files</Filter>
   2.254 +    </ClInclude>
   2.255 +    <ClInclude Include="..\..\src\render\software\SDL_rotate.h">
   2.256 +      <Filter>Source Files</Filter>
   2.257 +    </ClInclude>
   2.258 +    <ClInclude Include="..\..\src\SDL_assert_c.h">
   2.259 +      <Filter>Source Files</Filter>
   2.260 +    </ClInclude>
   2.261 +    <ClInclude Include="..\..\src\SDL_error_c.h">
   2.262 +      <Filter>Source Files</Filter>
   2.263 +    </ClInclude>
   2.264 +    <ClInclude Include="..\..\src\SDL_fatal.h">
   2.265 +      <Filter>Source Files</Filter>
   2.266 +    </ClInclude>
   2.267 +    <ClInclude Include="..\..\src\SDL_hints_c.h">
   2.268 +      <Filter>Source Files</Filter>
   2.269 +    </ClInclude>
   2.270 +    <ClInclude Include="..\..\src\thread\SDL_systhread.h">
   2.271 +      <Filter>Source Files</Filter>
   2.272 +    </ClInclude>
   2.273 +    <ClInclude Include="..\..\src\thread\SDL_thread_c.h">
   2.274 +      <Filter>Source Files</Filter>
   2.275 +    </ClInclude>
   2.276 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h">
   2.277 +      <Filter>Source Files</Filter>
   2.278 +    </ClInclude>
   2.279 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h">
   2.280 +      <Filter>Source Files</Filter>
   2.281 +    </ClInclude>
   2.282 +    <ClInclude Include="..\..\src\timer\SDL_timer_c.h">
   2.283 +      <Filter>Source Files</Filter>
   2.284 +    </ClInclude>
   2.285 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h">
   2.286 +      <Filter>Source Files</Filter>
   2.287 +    </ClInclude>
   2.288 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullframebuffer_c.h">
   2.289 +      <Filter>Source Files</Filter>
   2.290 +    </ClInclude>
   2.291 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullvideo.h">
   2.292 +      <Filter>Source Files</Filter>
   2.293 +    </ClInclude>
   2.294 +    <ClInclude Include="..\..\src\video\SDL_blit.h">
   2.295 +      <Filter>Source Files</Filter>
   2.296 +    </ClInclude>
   2.297 +    <ClInclude Include="..\..\src\video\SDL_blit_auto.h">
   2.298 +      <Filter>Source Files</Filter>
   2.299 +    </ClInclude>
   2.300 +    <ClInclude Include="..\..\src\video\SDL_blit_copy.h">
   2.301 +      <Filter>Source Files</Filter>
   2.302 +    </ClInclude>
   2.303 +    <ClInclude Include="..\..\src\video\SDL_blit_slow.h">
   2.304 +      <Filter>Source Files</Filter>
   2.305 +    </ClInclude>
   2.306 +    <ClInclude Include="..\..\src\video\SDL_pixels_c.h">
   2.307 +      <Filter>Source Files</Filter>
   2.308 +    </ClInclude>
   2.309 +    <ClInclude Include="..\..\src\video\SDL_rect_c.h">
   2.310 +      <Filter>Source Files</Filter>
   2.311 +    </ClInclude>
   2.312 +    <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h">
   2.313 +      <Filter>Source Files</Filter>
   2.314 +    </ClInclude>
   2.315 +    <ClInclude Include="..\..\src\video\SDL_shape_internals.h">
   2.316 +      <Filter>Source Files</Filter>
   2.317 +    </ClInclude>
   2.318 +    <ClInclude Include="..\..\src\video\SDL_sysvideo.h">
   2.319 +      <Filter>Source Files</Filter>
   2.320 +    </ClInclude>
   2.321 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h">
   2.322 +      <Filter>Source Files</Filter>
   2.323 +    </ClInclude>
   2.324 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h">
   2.325 +      <Filter>Source Files</Filter>
   2.326 +    </ClInclude>
   2.327 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h">
   2.328 +      <Filter>Source Files</Filter>
   2.329 +    </ClInclude>
   2.330 +    <ClInclude Include="..\..\include\SDL_config_winrt.h">
   2.331 +      <Filter>Header Files</Filter>
   2.332 +    </ClInclude>
   2.333 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.h">
   2.334 +      <Filter>Source Files</Filter>
   2.335 +    </ClInclude>
   2.336 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_xaml.h">
   2.337 +      <Filter>Source Files</Filter>
   2.338 +    </ClInclude>
   2.339 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_common.h">
   2.340 +      <Filter>Source Files</Filter>
   2.341 +    </ClInclude>
   2.342 +    <ClInclude Include="..\..\include\SDL_filesystem.h">
   2.343 +      <Filter>Header Files</Filter>
   2.344 +    </ClInclude>
   2.345 +  </ItemGroup>
   2.346 +  <ItemGroup>
   2.347 +    <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
   2.348 +      <Filter>Source Files</Filter>
   2.349 +    </ClCompile>
   2.350 +    <ClCompile Include="..\..\src\atomic\SDL_spinlock.c">
   2.351 +      <Filter>Source Files</Filter>
   2.352 +    </ClCompile>
   2.353 +    <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c">
   2.354 +      <Filter>Source Files</Filter>
   2.355 +    </ClCompile>
   2.356 +    <ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c">
   2.357 +      <Filter>Source Files</Filter>
   2.358 +    </ClCompile>
   2.359 +    <ClCompile Include="..\..\src\audio\SDL_audio.c">
   2.360 +      <Filter>Source Files</Filter>
   2.361 +    </ClCompile>
   2.362 +    <ClCompile Include="..\..\src\audio\SDL_audiocvt.c">
   2.363 +      <Filter>Source Files</Filter>
   2.364 +    </ClCompile>
   2.365 +    <ClCompile Include="..\..\src\audio\SDL_audiodev.c">
   2.366 +      <Filter>Source Files</Filter>
   2.367 +    </ClCompile>
   2.368 +    <ClCompile Include="..\..\src\audio\SDL_audiotypecvt.c">
   2.369 +      <Filter>Source Files</Filter>
   2.370 +    </ClCompile>
   2.371 +    <ClCompile Include="..\..\src\audio\SDL_mixer.c">
   2.372 +      <Filter>Source Files</Filter>
   2.373 +    </ClCompile>
   2.374 +    <ClCompile Include="..\..\src\audio\SDL_wave.c">
   2.375 +      <Filter>Source Files</Filter>
   2.376 +    </ClCompile>
   2.377 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c">
   2.378 +      <Filter>Source Files</Filter>
   2.379 +    </ClCompile>
   2.380 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.cpp">
   2.381 +      <Filter>Source Files</Filter>
   2.382 +    </ClCompile>
   2.383 +    <ClCompile Include="..\..\src\core\windows\SDL_windows.c">
   2.384 +      <Filter>Source Files</Filter>
   2.385 +    </ClCompile>
   2.386 +    <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c">
   2.387 +      <Filter>Source Files</Filter>
   2.388 +    </ClCompile>
   2.389 +    <ClCompile Include="..\..\src\events\SDL_clipboardevents.c">
   2.390 +      <Filter>Source Files</Filter>
   2.391 +    </ClCompile>
   2.392 +    <ClCompile Include="..\..\src\events\SDL_dropevents.c">
   2.393 +      <Filter>Source Files</Filter>
   2.394 +    </ClCompile>
   2.395 +    <ClCompile Include="..\..\src\events\SDL_events.c">
   2.396 +      <Filter>Source Files</Filter>
   2.397 +    </ClCompile>
   2.398 +    <ClCompile Include="..\..\src\events\SDL_gesture.c">
   2.399 +      <Filter>Source Files</Filter>
   2.400 +    </ClCompile>
   2.401 +    <ClCompile Include="..\..\src\events\SDL_keyboard.c">
   2.402 +      <Filter>Source Files</Filter>
   2.403 +    </ClCompile>
   2.404 +    <ClCompile Include="..\..\src\events\SDL_mouse.c">
   2.405 +      <Filter>Source Files</Filter>
   2.406 +    </ClCompile>
   2.407 +    <ClCompile Include="..\..\src\events\SDL_quit.c">
   2.408 +      <Filter>Source Files</Filter>
   2.409 +    </ClCompile>
   2.410 +    <ClCompile Include="..\..\src\events\SDL_touch.c">
   2.411 +      <Filter>Source Files</Filter>
   2.412 +    </ClCompile>
   2.413 +    <ClCompile Include="..\..\src\events\SDL_windowevents.c">
   2.414 +      <Filter>Source Files</Filter>
   2.415 +    </ClCompile>
   2.416 +    <ClCompile Include="..\..\src\file\SDL_rwops.c">
   2.417 +      <Filter>Source Files</Filter>
   2.418 +    </ClCompile>
   2.419 +    <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c">
   2.420 +      <Filter>Source Files</Filter>
   2.421 +    </ClCompile>
   2.422 +    <ClCompile Include="..\..\src\haptic\SDL_haptic.c">
   2.423 +      <Filter>Source Files</Filter>
   2.424 +    </ClCompile>
   2.425 +    <ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c">
   2.426 +      <Filter>Source Files</Filter>
   2.427 +    </ClCompile>
   2.428 +    <ClCompile Include="..\..\src\joystick\SDL_joystick.c">
   2.429 +      <Filter>Source Files</Filter>
   2.430 +    </ClCompile>
   2.431 +    <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c">
   2.432 +      <Filter>Source Files</Filter>
   2.433 +    </ClCompile>
   2.434 +    <ClCompile Include="..\..\src\render\SDL_render.c">
   2.435 +      <Filter>Source Files</Filter>
   2.436 +    </ClCompile>
   2.437 +    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
   2.438 +      <Filter>Source Files</Filter>
   2.439 +    </ClCompile>
   2.440 +    <ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
   2.441 +      <Filter>Source Files</Filter>
   2.442 +    </ClCompile>
   2.443 +    <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c">
   2.444 +      <Filter>Source Files</Filter>
   2.445 +    </ClCompile>
   2.446 +    <ClCompile Include="..\..\src\render\software\SDL_blendline.c">
   2.447 +      <Filter>Source Files</Filter>
   2.448 +    </ClCompile>
   2.449 +    <ClCompile Include="..\..\src\render\software\SDL_blendpoint.c">
   2.450 +      <Filter>Source Files</Filter>
   2.451 +    </ClCompile>
   2.452 +    <ClCompile Include="..\..\src\render\software\SDL_drawline.c">
   2.453 +      <Filter>Source Files</Filter>
   2.454 +    </ClCompile>
   2.455 +    <ClCompile Include="..\..\src\render\software\SDL_drawpoint.c">
   2.456 +      <Filter>Source Files</Filter>
   2.457 +    </ClCompile>
   2.458 +    <ClCompile Include="..\..\src\render\software\SDL_render_sw.c">
   2.459 +      <Filter>Source Files</Filter>
   2.460 +    </ClCompile>
   2.461 +    <ClCompile Include="..\..\src\render\software\SDL_rotate.c">
   2.462 +      <Filter>Source Files</Filter>
   2.463 +    </ClCompile>
   2.464 +    <ClCompile Include="..\..\src\SDL.c">
   2.465 +      <Filter>Source Files</Filter>
   2.466 +    </ClCompile>
   2.467 +    <ClCompile Include="..\..\src\SDL_assert.c">
   2.468 +      <Filter>Source Files</Filter>
   2.469 +    </ClCompile>
   2.470 +    <ClCompile Include="..\..\src\SDL_error.c">
   2.471 +      <Filter>Source Files</Filter>
   2.472 +    </ClCompile>
   2.473 +    <ClCompile Include="..\..\src\SDL_hints.c">
   2.474 +      <Filter>Source Files</Filter>
   2.475 +    </ClCompile>
   2.476 +    <ClCompile Include="..\..\src\SDL_log.c">
   2.477 +      <Filter>Source Files</Filter>
   2.478 +    </ClCompile>
   2.479 +    <ClCompile Include="..\..\src\stdlib\SDL_getenv.c">
   2.480 +      <Filter>Source Files</Filter>
   2.481 +    </ClCompile>
   2.482 +    <ClCompile Include="..\..\src\stdlib\SDL_iconv.c">
   2.483 +      <Filter>Source Files</Filter>
   2.484 +    </ClCompile>
   2.485 +    <ClCompile Include="..\..\src\stdlib\SDL_qsort.c">
   2.486 +      <Filter>Source Files</Filter>
   2.487 +    </ClCompile>
   2.488 +    <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c">
   2.489 +      <Filter>Source Files</Filter>
   2.490 +    </ClCompile>
   2.491 +    <ClCompile Include="..\..\src\stdlib\SDL_string.c">
   2.492 +      <Filter>Source Files</Filter>
   2.493 +    </ClCompile>
   2.494 +    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c">
   2.495 +      <Filter>Source Files</Filter>
   2.496 +    </ClCompile>
   2.497 +    <ClCompile Include="..\..\src\thread\SDL_thread.c">
   2.498 +      <Filter>Source Files</Filter>
   2.499 +    </ClCompile>
   2.500 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp">
   2.501 +      <Filter>Source Files</Filter>
   2.502 +    </ClCompile>
   2.503 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp">
   2.504 +      <Filter>Source Files</Filter>
   2.505 +    </ClCompile>
   2.506 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp">
   2.507 +      <Filter>Source Files</Filter>
   2.508 +    </ClCompile>
   2.509 +    <ClCompile Include="..\..\src\timer\SDL_timer.c">
   2.510 +      <Filter>Source Files</Filter>
   2.511 +    </ClCompile>
   2.512 +    <ClCompile Include="..\..\src\timer\windows\SDL_systimer.c">
   2.513 +      <Filter>Source Files</Filter>
   2.514 +    </ClCompile>
   2.515 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c">
   2.516 +      <Filter>Source Files</Filter>
   2.517 +    </ClCompile>
   2.518 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullframebuffer.c">
   2.519 +      <Filter>Source Files</Filter>
   2.520 +    </ClCompile>
   2.521 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullvideo.c">
   2.522 +      <Filter>Source Files</Filter>
   2.523 +    </ClCompile>
   2.524 +    <ClCompile Include="..\..\src\video\SDL_blit.c">
   2.525 +      <Filter>Source Files</Filter>
   2.526 +    </ClCompile>
   2.527 +    <ClCompile Include="..\..\src\video\SDL_blit_0.c">
   2.528 +      <Filter>Source Files</Filter>
   2.529 +    </ClCompile>
   2.530 +    <ClCompile Include="..\..\src\video\SDL_blit_1.c">
   2.531 +      <Filter>Source Files</Filter>
   2.532 +    </ClCompile>
   2.533 +    <ClCompile Include="..\..\src\video\SDL_blit_A.c">
   2.534 +      <Filter>Source Files</Filter>
   2.535 +    </ClCompile>
   2.536 +    <ClCompile Include="..\..\src\video\SDL_blit_auto.c">
   2.537 +      <Filter>Source Files</Filter>
   2.538 +    </ClCompile>
   2.539 +    <ClCompile Include="..\..\src\video\SDL_blit_copy.c">
   2.540 +      <Filter>Source Files</Filter>
   2.541 +    </ClCompile>
   2.542 +    <ClCompile Include="..\..\src\video\SDL_blit_N.c">
   2.543 +      <Filter>Source Files</Filter>
   2.544 +    </ClCompile>
   2.545 +    <ClCompile Include="..\..\src\video\SDL_blit_slow.c">
   2.546 +      <Filter>Source Files</Filter>
   2.547 +    </ClCompile>
   2.548 +    <ClCompile Include="..\..\src\video\SDL_bmp.c">
   2.549 +      <Filter>Source Files</Filter>
   2.550 +    </ClCompile>
   2.551 +    <ClCompile Include="..\..\src\video\SDL_clipboard.c">
   2.552 +      <Filter>Source Files</Filter>
   2.553 +    </ClCompile>
   2.554 +    <ClCompile Include="..\..\src\video\SDL_fillrect.c">
   2.555 +      <Filter>Source Files</Filter>
   2.556 +    </ClCompile>
   2.557 +    <ClCompile Include="..\..\src\video\SDL_pixels.c">
   2.558 +      <Filter>Source Files</Filter>
   2.559 +    </ClCompile>
   2.560 +    <ClCompile Include="..\..\src\video\SDL_rect.c">
   2.561 +      <Filter>Source Files</Filter>
   2.562 +    </ClCompile>
   2.563 +    <ClCompile Include="..\..\src\video\SDL_RLEaccel.c">
   2.564 +      <Filter>Source Files</Filter>
   2.565 +    </ClCompile>
   2.566 +    <ClCompile Include="..\..\src\video\SDL_shape.c">
   2.567 +      <Filter>Source Files</Filter>
   2.568 +    </ClCompile>
   2.569 +    <ClCompile Include="..\..\src\video\SDL_stretch.c">
   2.570 +      <Filter>Source Files</Filter>
   2.571 +    </ClCompile>
   2.572 +    <ClCompile Include="..\..\src\video\SDL_surface.c">
   2.573 +      <Filter>Source Files</Filter>
   2.574 +    </ClCompile>
   2.575 +    <ClCompile Include="..\..\src\video\SDL_video.c">
   2.576 +      <Filter>Source Files</Filter>
   2.577 +    </ClCompile>
   2.578 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.cpp">
   2.579 +      <Filter>Source Files</Filter>
   2.580 +    </ClCompile>
   2.581 +    <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c">
   2.582 +      <Filter>Source Files</Filter>
   2.583 +    </ClCompile>
   2.584 +    <ClCompile Include="..\..\src\stdlib\SDL_malloc.c">
   2.585 +      <Filter>Source Files</Filter>
   2.586 +    </ClCompile>
   2.587 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
   2.588 +      <Filter>Source Files</Filter>
   2.589 +    </ClCompile>
   2.590 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtmouse.cpp">
   2.591 +      <Filter>Source Files</Filter>
   2.592 +    </ClCompile>
   2.593 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtvideo.cpp">
   2.594 +      <Filter>Source Files</Filter>
   2.595 +    </ClCompile>
   2.596 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtkeyboard.cpp">
   2.597 +      <Filter>Source Files</Filter>
   2.598 +    </ClCompile>
   2.599 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
   2.600 +      <Filter>Source Files</Filter>
   2.601 +    </ClCompile>
   2.602 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.cpp">
   2.603 +      <Filter>Source Files</Filter>
   2.604 +    </ClCompile>
   2.605 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_xaml.cpp">
   2.606 +      <Filter>Source Files</Filter>
   2.607 +    </ClCompile>
   2.608 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_common.cpp">
   2.609 +      <Filter>Source Files</Filter>
   2.610 +    </ClCompile>
   2.611 +    <ClCompile Include="..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp">
   2.612 +      <Filter>Source Files</Filter>
   2.613 +    </ClCompile>
   2.614 +  </ItemGroup>
   2.615 +</Project>
   2.616 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/VisualC-WinRT/SDL-WinRT_VS2012.sln	Sun Mar 09 11:36:47 2014 -0700
     3.3 @@ -0,0 +1,32 @@
     3.4 +
     3.5 +Microsoft Visual Studio Solution File, Format Version 12.00
     3.6 +# Visual Studio 2012
     3.7 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL-WinRT", "SDL\SDL-WinRT_VS2012.vcxproj", "{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}"
     3.8 +EndProject
     3.9 +Global
    3.10 +	GlobalSection(SolutionConfigurationPlatforms) = preSolution
    3.11 +		Debug|ARM = Debug|ARM
    3.12 +		Debug|Win32 = Debug|Win32
    3.13 +		Debug|x64 = Debug|x64
    3.14 +		Release|ARM = Release|ARM
    3.15 +		Release|Win32 = Release|Win32
    3.16 +		Release|x64 = Release|x64
    3.17 +	EndGlobalSection
    3.18 +	GlobalSection(ProjectConfigurationPlatforms) = postSolution
    3.19 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|ARM.ActiveCfg = Debug|ARM
    3.20 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|ARM.Build.0 = Debug|ARM
    3.21 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|Win32.ActiveCfg = Debug|Win32
    3.22 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|Win32.Build.0 = Debug|Win32
    3.23 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|x64.ActiveCfg = Debug|x64
    3.24 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|x64.Build.0 = Debug|x64
    3.25 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|ARM.ActiveCfg = Release|ARM
    3.26 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|ARM.Build.0 = Release|ARM
    3.27 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|Win32.ActiveCfg = Release|Win32
    3.28 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|Win32.Build.0 = Release|Win32
    3.29 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|x64.ActiveCfg = Release|x64
    3.30 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|x64.Build.0 = Release|x64
    3.31 +	EndGlobalSection
    3.32 +	GlobalSection(SolutionProperties) = preSolution
    3.33 +		HideSolutionNode = FALSE
    3.34 +	EndGlobalSection
    3.35 +EndGlobal
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj	Sun Mar 09 11:36:47 2014 -0700
     4.3 @@ -0,0 +1,508 @@
     4.4 +<?xml version="1.0" encoding="utf-8"?>
     4.5 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     4.6 +  <ItemGroup Label="ProjectConfigurations">
     4.7 +    <ProjectConfiguration Include="Debug|ARM">
     4.8 +      <Configuration>Debug</Configuration>
     4.9 +      <Platform>ARM</Platform>
    4.10 +    </ProjectConfiguration>
    4.11 +    <ProjectConfiguration Include="Debug|Win32">
    4.12 +      <Configuration>Debug</Configuration>
    4.13 +      <Platform>Win32</Platform>
    4.14 +    </ProjectConfiguration>
    4.15 +    <ProjectConfiguration Include="Debug|x64">
    4.16 +      <Configuration>Debug</Configuration>
    4.17 +      <Platform>x64</Platform>
    4.18 +    </ProjectConfiguration>
    4.19 +    <ProjectConfiguration Include="Release|ARM">
    4.20 +      <Configuration>Release</Configuration>
    4.21 +      <Platform>ARM</Platform>
    4.22 +    </ProjectConfiguration>
    4.23 +    <ProjectConfiguration Include="Release|Win32">
    4.24 +      <Configuration>Release</Configuration>
    4.25 +      <Platform>Win32</Platform>
    4.26 +    </ProjectConfiguration>
    4.27 +    <ProjectConfiguration Include="Release|x64">
    4.28 +      <Configuration>Release</Configuration>
    4.29 +      <Platform>x64</Platform>
    4.30 +    </ProjectConfiguration>
    4.31 +  </ItemGroup>
    4.32 +  <ItemGroup>
    4.33 +    <ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
    4.34 +    <ClCompile Include="..\..\src\atomic\SDL_spinlock.c" />
    4.35 +    <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c" />
    4.36 +    <ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c" />
    4.37 +    <ClCompile Include="..\..\src\audio\SDL_audio.c" />
    4.38 +    <ClCompile Include="..\..\src\audio\SDL_audiocvt.c" />
    4.39 +    <ClCompile Include="..\..\src\audio\SDL_audiodev.c" />
    4.40 +    <ClCompile Include="..\..\src\audio\SDL_audiotypecvt.c" />
    4.41 +    <ClCompile Include="..\..\src\audio\SDL_mixer.c" />
    4.42 +    <ClCompile Include="..\..\src\audio\SDL_wave.c" />
    4.43 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c" />
    4.44 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.cpp">
    4.45 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    4.46 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    4.47 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    4.48 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    4.49 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
    4.50 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    4.51 +    </ClCompile>
    4.52 +    <ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
    4.53 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_common.cpp">
    4.54 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    4.55 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    4.56 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    4.57 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    4.58 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
    4.59 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    4.60 +    </ClCompile>
    4.61 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.cpp">
    4.62 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    4.63 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    4.64 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    4.65 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    4.66 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
    4.67 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    4.68 +    </ClCompile>
    4.69 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_xaml.cpp">
    4.70 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    4.71 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    4.72 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    4.73 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    4.74 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
    4.75 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    4.76 +    </ClCompile>
    4.77 +    <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
    4.78 +    <ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
    4.79 +    <ClCompile Include="..\..\src\events\SDL_dropevents.c" />
    4.80 +    <ClCompile Include="..\..\src\events\SDL_events.c" />
    4.81 +    <ClCompile Include="..\..\src\events\SDL_gesture.c" />
    4.82 +    <ClCompile Include="..\..\src\events\SDL_keyboard.c" />
    4.83 +    <ClCompile Include="..\..\src\events\SDL_mouse.c" />
    4.84 +    <ClCompile Include="..\..\src\events\SDL_quit.c" />
    4.85 +    <ClCompile Include="..\..\src\events\SDL_touch.c" />
    4.86 +    <ClCompile Include="..\..\src\events\SDL_windowevents.c" />
    4.87 +    <ClCompile Include="..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp">
    4.88 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    4.89 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    4.90 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    4.91 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    4.92 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
    4.93 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    4.94 +    </ClCompile>
    4.95 +    <ClCompile Include="..\..\src\file\SDL_rwops.c" />
    4.96 +    <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c" />
    4.97 +    <ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
    4.98 +    <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
    4.99 +    <ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
   4.100 +    <ClCompile Include="..\..\src\joystick\winrt\SDL_xinputjoystick.c" />
   4.101 +    <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
   4.102 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.cpp">
   4.103 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   4.104 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   4.105 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   4.106 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   4.107 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   4.108 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   4.109 +    </ClCompile>
   4.110 +    <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
   4.111 +    <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
   4.112 +    <ClCompile Include="..\..\src\render\SDL_render.c" />
   4.113 +    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
   4.114 +    <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
   4.115 +    <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
   4.116 +    <ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
   4.117 +    <ClCompile Include="..\..\src\render\software\SDL_blendpoint.c" />
   4.118 +    <ClCompile Include="..\..\src\render\software\SDL_drawline.c" />
   4.119 +    <ClCompile Include="..\..\src\render\software\SDL_drawpoint.c" />
   4.120 +    <ClCompile Include="..\..\src\render\software\SDL_render_sw.c" />
   4.121 +    <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
   4.122 +    <ClCompile Include="..\..\src\SDL.c" />
   4.123 +    <ClCompile Include="..\..\src\SDL_assert.c" />
   4.124 +    <ClCompile Include="..\..\src\SDL_error.c" />
   4.125 +    <ClCompile Include="..\..\src\SDL_hints.c" />
   4.126 +    <ClCompile Include="..\..\src\SDL_log.c" />
   4.127 +    <ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
   4.128 +    <ClCompile Include="..\..\src\stdlib\SDL_iconv.c" />
   4.129 +    <ClCompile Include="..\..\src\stdlib\SDL_malloc.c" />
   4.130 +    <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
   4.131 +    <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
   4.132 +    <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
   4.133 +    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c" />
   4.134 +    <ClCompile Include="..\..\src\thread\SDL_thread.c" />
   4.135 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp" />
   4.136 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp" />
   4.137 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp" />
   4.138 +    <ClCompile Include="..\..\src\timer\SDL_timer.c" />
   4.139 +    <ClCompile Include="..\..\src\timer\windows\SDL_systimer.c" />
   4.140 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c" />
   4.141 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullframebuffer.c" />
   4.142 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullvideo.c" />
   4.143 +    <ClCompile Include="..\..\src\video\SDL_blit.c" />
   4.144 +    <ClCompile Include="..\..\src\video\SDL_blit_0.c" />
   4.145 +    <ClCompile Include="..\..\src\video\SDL_blit_1.c" />
   4.146 +    <ClCompile Include="..\..\src\video\SDL_blit_A.c" />
   4.147 +    <ClCompile Include="..\..\src\video\SDL_blit_auto.c" />
   4.148 +    <ClCompile Include="..\..\src\video\SDL_blit_copy.c" />
   4.149 +    <ClCompile Include="..\..\src\video\SDL_blit_N.c" />
   4.150 +    <ClCompile Include="..\..\src\video\SDL_blit_slow.c" />
   4.151 +    <ClCompile Include="..\..\src\video\SDL_bmp.c" />
   4.152 +    <ClCompile Include="..\..\src\video\SDL_clipboard.c" />
   4.153 +    <ClCompile Include="..\..\src\video\SDL_egl.c" />
   4.154 +    <ClCompile Include="..\..\src\video\SDL_fillrect.c" />
   4.155 +    <ClCompile Include="..\..\src\video\SDL_pixels.c" />
   4.156 +    <ClCompile Include="..\..\src\video\SDL_rect.c" />
   4.157 +    <ClCompile Include="..\..\src\video\SDL_RLEaccel.c" />
   4.158 +    <ClCompile Include="..\..\src\video\SDL_shape.c" />
   4.159 +    <ClCompile Include="..\..\src\video\SDL_stretch.c" />
   4.160 +    <ClCompile Include="..\..\src\video\SDL_surface.c" />
   4.161 +    <ClCompile Include="..\..\src\video\SDL_video.c" />
   4.162 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
   4.163 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   4.164 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   4.165 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   4.166 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   4.167 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   4.168 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   4.169 +    </ClCompile>
   4.170 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtkeyboard.cpp">
   4.171 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   4.172 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   4.173 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   4.174 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   4.175 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   4.176 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   4.177 +    </ClCompile>
   4.178 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtmouse.cpp">
   4.179 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   4.180 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   4.181 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   4.182 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   4.183 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   4.184 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   4.185 +    </ClCompile>
   4.186 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtopengles.cpp">
   4.187 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   4.188 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   4.189 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   4.190 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   4.191 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   4.192 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   4.193 +    </ClCompile>
   4.194 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
   4.195 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   4.196 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   4.197 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   4.198 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   4.199 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   4.200 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   4.201 +    </ClCompile>
   4.202 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtvideo.cpp">
   4.203 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   4.204 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   4.205 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   4.206 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   4.207 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   4.208 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   4.209 +    </ClCompile>
   4.210 +  </ItemGroup>
   4.211 +  <ItemGroup>
   4.212 +    <ClInclude Include="..\..\include\begin_code.h" />
   4.213 +    <ClInclude Include="..\..\include\close_code.h" />
   4.214 +    <ClInclude Include="..\..\include\SDL.h" />
   4.215 +    <ClInclude Include="..\..\include\SDL_assert.h" />
   4.216 +    <ClInclude Include="..\..\include\SDL_atomic.h" />
   4.217 +    <ClInclude Include="..\..\include\SDL_audio.h" />
   4.218 +    <ClInclude Include="..\..\include\SDL_blendmode.h" />
   4.219 +    <ClInclude Include="..\..\include\SDL_clipboard.h" />
   4.220 +    <ClInclude Include="..\..\include\SDL_config.h" />
   4.221 +    <ClInclude Include="..\..\include\SDL_config_minimal.h" />
   4.222 +    <ClInclude Include="..\..\include\SDL_config_winrt.h" />
   4.223 +    <ClInclude Include="..\..\include\SDL_copying.h" />
   4.224 +    <ClInclude Include="..\..\include\SDL_cpuinfo.h" />
   4.225 +    <ClInclude Include="..\..\include\SDL_egl.h" />
   4.226 +    <ClInclude Include="..\..\include\SDL_endian.h" />
   4.227 +    <ClInclude Include="..\..\include\SDL_error.h" />
   4.228 +    <ClInclude Include="..\..\include\SDL_events.h" />
   4.229 +    <ClInclude Include="..\..\include\SDL_filesystem.h" />
   4.230 +    <ClInclude Include="..\..\include\SDL_haptic.h" />
   4.231 +    <ClInclude Include="..\..\include\SDL_hints.h" />
   4.232 +    <ClInclude Include="..\..\include\SDL_input.h" />
   4.233 +    <ClInclude Include="..\..\include\SDL_joystick.h" />
   4.234 +    <ClInclude Include="..\..\include\SDL_keyboard.h" />
   4.235 +    <ClInclude Include="..\..\include\SDL_keycode.h" />
   4.236 +    <ClInclude Include="..\..\include\SDL_loadso.h" />
   4.237 +    <ClInclude Include="..\..\include\SDL_log.h" />
   4.238 +    <ClInclude Include="..\..\include\SDL_main.h" />
   4.239 +    <ClInclude Include="..\..\include\SDL_mouse.h" />
   4.240 +    <ClInclude Include="..\..\include\SDL_mutex.h" />
   4.241 +    <ClInclude Include="..\..\include\SDL_name.h" />
   4.242 +    <ClInclude Include="..\..\include\SDL_opengles2.h" />
   4.243 +    <ClInclude Include="..\..\include\SDL_pixels.h" />
   4.244 +    <ClInclude Include="..\..\include\SDL_platform.h" />
   4.245 +    <ClInclude Include="..\..\include\SDL_power.h" />
   4.246 +    <ClInclude Include="..\..\include\SDL_quit.h" />
   4.247 +    <ClInclude Include="..\..\include\SDL_rect.h" />
   4.248 +    <ClInclude Include="..\..\include\SDL_render.h" />
   4.249 +    <ClInclude Include="..\..\include\SDL_revision.h" />
   4.250 +    <ClInclude Include="..\..\include\SDL_rwops.h" />
   4.251 +    <ClInclude Include="..\..\include\SDL_scancode.h" />
   4.252 +    <ClInclude Include="..\..\include\SDL_shape.h" />
   4.253 +    <ClInclude Include="..\..\include\SDL_stdinc.h" />
   4.254 +    <ClInclude Include="..\..\include\SDL_surface.h" />
   4.255 +    <ClInclude Include="..\..\include\SDL_system.h" />
   4.256 +    <ClInclude Include="..\..\include\SDL_syswm.h" />
   4.257 +    <ClInclude Include="..\..\include\SDL_thread.h" />
   4.258 +    <ClInclude Include="..\..\include\SDL_timer.h" />
   4.259 +    <ClInclude Include="..\..\include\SDL_touch.h" />
   4.260 +    <ClInclude Include="..\..\include\SDL_types.h" />
   4.261 +    <ClInclude Include="..\..\include\SDL_version.h" />
   4.262 +    <ClInclude Include="..\..\include\SDL_video.h" />
   4.263 +    <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h" />
   4.264 +    <ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h" />
   4.265 +    <ClInclude Include="..\..\src\audio\SDL_audiodev_c.h" />
   4.266 +    <ClInclude Include="..\..\src\audio\SDL_audiomem.h" />
   4.267 +    <ClInclude Include="..\..\src\audio\SDL_audio_c.h" />
   4.268 +    <ClInclude Include="..\..\src\audio\SDL_sysaudio.h" />
   4.269 +    <ClInclude Include="..\..\src\audio\SDL_wave.h" />
   4.270 +    <ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.h" />
   4.271 +    <ClInclude Include="..\..\src\core\windows\SDL_windows.h" />
   4.272 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_common.h" />
   4.273 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.h" />
   4.274 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_xaml.h" />
   4.275 +    <ClInclude Include="..\..\src\events\blank_cursor.h" />
   4.276 +    <ClInclude Include="..\..\src\events\default_cursor.h" />
   4.277 +    <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h" />
   4.278 +    <ClInclude Include="..\..\src\events\SDL_dropevents_c.h" />
   4.279 +    <ClInclude Include="..\..\src\events\SDL_events_c.h" />
   4.280 +    <ClInclude Include="..\..\src\events\SDL_keyboard_c.h" />
   4.281 +    <ClInclude Include="..\..\src\events\SDL_mouse_c.h" />
   4.282 +    <ClInclude Include="..\..\src\events\SDL_sysevents.h" />
   4.283 +    <ClInclude Include="..\..\src\events\SDL_touch_c.h" />
   4.284 +    <ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
   4.285 +    <ClInclude Include="..\..\src\haptic\SDL_haptic_c.h" />
   4.286 +    <ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
   4.287 +    <ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h" />
   4.288 +    <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
   4.289 +    <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
   4.290 +    <ClInclude Include="..\..\src\render\mmx.h" />
   4.291 +    <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
   4.292 +    <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
   4.293 +    <ClInclude Include="..\..\src\render\SDL_sysrender.h" />
   4.294 +    <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h" />
   4.295 +    <ClInclude Include="..\..\src\render\software\SDL_blendfillrect.h" />
   4.296 +    <ClInclude Include="..\..\src\render\software\SDL_blendline.h" />
   4.297 +    <ClInclude Include="..\..\src\render\software\SDL_blendpoint.h" />
   4.298 +    <ClInclude Include="..\..\src\render\software\SDL_draw.h" />
   4.299 +    <ClInclude Include="..\..\src\render\software\SDL_drawline.h" />
   4.300 +    <ClInclude Include="..\..\src\render\software\SDL_drawpoint.h" />
   4.301 +    <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
   4.302 +    <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
   4.303 +    <ClInclude Include="..\..\src\SDL_assert_c.h" />
   4.304 +    <ClInclude Include="..\..\src\SDL_error_c.h" />
   4.305 +    <ClInclude Include="..\..\src\SDL_fatal.h" />
   4.306 +    <ClInclude Include="..\..\src\SDL_hints_c.h" />
   4.307 +    <ClInclude Include="..\..\src\thread\SDL_systhread.h" />
   4.308 +    <ClInclude Include="..\..\src\thread\SDL_thread_c.h" />
   4.309 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h" />
   4.310 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h" />
   4.311 +    <ClInclude Include="..\..\src\timer\SDL_timer_c.h" />
   4.312 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h" />
   4.313 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullframebuffer_c.h" />
   4.314 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullvideo.h" />
   4.315 +    <ClInclude Include="..\..\src\video\SDL_blit.h" />
   4.316 +    <ClInclude Include="..\..\src\video\SDL_blit_auto.h" />
   4.317 +    <ClInclude Include="..\..\src\video\SDL_blit_copy.h" />
   4.318 +    <ClInclude Include="..\..\src\video\SDL_blit_slow.h" />
   4.319 +    <ClInclude Include="..\..\src\video\SDL_egl.h" />
   4.320 +    <ClInclude Include="..\..\src\video\SDL_pixels_c.h" />
   4.321 +    <ClInclude Include="..\..\src\video\SDL_rect_c.h" />
   4.322 +    <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
   4.323 +    <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
   4.324 +    <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
   4.325 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
   4.326 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
   4.327 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
   4.328 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
   4.329 +  </ItemGroup>
   4.330 +  <PropertyGroup Label="Globals">
   4.331 +    <ProjectGuid>{aeaea3a2-d4e6-45b1-8ec6-53d84287fc14}</ProjectGuid>
   4.332 +    <Keyword>Win32Proj</Keyword>
   4.333 +    <ProjectName>SDL-WinRT</ProjectName>
   4.334 +    <RootNamespace>SDL_VS2012_WinRT</RootNamespace>
   4.335 +    <DefaultLanguage>en-US</DefaultLanguage>
   4.336 +    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
   4.337 +    <AppContainerApplication>true</AppContainerApplication>
   4.338 +  </PropertyGroup>
   4.339 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   4.340 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
   4.341 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
   4.342 +    <UseDebugLibraries>true</UseDebugLibraries>
   4.343 +    <PlatformToolset>v110</PlatformToolset>
   4.344 +  </PropertyGroup>
   4.345 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
   4.346 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
   4.347 +    <UseDebugLibraries>true</UseDebugLibraries>
   4.348 +    <PlatformToolset>v110</PlatformToolset>
   4.349 +  </PropertyGroup>
   4.350 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
   4.351 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
   4.352 +    <UseDebugLibraries>true</UseDebugLibraries>
   4.353 +    <PlatformToolset>v110</PlatformToolset>
   4.354 +  </PropertyGroup>
   4.355 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
   4.356 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
   4.357 +    <UseDebugLibraries>false</UseDebugLibraries>
   4.358 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   4.359 +    <PlatformToolset>v110</PlatformToolset>
   4.360 +  </PropertyGroup>
   4.361 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
   4.362 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
   4.363 +    <UseDebugLibraries>false</UseDebugLibraries>
   4.364 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   4.365 +    <PlatformToolset>v110</PlatformToolset>
   4.366 +  </PropertyGroup>
   4.367 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
   4.368 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
   4.369 +    <UseDebugLibraries>false</UseDebugLibraries>
   4.370 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   4.371 +    <PlatformToolset>v110</PlatformToolset>
   4.372 +  </PropertyGroup>
   4.373 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   4.374 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   4.375 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   4.376 +  </ImportGroup>
   4.377 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   4.378 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   4.379 +  </ImportGroup>
   4.380 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
   4.381 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   4.382 +  </ImportGroup>
   4.383 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
   4.384 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   4.385 +  </ImportGroup>
   4.386 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
   4.387 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   4.388 +  </ImportGroup>
   4.389 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   4.390 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   4.391 +  </ImportGroup>
   4.392 +  <PropertyGroup Label="UserMacros" />
   4.393 +  <PropertyGroup />
   4.394 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   4.395 +    <GenerateManifest>false</GenerateManifest>
   4.396 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
   4.397 +    <TargetName>SDL</TargetName>
   4.398 +  </PropertyGroup>
   4.399 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   4.400 +    <GenerateManifest>false</GenerateManifest>
   4.401 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
   4.402 +    <TargetName>SDL</TargetName>
   4.403 +  </PropertyGroup>
   4.404 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
   4.405 +    <GenerateManifest>false</GenerateManifest>
   4.406 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
   4.407 +    <TargetName>SDL</TargetName>
   4.408 +  </PropertyGroup>
   4.409 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
   4.410 +    <GenerateManifest>false</GenerateManifest>
   4.411 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
   4.412 +    <TargetName>SDL</TargetName>
   4.413 +  </PropertyGroup>
   4.414 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
   4.415 +    <GenerateManifest>false</GenerateManifest>
   4.416 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
   4.417 +    <TargetName>SDL</TargetName>
   4.418 +  </PropertyGroup>
   4.419 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   4.420 +    <GenerateManifest>false</GenerateManifest>
   4.421 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
   4.422 +    <TargetName>SDL</TargetName>
   4.423 +  </PropertyGroup>
   4.424 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   4.425 +    <ClCompile>
   4.426 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   4.427 +      <CompileAsWinRT>false</CompileAsWinRT>
   4.428 +      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   4.429 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   4.430 +    </ClCompile>
   4.431 +    <Link>
   4.432 +      <SubSystem>Console</SubSystem>
   4.433 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   4.434 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   4.435 +      <AdditionalDependencies>xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
   4.436 +    </Link>
   4.437 +  </ItemDefinitionGroup>
   4.438 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   4.439 +    <ClCompile>
   4.440 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   4.441 +      <CompileAsWinRT>false</CompileAsWinRT>
   4.442 +      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   4.443 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   4.444 +    </ClCompile>
   4.445 +    <Link>
   4.446 +      <SubSystem>Console</SubSystem>
   4.447 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   4.448 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   4.449 +      <AdditionalDependencies>xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
   4.450 +    </Link>
   4.451 +  </ItemDefinitionGroup>
   4.452 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm'">
   4.453 +    <ClCompile>
   4.454 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   4.455 +      <CompileAsWinRT>false</CompileAsWinRT>
   4.456 +      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   4.457 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   4.458 +    </ClCompile>
   4.459 +    <Link>
   4.460 +      <SubSystem>Console</SubSystem>
   4.461 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   4.462 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   4.463 +      <AdditionalDependencies>xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
   4.464 +    </Link>
   4.465 +  </ItemDefinitionGroup>
   4.466 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm'">
   4.467 +    <ClCompile>
   4.468 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   4.469 +      <CompileAsWinRT>false</CompileAsWinRT>
   4.470 +      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   4.471 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   4.472 +    </ClCompile>
   4.473 +    <Link>
   4.474 +      <SubSystem>Console</SubSystem>
   4.475 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   4.476 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   4.477 +      <AdditionalDependencies>xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
   4.478 +    </Link>
   4.479 +  </ItemDefinitionGroup>
   4.480 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
   4.481 +    <ClCompile>
   4.482 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   4.483 +      <CompileAsWinRT>false</CompileAsWinRT>
   4.484 +      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   4.485 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   4.486 +    </ClCompile>
   4.487 +    <Link>
   4.488 +      <SubSystem>Console</SubSystem>
   4.489 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   4.490 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   4.491 +      <AdditionalDependencies>xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
   4.492 +    </Link>
   4.493 +  </ItemDefinitionGroup>
   4.494 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   4.495 +    <ClCompile>
   4.496 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   4.497 +      <CompileAsWinRT>false</CompileAsWinRT>
   4.498 +      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   4.499 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   4.500 +    </ClCompile>
   4.501 +    <Link>
   4.502 +      <SubSystem>Console</SubSystem>
   4.503 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   4.504 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   4.505 +      <AdditionalDependencies>xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
   4.506 +    </Link>
   4.507 +  </ItemDefinitionGroup>
   4.508 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   4.509 +  <ImportGroup Label="ExtensionTargets">
   4.510 +  </ImportGroup>
   4.511 +</Project>
   4.512 \ No newline at end of file
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters	Sun Mar 09 11:36:47 2014 -0700
     5.3 @@ -0,0 +1,645 @@
     5.4 +<?xml version="1.0" encoding="utf-8"?>
     5.5 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     5.6 +  <ItemGroup>
     5.7 +    <ClCompile Include="..\..\src\SDL.c">
     5.8 +      <Filter>Source Files</Filter>
     5.9 +    </ClCompile>
    5.10 +    <ClCompile Include="..\..\src\SDL_assert.c">
    5.11 +      <Filter>Source Files</Filter>
    5.12 +    </ClCompile>
    5.13 +    <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
    5.14 +      <Filter>Source Files</Filter>
    5.15 +    </ClCompile>
    5.16 +    <ClCompile Include="..\..\src\audio\SDL_audio.c">
    5.17 +      <Filter>Source Files</Filter>
    5.18 +    </ClCompile>
    5.19 +    <ClCompile Include="..\..\src\audio\SDL_audiocvt.c">
    5.20 +      <Filter>Source Files</Filter>
    5.21 +    </ClCompile>
    5.22 +    <ClCompile Include="..\..\src\audio\SDL_audiodev.c">
    5.23 +      <Filter>Source Files</Filter>
    5.24 +    </ClCompile>
    5.25 +    <ClCompile Include="..\..\src\audio\SDL_audiotypecvt.c">
    5.26 +      <Filter>Source Files</Filter>
    5.27 +    </ClCompile>
    5.28 +    <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c">
    5.29 +      <Filter>Source Files</Filter>
    5.30 +    </ClCompile>
    5.31 +    <ClCompile Include="..\..\src\render\software\SDL_blendline.c">
    5.32 +      <Filter>Source Files</Filter>
    5.33 +    </ClCompile>
    5.34 +    <ClCompile Include="..\..\src\render\software\SDL_blendpoint.c">
    5.35 +      <Filter>Source Files</Filter>
    5.36 +    </ClCompile>
    5.37 +    <ClCompile Include="..\..\src\video\SDL_blit.c">
    5.38 +      <Filter>Source Files</Filter>
    5.39 +    </ClCompile>
    5.40 +    <ClCompile Include="..\..\src\video\SDL_blit_0.c">
    5.41 +      <Filter>Source Files</Filter>
    5.42 +    </ClCompile>
    5.43 +    <ClCompile Include="..\..\src\video\SDL_blit_1.c">
    5.44 +      <Filter>Source Files</Filter>
    5.45 +    </ClCompile>
    5.46 +    <ClCompile Include="..\..\src\video\SDL_blit_A.c">
    5.47 +      <Filter>Source Files</Filter>
    5.48 +    </ClCompile>
    5.49 +    <ClCompile Include="..\..\src\video\SDL_blit_auto.c">
    5.50 +      <Filter>Source Files</Filter>
    5.51 +    </ClCompile>
    5.52 +    <ClCompile Include="..\..\src\video\SDL_blit_copy.c">
    5.53 +      <Filter>Source Files</Filter>
    5.54 +    </ClCompile>
    5.55 +    <ClCompile Include="..\..\src\video\SDL_blit_N.c">
    5.56 +      <Filter>Source Files</Filter>
    5.57 +    </ClCompile>
    5.58 +    <ClCompile Include="..\..\src\video\SDL_blit_slow.c">
    5.59 +      <Filter>Source Files</Filter>
    5.60 +    </ClCompile>
    5.61 +    <ClCompile Include="..\..\src\video\SDL_bmp.c">
    5.62 +      <Filter>Source Files</Filter>
    5.63 +    </ClCompile>
    5.64 +    <ClCompile Include="..\..\src\video\SDL_clipboard.c">
    5.65 +      <Filter>Source Files</Filter>
    5.66 +    </ClCompile>
    5.67 +    <ClCompile Include="..\..\src\events\SDL_clipboardevents.c">
    5.68 +      <Filter>Source Files</Filter>
    5.69 +    </ClCompile>
    5.70 +    <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c">
    5.71 +      <Filter>Source Files</Filter>
    5.72 +    </ClCompile>
    5.73 +    <ClCompile Include="..\..\src\render\software\SDL_drawline.c">
    5.74 +      <Filter>Source Files</Filter>
    5.75 +    </ClCompile>
    5.76 +    <ClCompile Include="..\..\src\render\software\SDL_drawpoint.c">
    5.77 +      <Filter>Source Files</Filter>
    5.78 +    </ClCompile>
    5.79 +    <ClCompile Include="..\..\src\events\SDL_dropevents.c">
    5.80 +      <Filter>Source Files</Filter>
    5.81 +    </ClCompile>
    5.82 +    <ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c">
    5.83 +      <Filter>Source Files</Filter>
    5.84 +    </ClCompile>
    5.85 +    <ClCompile Include="..\..\src\SDL_error.c">
    5.86 +      <Filter>Source Files</Filter>
    5.87 +    </ClCompile>
    5.88 +    <ClCompile Include="..\..\src\events\SDL_events.c">
    5.89 +      <Filter>Source Files</Filter>
    5.90 +    </ClCompile>
    5.91 +    <ClCompile Include="..\..\src\video\SDL_fillrect.c">
    5.92 +      <Filter>Source Files</Filter>
    5.93 +    </ClCompile>
    5.94 +    <ClCompile Include="..\..\src\events\SDL_gesture.c">
    5.95 +      <Filter>Source Files</Filter>
    5.96 +    </ClCompile>
    5.97 +    <ClCompile Include="..\..\src\stdlib\SDL_getenv.c">
    5.98 +      <Filter>Source Files</Filter>
    5.99 +    </ClCompile>
   5.100 +    <ClCompile Include="..\..\src\haptic\SDL_haptic.c">
   5.101 +      <Filter>Source Files</Filter>
   5.102 +    </ClCompile>
   5.103 +    <ClCompile Include="..\..\src\SDL_hints.c">
   5.104 +      <Filter>Source Files</Filter>
   5.105 +    </ClCompile>
   5.106 +    <ClCompile Include="..\..\src\stdlib\SDL_iconv.c">
   5.107 +      <Filter>Source Files</Filter>
   5.108 +    </ClCompile>
   5.109 +    <ClCompile Include="..\..\src\joystick\SDL_joystick.c">
   5.110 +      <Filter>Source Files</Filter>
   5.111 +    </ClCompile>
   5.112 +    <ClCompile Include="..\..\src\events\SDL_keyboard.c">
   5.113 +      <Filter>Source Files</Filter>
   5.114 +    </ClCompile>
   5.115 +    <ClCompile Include="..\..\src\SDL_log.c">
   5.116 +      <Filter>Source Files</Filter>
   5.117 +    </ClCompile>
   5.118 +    <ClCompile Include="..\..\src\audio\SDL_mixer.c">
   5.119 +      <Filter>Source Files</Filter>
   5.120 +    </ClCompile>
   5.121 +    <ClCompile Include="..\..\src\events\SDL_mouse.c">
   5.122 +      <Filter>Source Files</Filter>
   5.123 +    </ClCompile>
   5.124 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c">
   5.125 +      <Filter>Source Files</Filter>
   5.126 +    </ClCompile>
   5.127 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullframebuffer.c">
   5.128 +      <Filter>Source Files</Filter>
   5.129 +    </ClCompile>
   5.130 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullvideo.c">
   5.131 +      <Filter>Source Files</Filter>
   5.132 +    </ClCompile>
   5.133 +    <ClCompile Include="..\..\src\video\SDL_pixels.c">
   5.134 +      <Filter>Source Files</Filter>
   5.135 +    </ClCompile>
   5.136 +    <ClCompile Include="..\..\src\stdlib\SDL_qsort.c">
   5.137 +      <Filter>Source Files</Filter>
   5.138 +    </ClCompile>
   5.139 +    <ClCompile Include="..\..\src\events\SDL_quit.c">
   5.140 +      <Filter>Source Files</Filter>
   5.141 +    </ClCompile>
   5.142 +    <ClCompile Include="..\..\src\video\SDL_rect.c">
   5.143 +      <Filter>Source Files</Filter>
   5.144 +    </ClCompile>
   5.145 +    <ClCompile Include="..\..\src\render\SDL_render.c">
   5.146 +      <Filter>Source Files</Filter>
   5.147 +    </ClCompile>
   5.148 +    <ClCompile Include="..\..\src\render\software\SDL_render_sw.c">
   5.149 +      <Filter>Source Files</Filter>
   5.150 +    </ClCompile>
   5.151 +    <ClCompile Include="..\..\src\video\SDL_RLEaccel.c">
   5.152 +      <Filter>Source Files</Filter>
   5.153 +    </ClCompile>
   5.154 +    <ClCompile Include="..\..\src\render\software\SDL_rotate.c">
   5.155 +      <Filter>Source Files</Filter>
   5.156 +    </ClCompile>
   5.157 +    <ClCompile Include="..\..\src\file\SDL_rwops.c">
   5.158 +      <Filter>Source Files</Filter>
   5.159 +    </ClCompile>
   5.160 +    <ClCompile Include="..\..\src\video\SDL_shape.c">
   5.161 +      <Filter>Source Files</Filter>
   5.162 +    </ClCompile>
   5.163 +    <ClCompile Include="..\..\src\atomic\SDL_spinlock.c">
   5.164 +      <Filter>Source Files</Filter>
   5.165 +    </ClCompile>
   5.166 +    <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c">
   5.167 +      <Filter>Source Files</Filter>
   5.168 +    </ClCompile>
   5.169 +    <ClCompile Include="..\..\src\video\SDL_stretch.c">
   5.170 +      <Filter>Source Files</Filter>
   5.171 +    </ClCompile>
   5.172 +    <ClCompile Include="..\..\src\stdlib\SDL_string.c">
   5.173 +      <Filter>Source Files</Filter>
   5.174 +    </ClCompile>
   5.175 +    <ClCompile Include="..\..\src\video\SDL_surface.c">
   5.176 +      <Filter>Source Files</Filter>
   5.177 +    </ClCompile>
   5.178 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp">
   5.179 +      <Filter>Source Files</Filter>
   5.180 +    </ClCompile>
   5.181 +    <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c">
   5.182 +      <Filter>Source Files</Filter>
   5.183 +    </ClCompile>
   5.184 +    <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c">
   5.185 +      <Filter>Source Files</Filter>
   5.186 +    </ClCompile>
   5.187 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp">
   5.188 +      <Filter>Source Files</Filter>
   5.189 +    </ClCompile>
   5.190 +    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c">
   5.191 +      <Filter>Source Files</Filter>
   5.192 +    </ClCompile>
   5.193 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp">
   5.194 +      <Filter>Source Files</Filter>
   5.195 +    </ClCompile>
   5.196 +    <ClCompile Include="..\..\src\timer\windows\SDL_systimer.c">
   5.197 +      <Filter>Source Files</Filter>
   5.198 +    </ClCompile>
   5.199 +    <ClCompile Include="..\..\src\thread\SDL_thread.c">
   5.200 +      <Filter>Source Files</Filter>
   5.201 +    </ClCompile>
   5.202 +    <ClCompile Include="..\..\src\timer\SDL_timer.c">
   5.203 +      <Filter>Source Files</Filter>
   5.204 +    </ClCompile>
   5.205 +    <ClCompile Include="..\..\src\events\SDL_touch.c">
   5.206 +      <Filter>Source Files</Filter>
   5.207 +    </ClCompile>
   5.208 +    <ClCompile Include="..\..\src\video\SDL_video.c">
   5.209 +      <Filter>Source Files</Filter>
   5.210 +    </ClCompile>
   5.211 +    <ClCompile Include="..\..\src\audio\SDL_wave.c">
   5.212 +      <Filter>Source Files</Filter>
   5.213 +    </ClCompile>
   5.214 +    <ClCompile Include="..\..\src\events\SDL_windowevents.c">
   5.215 +      <Filter>Source Files</Filter>
   5.216 +    </ClCompile>
   5.217 +    <ClCompile Include="..\..\src\core\windows\SDL_windows.c">
   5.218 +      <Filter>Source Files</Filter>
   5.219 +    </ClCompile>
   5.220 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c">
   5.221 +      <Filter>Source Files</Filter>
   5.222 +    </ClCompile>
   5.223 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.cpp">
   5.224 +      <Filter>Source Files</Filter>
   5.225 +    </ClCompile>
   5.226 +    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
   5.227 +      <Filter>Source Files</Filter>
   5.228 +    </ClCompile>
   5.229 +    <ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
   5.230 +      <Filter>Source Files</Filter>
   5.231 +    </ClCompile>
   5.232 +    <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c">
   5.233 +      <Filter>Source Files</Filter>
   5.234 +    </ClCompile>
   5.235 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.cpp">
   5.236 +      <Filter>Source Files</Filter>
   5.237 +    </ClCompile>
   5.238 +    <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c">
   5.239 +      <Filter>Source Files</Filter>
   5.240 +    </ClCompile>
   5.241 +    <ClCompile Include="..\..\src\stdlib\SDL_malloc.c">
   5.242 +      <Filter>Source Files</Filter>
   5.243 +    </ClCompile>
   5.244 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
   5.245 +      <Filter>Source Files</Filter>
   5.246 +    </ClCompile>
   5.247 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtmouse.cpp">
   5.248 +      <Filter>Source Files</Filter>
   5.249 +    </ClCompile>
   5.250 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtvideo.cpp">
   5.251 +      <Filter>Source Files</Filter>
   5.252 +    </ClCompile>
   5.253 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtkeyboard.cpp">
   5.254 +      <Filter>Source Files</Filter>
   5.255 +    </ClCompile>
   5.256 +    <ClCompile Include="..\..\src\joystick\winrt\SDL_xinputjoystick.c">
   5.257 +      <Filter>Source Files</Filter>
   5.258 +    </ClCompile>
   5.259 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
   5.260 +      <Filter>Source Files</Filter>
   5.261 +    </ClCompile>
   5.262 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.cpp">
   5.263 +      <Filter>Source Files</Filter>
   5.264 +    </ClCompile>
   5.265 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_xaml.cpp">
   5.266 +      <Filter>Source Files</Filter>
   5.267 +    </ClCompile>
   5.268 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_common.cpp">
   5.269 +      <Filter>Source Files</Filter>
   5.270 +    </ClCompile>
   5.271 +    <ClCompile Include="..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp">
   5.272 +      <Filter>Source Files</Filter>
   5.273 +    </ClCompile>
   5.274 +    <ClCompile Include="..\..\src\video\SDL_egl.c">
   5.275 +      <Filter>Source Files</Filter>
   5.276 +    </ClCompile>
   5.277 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtopengles.cpp">
   5.278 +      <Filter>Source Files</Filter>
   5.279 +    </ClCompile>
   5.280 +    <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c">
   5.281 +      <Filter>Source Files</Filter>
   5.282 +    </ClCompile>
   5.283 +    <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c">
   5.284 +      <Filter>Source Files</Filter>
   5.285 +    </ClCompile>
   5.286 +  </ItemGroup>
   5.287 +  <ItemGroup>
   5.288 +    <ClInclude Include="..\..\include\begin_code.h">
   5.289 +      <Filter>Header Files</Filter>
   5.290 +    </ClInclude>
   5.291 +    <ClInclude Include="..\..\include\close_code.h">
   5.292 +      <Filter>Header Files</Filter>
   5.293 +    </ClInclude>
   5.294 +    <ClInclude Include="..\..\include\SDL_assert.h">
   5.295 +      <Filter>Header Files</Filter>
   5.296 +    </ClInclude>
   5.297 +    <ClInclude Include="..\..\include\SDL.h">
   5.298 +      <Filter>Header Files</Filter>
   5.299 +    </ClInclude>
   5.300 +    <ClInclude Include="..\..\src\SDL_error_c.h">
   5.301 +      <Filter>Source Files</Filter>
   5.302 +    </ClInclude>
   5.303 +    <ClInclude Include="..\..\src\events\SDL_events_c.h">
   5.304 +      <Filter>Source Files</Filter>
   5.305 +    </ClInclude>
   5.306 +    <ClInclude Include="..\..\src\haptic\SDL_haptic_c.h">
   5.307 +      <Filter>Source Files</Filter>
   5.308 +    </ClInclude>
   5.309 +    <ClInclude Include="..\..\src\SDL_hints_c.h">
   5.310 +      <Filter>Source Files</Filter>
   5.311 +    </ClInclude>
   5.312 +    <ClInclude Include="..\..\src\events\SDL_mouse_c.h">
   5.313 +      <Filter>Source Files</Filter>
   5.314 +    </ClInclude>
   5.315 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h">
   5.316 +      <Filter>Source Files</Filter>
   5.317 +    </ClInclude>
   5.318 +    <ClInclude Include="..\..\include\SDL_types.h">
   5.319 +      <Filter>Header Files</Filter>
   5.320 +    </ClInclude>
   5.321 +    <ClInclude Include="..\..\src\SDL_assert_c.h">
   5.322 +      <Filter>Source Files</Filter>
   5.323 +    </ClInclude>
   5.324 +    <ClInclude Include="..\..\src\audio\SDL_audio_c.h">
   5.325 +      <Filter>Source Files</Filter>
   5.326 +    </ClInclude>
   5.327 +    <ClInclude Include="..\..\src\audio\SDL_audiodev_c.h">
   5.328 +      <Filter>Source Files</Filter>
   5.329 +    </ClInclude>
   5.330 +    <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h">
   5.331 +      <Filter>Source Files</Filter>
   5.332 +    </ClInclude>
   5.333 +    <ClInclude Include="..\..\src\events\SDL_dropevents_c.h">
   5.334 +      <Filter>Source Files</Filter>
   5.335 +    </ClInclude>
   5.336 +    <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h">
   5.337 +      <Filter>Source Files</Filter>
   5.338 +    </ClInclude>
   5.339 +    <ClInclude Include="..\..\src\events\SDL_keyboard_c.h">
   5.340 +      <Filter>Source Files</Filter>
   5.341 +    </ClInclude>
   5.342 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h">
   5.343 +      <Filter>Source Files</Filter>
   5.344 +    </ClInclude>
   5.345 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullframebuffer_c.h">
   5.346 +      <Filter>Source Files</Filter>
   5.347 +    </ClInclude>
   5.348 +    <ClInclude Include="..\..\src\video\SDL_pixels_c.h">
   5.349 +      <Filter>Source Files</Filter>
   5.350 +    </ClInclude>
   5.351 +    <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h">
   5.352 +      <Filter>Source Files</Filter>
   5.353 +    </ClInclude>
   5.354 +    <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h">
   5.355 +      <Filter>Source Files</Filter>
   5.356 +    </ClInclude>
   5.357 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h">
   5.358 +      <Filter>Source Files</Filter>
   5.359 +    </ClInclude>
   5.360 +    <ClInclude Include="..\..\src\thread\SDL_thread_c.h">
   5.361 +      <Filter>Source Files</Filter>
   5.362 +    </ClInclude>
   5.363 +    <ClInclude Include="..\..\src\timer\SDL_timer_c.h">
   5.364 +      <Filter>Source Files</Filter>
   5.365 +    </ClInclude>
   5.366 +    <ClInclude Include="..\..\src\events\SDL_touch_c.h">
   5.367 +      <Filter>Source Files</Filter>
   5.368 +    </ClInclude>
   5.369 +    <ClInclude Include="..\..\src\events\SDL_windowevents_c.h">
   5.370 +      <Filter>Source Files</Filter>
   5.371 +    </ClInclude>
   5.372 +    <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h">
   5.373 +      <Filter>Source Files</Filter>
   5.374 +    </ClInclude>
   5.375 +    <ClInclude Include="..\..\include\SDL_audio.h">
   5.376 +      <Filter>Header Files</Filter>
   5.377 +    </ClInclude>
   5.378 +    <ClInclude Include="..\..\include\SDL_atomic.h">
   5.379 +      <Filter>Header Files</Filter>
   5.380 +    </ClInclude>
   5.381 +    <ClInclude Include="..\..\include\SDL_blendmode.h">
   5.382 +      <Filter>Header Files</Filter>
   5.383 +    </ClInclude>
   5.384 +    <ClInclude Include="..\..\include\SDL_clipboard.h">
   5.385 +      <Filter>Header Files</Filter>
   5.386 +    </ClInclude>
   5.387 +    <ClInclude Include="..\..\src\audio\SDL_audiomem.h">
   5.388 +      <Filter>Source Files</Filter>
   5.389 +    </ClInclude>
   5.390 +    <ClInclude Include="..\..\src\render\software\SDL_blendfillrect.h">
   5.391 +      <Filter>Source Files</Filter>
   5.392 +    </ClInclude>
   5.393 +    <ClInclude Include="..\..\src\render\software\SDL_blendline.h">
   5.394 +      <Filter>Source Files</Filter>
   5.395 +    </ClInclude>
   5.396 +    <ClInclude Include="..\..\src\render\software\SDL_blendpoint.h">
   5.397 +      <Filter>Source Files</Filter>
   5.398 +    </ClInclude>
   5.399 +    <ClInclude Include="..\..\src\video\SDL_blit.h">
   5.400 +      <Filter>Source Files</Filter>
   5.401 +    </ClInclude>
   5.402 +    <ClInclude Include="..\..\src\video\SDL_blit_auto.h">
   5.403 +      <Filter>Source Files</Filter>
   5.404 +    </ClInclude>
   5.405 +    <ClInclude Include="..\..\src\video\SDL_blit_copy.h">
   5.406 +      <Filter>Source Files</Filter>
   5.407 +    </ClInclude>
   5.408 +    <ClInclude Include="..\..\src\video\SDL_blit_slow.h">
   5.409 +      <Filter>Source Files</Filter>
   5.410 +    </ClInclude>
   5.411 +    <ClInclude Include="..\..\src\render\mmx.h">
   5.412 +      <Filter>Source Files</Filter>
   5.413 +    </ClInclude>
   5.414 +    <ClInclude Include="..\..\include\SDL_config.h">
   5.415 +      <Filter>Header Files</Filter>
   5.416 +    </ClInclude>
   5.417 +    <ClInclude Include="..\..\include\SDL_config_minimal.h">
   5.418 +      <Filter>Header Files</Filter>
   5.419 +    </ClInclude>
   5.420 +    <ClInclude Include="..\..\include\SDL_copying.h">
   5.421 +      <Filter>Header Files</Filter>
   5.422 +    </ClInclude>
   5.423 +    <ClInclude Include="..\..\include\SDL_cpuinfo.h">
   5.424 +      <Filter>Header Files</Filter>
   5.425 +    </ClInclude>
   5.426 +    <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h">
   5.427 +      <Filter>Source Files</Filter>
   5.428 +    </ClInclude>
   5.429 +    <ClInclude Include="..\..\src\render\software\SDL_draw.h">
   5.430 +      <Filter>Source Files</Filter>
   5.431 +    </ClInclude>
   5.432 +    <ClInclude Include="..\..\src\render\software\SDL_drawline.h">
   5.433 +      <Filter>Source Files</Filter>
   5.434 +    </ClInclude>
   5.435 +    <ClInclude Include="..\..\src\render\software\SDL_drawpoint.h">
   5.436 +      <Filter>Source Files</Filter>
   5.437 +    </ClInclude>
   5.438 +    <ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h">
   5.439 +      <Filter>Source Files</Filter>
   5.440 +    </ClInclude>
   5.441 +    <ClInclude Include="..\..\include\SDL_endian.h">
   5.442 +      <Filter>Header Files</Filter>
   5.443 +    </ClInclude>
   5.444 +    <ClInclude Include="..\..\include\SDL_error.h">
   5.445 +      <Filter>Header Files</Filter>
   5.446 +    </ClInclude>
   5.447 +    <ClInclude Include="..\..\include\SDL_events.h">
   5.448 +      <Filter>Header Files</Filter>
   5.449 +    </ClInclude>
   5.450 +    <ClInclude Include="..\..\src\SDL_fatal.h">
   5.451 +      <Filter>Source Files</Filter>
   5.452 +    </ClInclude>
   5.453 +    <ClInclude Include="..\..\include\SDL_main.h">
   5.454 +      <Filter>Header Files</Filter>
   5.455 +    </ClInclude>
   5.456 +    <ClInclude Include="..\..\include\SDL_haptic.h">
   5.457 +      <Filter>Header Files</Filter>
   5.458 +    </ClInclude>
   5.459 +    <ClInclude Include="..\..\include\SDL_hints.h">
   5.460 +      <Filter>Header Files</Filter>
   5.461 +    </ClInclude>
   5.462 +    <ClInclude Include="..\..\include\SDL_input.h">
   5.463 +      <Filter>Header Files</Filter>
   5.464 +    </ClInclude>
   5.465 +    <ClInclude Include="..\..\include\SDL_joystick.h">
   5.466 +      <Filter>Header Files</Filter>
   5.467 +    </ClInclude>
   5.468 +    <ClInclude Include="..\..\include\SDL_keyboard.h">
   5.469 +      <Filter>Header Files</Filter>
   5.470 +    </ClInclude>
   5.471 +    <ClInclude Include="..\..\include\SDL_keycode.h">
   5.472 +      <Filter>Header Files</Filter>
   5.473 +    </ClInclude>
   5.474 +    <ClInclude Include="..\..\include\SDL_loadso.h">
   5.475 +      <Filter>Header Files</Filter>
   5.476 +    </ClInclude>
   5.477 +    <ClInclude Include="..\..\include\SDL_log.h">
   5.478 +      <Filter>Header Files</Filter>
   5.479 +    </ClInclude>
   5.480 +    <ClInclude Include="..\..\include\SDL_name.h">
   5.481 +      <Filter>Header Files</Filter>
   5.482 +    </ClInclude>
   5.483 +    <ClInclude Include="..\..\include\SDL_mouse.h">
   5.484 +      <Filter>Header Files</Filter>
   5.485 +    </ClInclude>
   5.486 +    <ClInclude Include="..\..\include\SDL_mutex.h">
   5.487 +      <Filter>Header Files</Filter>
   5.488 +    </ClInclude>
   5.489 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullvideo.h">
   5.490 +      <Filter>Source Files</Filter>
   5.491 +    </ClInclude>
   5.492 +    <ClInclude Include="..\..\include\SDL_quit.h">
   5.493 +      <Filter>Header Files</Filter>
   5.494 +    </ClInclude>
   5.495 +    <ClInclude Include="..\..\include\SDL_pixels.h">
   5.496 +      <Filter>Header Files</Filter>
   5.497 +    </ClInclude>
   5.498 +    <ClInclude Include="..\..\include\SDL_platform.h">
   5.499 +      <Filter>Header Files</Filter>
   5.500 +    </ClInclude>
   5.501 +    <ClInclude Include="..\..\include\SDL_power.h">
   5.502 +      <Filter>Header Files</Filter>
   5.503 +    </ClInclude>
   5.504 +    <ClInclude Include="..\..\src\video\SDL_rect_c.h">
   5.505 +      <Filter>Source Files</Filter>
   5.506 +    </ClInclude>
   5.507 +    <ClInclude Include="..\..\include\SDL_rect.h">
   5.508 +      <Filter>Header Files</Filter>
   5.509 +    </ClInclude>
   5.510 +    <ClInclude Include="..\..\src\render\software\SDL_rotate.h">
   5.511 +      <Filter>Source Files</Filter>
   5.512 +    </ClInclude>
   5.513 +    <ClInclude Include="..\..\include\SDL_shape.h">
   5.514 +      <Filter>Header Files</Filter>
   5.515 +    </ClInclude>
   5.516 +    <ClInclude Include="..\..\include\SDL_render.h">
   5.517 +      <Filter>Header Files</Filter>
   5.518 +    </ClInclude>
   5.519 +    <ClInclude Include="..\..\include\SDL_revision.h">
   5.520 +      <Filter>Header Files</Filter>
   5.521 +    </ClInclude>
   5.522 +    <ClInclude Include="..\..\include\SDL_rwops.h">
   5.523 +      <Filter>Header Files</Filter>
   5.524 +    </ClInclude>
   5.525 +    <ClInclude Include="..\..\include\SDL_scancode.h">
   5.526 +      <Filter>Header Files</Filter>
   5.527 +    </ClInclude>
   5.528 +    <ClInclude Include="..\..\include\SDL_surface.h">
   5.529 +      <Filter>Header Files</Filter>
   5.530 +    </ClInclude>
   5.531 +    <ClInclude Include="..\..\include\SDL_stdinc.h">
   5.532 +      <Filter>Header Files</Filter>
   5.533 +    </ClInclude>
   5.534 +    <ClInclude Include="..\..\include\SDL_video.h">
   5.535 +      <Filter>Header Files</Filter>
   5.536 +    </ClInclude>
   5.537 +    <ClInclude Include="..\..\include\SDL_syswm.h">
   5.538 +      <Filter>Header Files</Filter>
   5.539 +    </ClInclude>
   5.540 +    <ClInclude Include="..\..\include\SDL_thread.h">
   5.541 +      <Filter>Header Files</Filter>
   5.542 +    </ClInclude>
   5.543 +    <ClInclude Include="..\..\include\SDL_timer.h">
   5.544 +      <Filter>Header Files</Filter>
   5.545 +    </ClInclude>
   5.546 +    <ClInclude Include="..\..\include\SDL_touch.h">
   5.547 +      <Filter>Header Files</Filter>
   5.548 +    </ClInclude>
   5.549 +    <ClInclude Include="..\..\include\SDL_version.h">
   5.550 +      <Filter>Header Files</Filter>
   5.551 +    </ClInclude>
   5.552 +    <ClInclude Include="..\..\src\video\SDL_shape_internals.h">
   5.553 +      <Filter>Source Files</Filter>
   5.554 +    </ClInclude>
   5.555 +    <ClInclude Include="..\..\src\audio\SDL_sysaudio.h">
   5.556 +      <Filter>Source Files</Filter>
   5.557 +    </ClInclude>
   5.558 +    <ClInclude Include="..\..\src\events\SDL_sysevents.h">
   5.559 +      <Filter>Source Files</Filter>
   5.560 +    </ClInclude>
   5.561 +    <ClInclude Include="..\..\src\haptic\SDL_syshaptic.h">
   5.562 +      <Filter>Source Files</Filter>
   5.563 +    </ClInclude>
   5.564 +    <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h">
   5.565 +      <Filter>Source Files</Filter>
   5.566 +    </ClInclude>
   5.567 +    <ClInclude Include="..\..\src\render\SDL_sysrender.h">
   5.568 +      <Filter>Source Files</Filter>
   5.569 +    </ClInclude>
   5.570 +    <ClInclude Include="..\..\src\thread\SDL_systhread.h">
   5.571 +      <Filter>Source Files</Filter>
   5.572 +    </ClInclude>
   5.573 +    <ClInclude Include="..\..\src\video\SDL_sysvideo.h">
   5.574 +      <Filter>Source Files</Filter>
   5.575 +    </ClInclude>
   5.576 +    <ClInclude Include="..\..\src\audio\SDL_wave.h">
   5.577 +      <Filter>Source Files</Filter>
   5.578 +    </ClInclude>
   5.579 +    <ClInclude Include="..\..\src\core\windows\SDL_windows.h">
   5.580 +      <Filter>Source Files</Filter>
   5.581 +    </ClInclude>
   5.582 +    <ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.h">
   5.583 +      <Filter>Source Files</Filter>
   5.584 +    </ClInclude>
   5.585 +    <ClInclude Include="..\..\src\events\blank_cursor.h">
   5.586 +      <Filter>Source Files</Filter>
   5.587 +    </ClInclude>
   5.588 +    <ClInclude Include="..\..\src\events\default_cursor.h">
   5.589 +      <Filter>Source Files</Filter>
   5.590 +    </ClInclude>
   5.591 +    <ClInclude Include="..\..\include\SDL_system.h">
   5.592 +      <Filter>Header Files</Filter>
   5.593 +    </ClInclude>
   5.594 +    <ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h">
   5.595 +      <Filter>Header Files</Filter>
   5.596 +    </ClInclude>
   5.597 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h">
   5.598 +      <Filter>Source Files</Filter>
   5.599 +    </ClInclude>
   5.600 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h">
   5.601 +      <Filter>Source Files</Filter>
   5.602 +    </ClInclude>
   5.603 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h">
   5.604 +      <Filter>Source Files</Filter>
   5.605 +    </ClInclude>
   5.606 +    <ClInclude Include="..\..\include\SDL_config_winrt.h">
   5.607 +      <Filter>Header Files</Filter>
   5.608 +    </ClInclude>
   5.609 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.h">
   5.610 +      <Filter>Source Files</Filter>
   5.611 +    </ClInclude>
   5.612 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_xaml.h">
   5.613 +      <Filter>Source Files</Filter>
   5.614 +    </ClInclude>
   5.615 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_common.h">
   5.616 +      <Filter>Source Files</Filter>
   5.617 +    </ClInclude>
   5.618 +    <ClInclude Include="..\..\include\SDL_filesystem.h">
   5.619 +      <Filter>Header Files</Filter>
   5.620 +    </ClInclude>
   5.621 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h">
   5.622 +      <Filter>Source Files</Filter>
   5.623 +    </ClInclude>
   5.624 +    <ClInclude Include="..\..\src\video\SDL_egl.h">
   5.625 +      <Filter>Source Files</Filter>
   5.626 +    </ClInclude>
   5.627 +    <ClInclude Include="..\..\include\SDL_opengles2.h">
   5.628 +      <Filter>Header Files</Filter>
   5.629 +    </ClInclude>
   5.630 +    <ClInclude Include="..\..\include\SDL_egl.h">
   5.631 +      <Filter>Header Files</Filter>
   5.632 +    </ClInclude>
   5.633 +    <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h">
   5.634 +      <Filter>Source Files</Filter>
   5.635 +    </ClInclude>
   5.636 +    <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h">
   5.637 +      <Filter>Source Files</Filter>
   5.638 +    </ClInclude>
   5.639 +  </ItemGroup>
   5.640 +  <ItemGroup>
   5.641 +    <Filter Include="Header Files">
   5.642 +      <UniqueIdentifier>{20773b57-7034-4c24-af5a-334844585f1b}</UniqueIdentifier>
   5.643 +    </Filter>
   5.644 +    <Filter Include="Source Files">
   5.645 +      <UniqueIdentifier>{ddf04d85-6a87-4c5a-bc52-869b38f45a61}</UniqueIdentifier>
   5.646 +    </Filter>
   5.647 +  </ItemGroup>
   5.648 +</Project>
   5.649 \ No newline at end of file
     6.1 Binary file VisualC-WinRT/tests/loopwave/Assets/Logo.png has changed
     7.1 Binary file VisualC-WinRT/tests/loopwave/Assets/SmallLogo.png has changed
     8.1 Binary file VisualC-WinRT/tests/loopwave/Assets/SplashScreen.png has changed
     9.1 Binary file VisualC-WinRT/tests/loopwave/Assets/StoreLogo.png has changed
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/VisualC-WinRT/tests/loopwave/Package.appxmanifest	Sun Mar 09 11:36:47 2014 -0700
    10.3 @@ -0,0 +1,42 @@
    10.4 +<?xml version="1.0" encoding="utf-8"?>
    10.5 +<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
    10.6 +
    10.7 +  <Identity Name="1702c480-cf09-431e-a5e4-b21b283ec818"
    10.8 +            Publisher="CN=David"
    10.9 +            Version="1.0.0.0" />
   10.10 +
   10.11 +  <Properties>
   10.12 +    <DisplayName>loopwave_VS2012_WinRT</DisplayName>
   10.13 +    <PublisherDisplayName>David</PublisherDisplayName>
   10.14 +    <Logo>Assets\StoreLogo.png</Logo>
   10.15 +  </Properties>
   10.16 +
   10.17 +  <Prerequisites>
   10.18 +    <OSMinVersion>6.2.1</OSMinVersion>
   10.19 +    <OSMaxVersionTested>6.2.1</OSMaxVersionTested>
   10.20 +  </Prerequisites>
   10.21 +
   10.22 +  <Resources>
   10.23 +    <Resource Language="x-generate"/>
   10.24 +  </Resources>
   10.25 +
   10.26 +  <Applications>
   10.27 +    <Application Id="App"
   10.28 +        Executable="$targetnametoken$.exe"
   10.29 +        EntryPoint="loopwave_VS2012_WinRT.App">
   10.30 +        <VisualElements
   10.31 +            DisplayName="loopwave_VS2012_WinRT"
   10.32 +            Logo="Assets\Logo.png"
   10.33 +            SmallLogo="Assets\SmallLogo.png"
   10.34 +            Description="loopwave_VS2012_WinRT"
   10.35 +            ForegroundText="light"
   10.36 +            BackgroundColor="#464646">
   10.37 +            <DefaultTile ShowName="allLogos" />
   10.38 +            <SplashScreen Image="Assets\SplashScreen.png" />
   10.39 +        </VisualElements>
   10.40 +    </Application>
   10.41 +  </Applications>
   10.42 +  <Capabilities>
   10.43 +    <Capability Name="internetClient" />
   10.44 +  </Capabilities>
   10.45 +</Package>
   10.46 \ No newline at end of file
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj	Sun Mar 09 11:36:47 2014 -0700
    11.3 @@ -0,0 +1,170 @@
    11.4 +<?xml version="1.0" encoding="utf-8"?>
    11.5 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    11.6 +  <ItemGroup Label="ProjectConfigurations">
    11.7 +    <ProjectConfiguration Include="Debug|Win32">
    11.8 +      <Configuration>Debug</Configuration>
    11.9 +      <Platform>Win32</Platform>
   11.10 +    </ProjectConfiguration>
   11.11 +    <ProjectConfiguration Include="Release|Win32">
   11.12 +      <Configuration>Release</Configuration>
   11.13 +      <Platform>Win32</Platform>
   11.14 +    </ProjectConfiguration>
   11.15 +    <ProjectConfiguration Include="Debug|x64">
   11.16 +      <Configuration>Debug</Configuration>
   11.17 +      <Platform>x64</Platform>
   11.18 +    </ProjectConfiguration>
   11.19 +    <ProjectConfiguration Include="Release|x64">
   11.20 +      <Configuration>Release</Configuration>
   11.21 +      <Platform>x64</Platform>
   11.22 +    </ProjectConfiguration>
   11.23 +    <ProjectConfiguration Include="Debug|ARM">
   11.24 +      <Configuration>Debug</Configuration>
   11.25 +      <Platform>ARM</Platform>
   11.26 +    </ProjectConfiguration>
   11.27 +    <ProjectConfiguration Include="Release|ARM">
   11.28 +      <Configuration>Release</Configuration>
   11.29 +      <Platform>ARM</Platform>
   11.30 +    </ProjectConfiguration>
   11.31 +  </ItemGroup>
   11.32 +  <PropertyGroup Label="Globals">
   11.33 +    <ProjectGuid>{03fcc293-9406-49c2-acf6-6e7d460c3239}</ProjectGuid>
   11.34 +    <RootNamespace>loopwave_VS2012</RootNamespace>
   11.35 +    <DefaultLanguage>en-US</DefaultLanguage>
   11.36 +    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
   11.37 +    <AppContainerApplication>true</AppContainerApplication>
   11.38 +    <ProjectName>loopwave</ProjectName>
   11.39 +  </PropertyGroup>
   11.40 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   11.41 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
   11.42 +    <ConfigurationType>Application</ConfigurationType>
   11.43 +    <UseDebugLibraries>true</UseDebugLibraries>
   11.44 +    <PlatformToolset>v110</PlatformToolset>
   11.45 +  </PropertyGroup>
   11.46 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
   11.47 +    <ConfigurationType>Application</ConfigurationType>
   11.48 +    <UseDebugLibraries>true</UseDebugLibraries>
   11.49 +    <PlatformToolset>v110</PlatformToolset>
   11.50 +  </PropertyGroup>
   11.51 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
   11.52 +    <ConfigurationType>Application</ConfigurationType>
   11.53 +    <UseDebugLibraries>true</UseDebugLibraries>
   11.54 +    <PlatformToolset>v110</PlatformToolset>
   11.55 +  </PropertyGroup>
   11.56 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
   11.57 +    <ConfigurationType>Application</ConfigurationType>
   11.58 +    <UseDebugLibraries>false</UseDebugLibraries>
   11.59 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   11.60 +    <PlatformToolset>v110</PlatformToolset>
   11.61 +  </PropertyGroup>
   11.62 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
   11.63 +    <ConfigurationType>Application</ConfigurationType>
   11.64 +    <UseDebugLibraries>false</UseDebugLibraries>
   11.65 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   11.66 +    <PlatformToolset>v110</PlatformToolset>
   11.67 +  </PropertyGroup>
   11.68 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
   11.69 +    <ConfigurationType>Application</ConfigurationType>
   11.70 +    <UseDebugLibraries>false</UseDebugLibraries>
   11.71 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   11.72 +    <PlatformToolset>v110</PlatformToolset>
   11.73 +  </PropertyGroup>
   11.74 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   11.75 +  <ImportGroup Label="ExtensionSettings">
   11.76 +  </ImportGroup>
   11.77 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   11.78 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   11.79 +  </ImportGroup>
   11.80 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   11.81 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   11.82 +  </ImportGroup>
   11.83 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
   11.84 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   11.85 +  </ImportGroup>
   11.86 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
   11.87 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   11.88 +  </ImportGroup>
   11.89 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
   11.90 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   11.91 +  </ImportGroup>
   11.92 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   11.93 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   11.94 +  </ImportGroup>
   11.95 +  <PropertyGroup Label="UserMacros" />
   11.96 +  <PropertyGroup>
   11.97 +    <PackageCertificateKeyFile>loopwave_VS2012_TemporaryKey.pfx</PackageCertificateKeyFile>
   11.98 +  </PropertyGroup>
   11.99 +  <ItemDefinitionGroup>
  11.100 +    <Link>
  11.101 +      <AdditionalDependencies>d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
  11.102 +    </Link>
  11.103 +    <ClCompile>
  11.104 +      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
  11.105 +      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
  11.106 +      <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);$(ProjectDir)..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  11.107 +      <DisableSpecificWarnings>4453</DisableSpecificWarnings>
  11.108 +    </ClCompile>
  11.109 +  </ItemDefinitionGroup>
  11.110 +  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
  11.111 +    <ClCompile>
  11.112 +      <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  11.113 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader>
  11.114 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
  11.115 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
  11.116 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
  11.117 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
  11.118 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
  11.119 +    </ClCompile>
  11.120 +  </ItemDefinitionGroup>
  11.121 +  <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
  11.122 +    <ClCompile>
  11.123 +      <PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  11.124 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader>
  11.125 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
  11.126 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
  11.127 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
  11.128 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
  11.129 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
  11.130 +    </ClCompile>
  11.131 +  </ItemDefinitionGroup>
  11.132 +  <ItemGroup>
  11.133 +    <Image Include="Assets\Logo.png" />
  11.134 +    <Image Include="Assets\SmallLogo.png" />
  11.135 +    <Image Include="Assets\StoreLogo.png" />
  11.136 +    <Image Include="Assets\SplashScreen.png" />
  11.137 +  </ItemGroup>
  11.138 +  <ItemGroup>
  11.139 +    <AppxManifest Include="Package.appxmanifest">
  11.140 +      <SubType>Designer</SubType>
  11.141 +    </AppxManifest>
  11.142 +    <None Include="loopwave_VS2012_TemporaryKey.pfx" />
  11.143 +  </ItemGroup>
  11.144 +  <ItemGroup>
  11.145 +    <ClCompile Include="..\..\..\src\main\winrt\SDL_winrt_main_NonXAML.cpp">
  11.146 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
  11.147 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
  11.148 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
  11.149 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
  11.150 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
  11.151 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
  11.152 +    </ClCompile>
  11.153 +    <ClCompile Include="..\..\..\test\loopwave.c">
  11.154 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
  11.155 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
  11.156 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
  11.157 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
  11.158 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
  11.159 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
  11.160 +    </ClCompile>
  11.161 +  </ItemGroup>
  11.162 +  <ItemGroup>
  11.163 +    <Media Include="..\..\..\test\sample.wav" />
  11.164 +  </ItemGroup>
  11.165 +  <ItemGroup>
  11.166 +    <ProjectReference Include="..\..\SDL\SDL-WinRT_VS2012.vcxproj">
  11.167 +      <Project>{aeaea3a2-d4e6-45b1-8ec6-53d84287fc14}</Project>
  11.168 +    </ProjectReference>
  11.169 +  </ItemGroup>
  11.170 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  11.171 +  <ImportGroup Label="ExtensionTargets">
  11.172 +  </ImportGroup>
  11.173 +</Project>
  11.174 \ No newline at end of file
    12.1 Binary file VisualC-WinRT/tests/loopwave/loopwave_VS2012_TemporaryKey.pfx has changed
    13.1 Binary file VisualC-WinRT/tests/testthread/Assets/Logo.png has changed
    14.1 Binary file VisualC-WinRT/tests/testthread/Assets/SmallLogo.png has changed
    15.1 Binary file VisualC-WinRT/tests/testthread/Assets/SplashScreen.png has changed
    16.1 Binary file VisualC-WinRT/tests/testthread/Assets/StoreLogo.png has changed
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/VisualC-WinRT/tests/testthread/Package.appxmanifest	Sun Mar 09 11:36:47 2014 -0700
    17.3 @@ -0,0 +1,42 @@
    17.4 +<?xml version="1.0" encoding="utf-8"?>
    17.5 +<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
    17.6 +
    17.7 +  <Identity Name="ca3178f1-b2b2-43bf-97dd-28ee1b7d32c5"
    17.8 +            Publisher="CN=David"
    17.9 +            Version="1.0.0.0" />
   17.10 +
   17.11 +  <Properties>
   17.12 +    <DisplayName>testthread_VS2012_WinRT</DisplayName>
   17.13 +    <PublisherDisplayName>David</PublisherDisplayName>
   17.14 +    <Logo>Assets\StoreLogo.png</Logo>
   17.15 +  </Properties>
   17.16 +
   17.17 +  <Prerequisites>
   17.18 +    <OSMinVersion>6.2.1</OSMinVersion>
   17.19 +    <OSMaxVersionTested>6.2.1</OSMaxVersionTested>
   17.20 +  </Prerequisites>
   17.21 +
   17.22 +  <Resources>
   17.23 +    <Resource Language="x-generate"/>
   17.24 +  </Resources>
   17.25 +
   17.26 +  <Applications>
   17.27 +    <Application Id="App"
   17.28 +        Executable="$targetnametoken$.exe"
   17.29 +        EntryPoint="testthread_VS2012_WinRT.App">
   17.30 +        <VisualElements
   17.31 +            DisplayName="testthread_VS2012_WinRT"
   17.32 +            Logo="Assets\Logo.png"
   17.33 +            SmallLogo="Assets\SmallLogo.png"
   17.34 +            Description="testthread_VS2012_WinRT"
   17.35 +            ForegroundText="light"
   17.36 +            BackgroundColor="#464646">
   17.37 +            <DefaultTile ShowName="allLogos" />
   17.38 +            <SplashScreen Image="Assets\SplashScreen.png" />
   17.39 +        </VisualElements>
   17.40 +    </Application>
   17.41 +  </Applications>
   17.42 +  <Capabilities>
   17.43 +    <Capability Name="internetClient" />
   17.44 +  </Capabilities>
   17.45 +</Package>
   17.46 \ No newline at end of file
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj	Sun Mar 09 11:36:47 2014 -0700
    18.3 @@ -0,0 +1,160 @@
    18.4 +<?xml version="1.0" encoding="utf-8"?>
    18.5 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    18.6 +  <ItemGroup Label="ProjectConfigurations">
    18.7 +    <ProjectConfiguration Include="Debug|Win32">
    18.8 +      <Configuration>Debug</Configuration>
    18.9 +      <Platform>Win32</Platform>
   18.10 +    </ProjectConfiguration>
   18.11 +    <ProjectConfiguration Include="Release|Win32">
   18.12 +      <Configuration>Release</Configuration>
   18.13 +      <Platform>Win32</Platform>
   18.14 +    </ProjectConfiguration>
   18.15 +    <ProjectConfiguration Include="Debug|x64">
   18.16 +      <Configuration>Debug</Configuration>
   18.17 +      <Platform>x64</Platform>
   18.18 +    </ProjectConfiguration>
   18.19 +    <ProjectConfiguration Include="Release|x64">
   18.20 +      <Configuration>Release</Configuration>
   18.21 +      <Platform>x64</Platform>
   18.22 +    </ProjectConfiguration>
   18.23 +    <ProjectConfiguration Include="Debug|ARM">
   18.24 +      <Configuration>Debug</Configuration>
   18.25 +      <Platform>ARM</Platform>
   18.26 +    </ProjectConfiguration>
   18.27 +    <ProjectConfiguration Include="Release|ARM">
   18.28 +      <Configuration>Release</Configuration>
   18.29 +      <Platform>ARM</Platform>
   18.30 +    </ProjectConfiguration>
   18.31 +  </ItemGroup>
   18.32 +  <PropertyGroup Label="Globals">
   18.33 +    <ProjectGuid>{a8705bee-d01d-46a4-b2ab-feedfb5fdd11}</ProjectGuid>
   18.34 +    <RootNamespace>testthread_VS2012</RootNamespace>
   18.35 +    <DefaultLanguage>en-US</DefaultLanguage>
   18.36 +    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
   18.37 +    <AppContainerApplication>true</AppContainerApplication>
   18.38 +    <ProjectName>testthread</ProjectName>
   18.39 +  </PropertyGroup>
   18.40 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   18.41 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
   18.42 +    <ConfigurationType>Application</ConfigurationType>
   18.43 +    <UseDebugLibraries>true</UseDebugLibraries>
   18.44 +    <PlatformToolset>v110</PlatformToolset>
   18.45 +  </PropertyGroup>
   18.46 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
   18.47 +    <ConfigurationType>Application</ConfigurationType>
   18.48 +    <UseDebugLibraries>true</UseDebugLibraries>
   18.49 +    <PlatformToolset>v110</PlatformToolset>
   18.50 +  </PropertyGroup>
   18.51 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
   18.52 +    <ConfigurationType>Application</ConfigurationType>
   18.53 +    <UseDebugLibraries>true</UseDebugLibraries>
   18.54 +    <PlatformToolset>v110</PlatformToolset>
   18.55 +  </PropertyGroup>
   18.56 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
   18.57 +    <ConfigurationType>Application</ConfigurationType>
   18.58 +    <UseDebugLibraries>false</UseDebugLibraries>
   18.59 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   18.60 +    <PlatformToolset>v110</PlatformToolset>
   18.61 +  </PropertyGroup>
   18.62 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
   18.63 +    <ConfigurationType>Application</ConfigurationType>
   18.64 +    <UseDebugLibraries>false</UseDebugLibraries>
   18.65 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   18.66 +    <PlatformToolset>v110</PlatformToolset>
   18.67 +  </PropertyGroup>
   18.68 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
   18.69 +    <ConfigurationType>Application</ConfigurationType>
   18.70 +    <UseDebugLibraries>false</UseDebugLibraries>
   18.71 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   18.72 +    <PlatformToolset>v110</PlatformToolset>
   18.73 +  </PropertyGroup>
   18.74 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   18.75 +  <ImportGroup Label="ExtensionSettings">
   18.76 +  </ImportGroup>
   18.77 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   18.78 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   18.79 +  </ImportGroup>
   18.80 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   18.81 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   18.82 +  </ImportGroup>
   18.83 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
   18.84 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   18.85 +  </ImportGroup>
   18.86 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
   18.87 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   18.88 +  </ImportGroup>
   18.89 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
   18.90 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   18.91 +  </ImportGroup>
   18.92 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   18.93 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   18.94 +  </ImportGroup>
   18.95 +  <PropertyGroup Label="UserMacros" />
   18.96 +  <PropertyGroup>
   18.97 +    <PackageCertificateKeyFile>testthread_VS2012_TemporaryKey.pfx</PackageCertificateKeyFile>
   18.98 +  </PropertyGroup>
   18.99 +  <ItemDefinitionGroup>
  18.100 +    <Link>
  18.101 +      <AdditionalDependencies>d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
  18.102 +    </Link>
  18.103 +    <ClCompile>
  18.104 +      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
  18.105 +      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
  18.106 +      <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);$(ProjectDir)..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  18.107 +      <DisableSpecificWarnings>4453</DisableSpecificWarnings>
  18.108 +    </ClCompile>
  18.109 +  </ItemDefinitionGroup>
  18.110 +  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
  18.111 +    <ClCompile>
  18.112 +      <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  18.113 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader>
  18.114 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
  18.115 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
  18.116 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
  18.117 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
  18.118 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
  18.119 +    </ClCompile>
  18.120 +  </ItemDefinitionGroup>
  18.121 +  <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
  18.122 +    <ClCompile>
  18.123 +      <PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  18.124 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader>
  18.125 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
  18.126 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
  18.127 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
  18.128 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
  18.129 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
  18.130 +    </ClCompile>
  18.131 +  </ItemDefinitionGroup>
  18.132 +  <ItemGroup>
  18.133 +    <Image Include="Assets\Logo.png" />
  18.134 +    <Image Include="Assets\SmallLogo.png" />
  18.135 +    <Image Include="Assets\StoreLogo.png" />
  18.136 +    <Image Include="Assets\SplashScreen.png" />
  18.137 +  </ItemGroup>
  18.138 +  <ItemGroup>
  18.139 +    <AppxManifest Include="Package.appxmanifest">
  18.140 +      <SubType>Designer</SubType>
  18.141 +    </AppxManifest>
  18.142 +    <None Include="testthread_VS2012_TemporaryKey.pfx" />
  18.143 +  </ItemGroup>
  18.144 +  <ItemGroup>
  18.145 +    <ClCompile Include="..\..\..\src\main\winrt\SDL_winrt_main_NonXAML.cpp">
  18.146 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
  18.147 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
  18.148 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
  18.149 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
  18.150 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
  18.151 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
  18.152 +    </ClCompile>
  18.153 +    <ClCompile Include="..\..\..\test\testthread.c" />
  18.154 +  </ItemGroup>
  18.155 +  <ItemGroup>
  18.156 +    <ProjectReference Include="..\..\SDL\SDL-WinRT_VS2012.vcxproj">
  18.157 +      <Project>{aeaea3a2-d4e6-45b1-8ec6-53d84287fc14}</Project>
  18.158 +    </ProjectReference>
  18.159 +  </ItemGroup>
  18.160 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  18.161 +  <ImportGroup Label="ExtensionTargets">
  18.162 +  </ImportGroup>
  18.163 +</Project>
  18.164 \ No newline at end of file
    19.1 Binary file VisualC-WinRT/tests/testthread/testthread_VS2012_TemporaryKey.pfx has changed
    20.1 --- a/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Sun Mar 09 10:38:30 2014 -0700
    20.2 +++ b/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Sun Mar 09 11:36:47 2014 -0700
    20.3 @@ -561,6 +561,7 @@
    20.4  			);
    20.5  			name = CustomTemplate;
    20.6  			sourceTree = "<group>";
    20.7 +			usesTabs = 0;
    20.8  		};
    20.9  		56A6702F18565E4F0007D20F /* dynapi */ = {
   20.10  			isa = PBXGroup;
    21.1 --- a/include/SDL_config.h	Sun Mar 09 10:38:30 2014 -0700
    21.2 +++ b/include/SDL_config.h	Sun Mar 09 11:36:47 2014 -0700
    21.3 @@ -33,6 +33,8 @@
    21.4  #include "SDL_config_premake.h"
    21.5  #elif defined(__WIN32__)
    21.6  #include "SDL_config_windows.h"
    21.7 +#elif defined(__WINRT__)
    21.8 +#include "SDL_config_winrt.h"
    21.9  #elif defined(__MACOSX__)
   21.10  #include "SDL_config_macosx.h"
   21.11  #elif defined(__IPHONEOS__)
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/include/SDL_config_winrt.h	Sun Mar 09 11:36:47 2014 -0700
    22.3 @@ -0,0 +1,191 @@
    22.4 +/*
    22.5 +  Simple DirectMedia Layer
    22.6 +  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
    22.7 +
    22.8 +  This software is provided 'as-is', without any express or implied
    22.9 +  warranty.  In no event will the authors be held liable for any damages
   22.10 +  arising from the use of this software.
   22.11 +
   22.12 +  Permission is granted to anyone to use this software for any purpose,
   22.13 +  including commercial applications, and to alter it and redistribute it
   22.14 +  freely, subject to the following restrictions:
   22.15 +
   22.16 +  1. The origin of this software must not be misrepresented; you must not
   22.17 +     claim that you wrote the original software. If you use this software
   22.18 +     in a product, an acknowledgment in the product documentation would be
   22.19 +     appreciated but is not required.
   22.20 +  2. Altered source versions must be plainly marked as such, and must not be
   22.21 +     misrepresented as being the original software.
   22.22 +  3. This notice may not be removed or altered from any source distribution.
   22.23 +*/
   22.24 +
   22.25 +#ifndef _SDL_config_windows_h
   22.26 +#define _SDL_config_windows_h
   22.27 +
   22.28 +#include "SDL_platform.h"
   22.29 +
   22.30 +/* This is a set of defines to configure the SDL features */
   22.31 +
   22.32 +#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
   22.33 +#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
   22.34 +#define HAVE_STDINT_H	1
   22.35 +#elif defined(_MSC_VER)
   22.36 +typedef signed __int8 int8_t;
   22.37 +typedef unsigned __int8 uint8_t;
   22.38 +typedef signed __int16 int16_t;
   22.39 +typedef unsigned __int16 uint16_t;
   22.40 +typedef signed __int32 int32_t;
   22.41 +typedef unsigned __int32 uint32_t;
   22.42 +typedef signed __int64 int64_t;
   22.43 +typedef unsigned __int64 uint64_t;
   22.44 +#ifndef _UINTPTR_T_DEFINED
   22.45 +#ifdef  _WIN64
   22.46 +typedef unsigned __int64 uintptr_t;
   22.47 +#else
   22.48 +typedef unsigned int uintptr_t;
   22.49 +#endif
   22.50 +#define _UINTPTR_T_DEFINED
   22.51 +#endif
   22.52 +/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
   22.53 +#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
   22.54 +#define DWORD_PTR DWORD
   22.55 +#endif
   22.56 +#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
   22.57 +#define LONG_PTR LONG
   22.58 +#endif
   22.59 +#else /* !__GNUC__ && !_MSC_VER */
   22.60 +typedef signed char int8_t;
   22.61 +typedef unsigned char uint8_t;
   22.62 +typedef signed short int16_t;
   22.63 +typedef unsigned short uint16_t;
   22.64 +typedef signed int int32_t;
   22.65 +typedef unsigned int uint32_t;
   22.66 +typedef signed long long int64_t;
   22.67 +typedef unsigned long long uint64_t;
   22.68 +#ifndef _SIZE_T_DEFINED_
   22.69 +#define _SIZE_T_DEFINED_
   22.70 +typedef unsigned int size_t;
   22.71 +#endif
   22.72 +typedef unsigned int uintptr_t;
   22.73 +#endif /* __GNUC__ || _MSC_VER */
   22.74 +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
   22.75 +
   22.76 +#ifdef _WIN64
   22.77 +# define SIZEOF_VOIDP 8
   22.78 +#else
   22.79 +# define SIZEOF_VOIDP 4
   22.80 +#endif
   22.81 +
   22.82 +/* Useful headers */
   22.83 +#define HAVE_LIBC 1
   22.84 +#define HAVE_STDIO_H 1
   22.85 +#define STDC_HEADERS 1
   22.86 +#define HAVE_STRING_H 1
   22.87 +#define HAVE_CTYPE_H 1
   22.88 +#define HAVE_MATH_H 1
   22.89 +#define HAVE_FLOAT_H 1
   22.90 +#define HAVE_SIGNAL_H 1
   22.91 +
   22.92 +/* C library functions */
   22.93 +#define HAVE_MALLOC 1
   22.94 +#define HAVE_CALLOC 1
   22.95 +#define HAVE_REALLOC 1
   22.96 +#define HAVE_FREE 1
   22.97 +#define HAVE_ALLOCA 1
   22.98 +#define HAVE_QSORT 1
   22.99 +#define HAVE_ABS 1
  22.100 +#define HAVE_MEMSET 1
  22.101 +#define HAVE_MEMCPY 1
  22.102 +#define HAVE_MEMMOVE 1
  22.103 +#define HAVE_MEMCMP 1
  22.104 +#define HAVE_STRLEN 1
  22.105 +#define HAVE__STRREV 1
  22.106 +#define HAVE__STRUPR 1
  22.107 +//#define HAVE__STRLWR 1	// TODO, WinRT: consider using _strlwr_s instead
  22.108 +#define HAVE_STRCHR 1
  22.109 +#define HAVE_STRRCHR 1
  22.110 +#define HAVE_STRSTR 1
  22.111 +//#define HAVE_ITOA 1   // TODO, WinRT: consider using _itoa_s instead
  22.112 +//#define HAVE__LTOA 1	// TODO, WinRT: consider using _ltoa_s instead
  22.113 +//#define HAVE__ULTOA 1	// TODO, WinRT: consider using _ultoa_s instead
  22.114 +#define HAVE_STRTOL 1
  22.115 +#define HAVE_STRTOUL 1
  22.116 +//#define HAVE_STRTOLL 1
  22.117 +#define HAVE_STRTOD 1
  22.118 +#define HAVE_ATOI 1
  22.119 +#define HAVE_ATOF 1
  22.120 +#define HAVE_STRCMP 1
  22.121 +#define HAVE_STRNCMP 1
  22.122 +#define HAVE__STRICMP 1
  22.123 +#define HAVE__STRNICMP 1
  22.124 +#define HAVE_VSNPRINTF 1
  22.125 +//#define HAVE_SSCANF 1	// TODO, WinRT: consider using sscanf_s instead
  22.126 +#define HAVE_M_PI 1
  22.127 +#define HAVE_ATAN 1
  22.128 +#define HAVE_ATAN2 1
  22.129 +#define HAVE_CEIL 1
  22.130 +#define HAVE__COPYSIGN 1
  22.131 +#define HAVE_COS 1
  22.132 +#define HAVE_COSF 1
  22.133 +#define HAVE_FABS 1
  22.134 +#define HAVE_FLOOR 1
  22.135 +#define HAVE_LOG 1
  22.136 +#define HAVE_POW 1
  22.137 +//#define HAVE_SCALBN 1
  22.138 +#define HAVE__SCALB 1
  22.139 +#define HAVE_SIN 1
  22.140 +#define HAVE_SINF 1
  22.141 +#define HAVE_SQRT 1
  22.142 +#define HAVE__FSEEKI64 1
  22.143 +
  22.144 +/* Enable various audio drivers */
  22.145 +#define SDL_AUDIO_DRIVER_XAUDIO2	1
  22.146 +#define SDL_AUDIO_DRIVER_DISK	1
  22.147 +#define SDL_AUDIO_DRIVER_DUMMY	1
  22.148 +
  22.149 +/* Enable various input drivers */
  22.150 +// TODO, WinRT: Get haptic support working
  22.151 +#define SDL_HAPTIC_DISABLED	1
  22.152 +
  22.153 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  22.154 +#define SDL_JOYSTICK_DISABLED 1
  22.155 +#else
  22.156 +#define SDL_JOYSTICK_XINPUT 1
  22.157 +#endif
  22.158 +
  22.159 +/* Enable various shared object loading systems */
  22.160 +#define SDL_LOADSO_WINDOWS	1
  22.161 +
  22.162 +/* Enable various threading systems */
  22.163 +#define SDL_THREAD_STDCPP   1
  22.164 +
  22.165 +/* Enable various timer systems */
  22.166 +#define SDL_TIMER_WINDOWS	1
  22.167 +
  22.168 +/* Enable various video drivers */
  22.169 +#define SDL_VIDEO_DRIVER_WINRT	1
  22.170 +#define SDL_VIDEO_DRIVER_DUMMY  1
  22.171 +
  22.172 +/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */
  22.173 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP    /* TODO, WinRT: try adding OpenGL ES 2 support for Windows Phone 8 */
  22.174 +#define SDL_VIDEO_OPENGL_ES2 1
  22.175 +#define SDL_VIDEO_OPENGL_EGL 1
  22.176 +#endif
  22.177 +
  22.178 +/* Enable appropriate renderer(s) */
  22.179 +#define SDL_VIDEO_RENDER_D3D11  1
  22.180 +
  22.181 +#if SDL_VIDEO_OPENGL_ES2
  22.182 +#define SDL_VIDEO_RENDER_OGL_ES2 1
  22.183 +#endif
  22.184 +
  22.185 +/* Enable system power support */
  22.186 +// TODO, WinRT: investigate system power support.  The Win32-based APIs don't work on WinRT.
  22.187 +#define SDL_POWER_DISABLED  1
  22.188 +
  22.189 +/* Enable assembly routines (Win64 doesn't have inline asm) */
  22.190 +#ifndef _WIN64
  22.191 +#define SDL_ASSEMBLY_ROUTINES	1
  22.192 +#endif
  22.193 +
  22.194 +#endif /* _SDL_config_windows_h */
    23.1 --- a/include/SDL_cpuinfo.h	Sun Mar 09 10:38:30 2014 -0700
    23.2 +++ b/include/SDL_cpuinfo.h	Sun Mar 09 11:36:47 2014 -0700
    23.3 @@ -32,7 +32,7 @@
    23.4  
    23.5  /* Need to do this here because intrin.h has C++ code in it */
    23.6  /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
    23.7 -#if defined(_MSC_VER) && (_MSC_VER >= 1500)
    23.8 +#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
    23.9  #include <intrin.h>
   23.10  #ifndef _WIN64
   23.11  #define __MMX__
    24.1 --- a/include/SDL_egl.h	Sun Mar 09 10:38:30 2014 -0700
    24.2 +++ b/include/SDL_egl.h	Sun Mar 09 11:36:47 2014 -0700
    24.3 @@ -391,9 +391,16 @@
    24.4  #endif
    24.5  #include <windows.h>
    24.6  
    24.7 +#if __WINRT__
    24.8 +#include <Unknwn.h>
    24.9 +typedef IUnknown * EGLNativeWindowType;
   24.10 +typedef int EGLNativeDisplayType;
   24.11 +typedef HBITMAP EGLNativePixmapType;
   24.12 +#else
   24.13  typedef HDC     EGLNativeDisplayType;
   24.14  typedef HBITMAP EGLNativePixmapType;
   24.15  typedef HWND    EGLNativeWindowType;
   24.16 +#endif
   24.17  
   24.18  #elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
   24.19  
    25.1 --- a/include/SDL_hints.h	Sun Mar 09 10:38:30 2014 -0700
    25.2 +++ b/include/SDL_hints.h	Sun Mar 09 11:36:47 2014 -0700
    25.3 @@ -106,6 +106,19 @@
    25.4  #define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE"
    25.5  
    25.6  /**
    25.7 + *  \brief  A variable controlling whether to enable Direct3D 11+'s Debug Layer.
    25.8 + *
    25.9 + *  This variable does not have any effect on the Direct3D 9 based renderer.
   25.10 + *
   25.11 + *  This variable can be set to the following values:
   25.12 + *    "0"       - Disable Debug Layer use
   25.13 + *    "1"       - Enable Debug Layer use
   25.14 + *
   25.15 + *  By default, SDL does not use Direct3D Debug Layer.
   25.16 + */
   25.17 +#define SDL_HINT_RENDER_DIRECT3D11_DEBUG    "SDL_HINT_RENDER_DIRECT3D11_DEBUG"
   25.18 +
   25.19 +/**
   25.20   *  \brief  A variable controlling the scaling quality
   25.21   *
   25.22   *  This variable can be set to the following values:
   25.23 @@ -334,7 +347,7 @@
   25.24  *  If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has
   25.25  *  SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly 
   25.26  *  created SDL_Window:
   25.27 -
   25.28 +*
   25.29  *  1. Its pixel format will be set to the same pixel format as this SDL_Window.  This is
   25.30  *  needed for example when sharing an OpenGL context across multiple windows.
   25.31  *
   25.32 @@ -347,6 +360,62 @@
   25.33  */
   25.34  #define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT    "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"
   25.35  
   25.36 +/*
   25.37 + *  \brief A URL to a WinRT app's privacy policy
   25.38 + *
   25.39 + *  All network-enabled WinRT apps must make a privacy policy available to its
   25.40 + *  users.  On Windows 8, 8.1, and RT, Microsoft mandates that this policy be
   25.41 + *  be available in the Windows Settings charm, as accessed from within the app.
   25.42 + *  SDL provides code to add a URL-based link there, which can point to the app's
   25.43 + *  privacy policy.
   25.44 + *
   25.45 + *  To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL
   25.46 + *  before calling any SDL_Init functions.  The contents of the hint should
   25.47 + *  be a valid URL.  For example, "http://www.example.com".
   25.48 + *
   25.49 + *  The default value is "", which will prevent SDL from adding a privacy policy
   25.50 + *  link to the Settings charm.  This hint should only be set during app init.
   25.51 + *
   25.52 + *  The label text of an app's "Privacy Policy" link may be customized via another
   25.53 + *  hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
   25.54 + *
   25.55 + *  Please note that on Windows Phone, Microsoft does not provide standard UI
   25.56 + *  for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL
   25.57 + *  will not get used on that platform.  Network-enabled phone apps should display
   25.58 + *  their privacy policy through some other, in-app means.
   25.59 + */
   25.60 +#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_HINT_WINRT_PRIVACY_POLICY_URL"
   25.61 +
   25.62 +/** \brief Label text for a WinRT app's privacy policy link
   25.63 + *
   25.64 + *  Network-enabled WinRT apps must include a privacy policy.  On Windows 8, 8.1, and RT,
   25.65 + *  Microsoft mandates that this policy be available via the Windows Settings charm.
   25.66 + *  SDL provides code to add a link there, with it's label text being set via the
   25.67 + *  optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
   25.68 + *
   25.69 + *  Please note that a privacy policy's contents are not set via this hint.  A separate
   25.70 + *  hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the
   25.71 + *  policy.
   25.72 + *
   25.73 + *  The contents of this hint should be encoded as a UTF8 string.
   25.74 + *
   25.75 + *  The default value is "Privacy Policy".  This hint should only be set during app
   25.76 + *  initialization, preferably before any calls to SDL_Init.
   25.77 + *
   25.78 + *  For additional information on linking to a privacy policy, see the documentation for
   25.79 + *  SDL_HINT_WINRT_PRIVACY_POLICY_URL.
   25.80 + */
   25.81 +#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_HINT_WINRT_PRIVACY_POLICY_LABEL"
   25.82 +
   25.83 +/** \brief If set to 1, back button press events on Windows Phone 8+ will be marked as handled.
   25.84 + *
   25.85 + *  TODO, WinRT: document SDL_HINT_WINRT_HANDLE_BACK_BUTTON need and use
   25.86 + *  For now, more details on why this is needed can be found at the
   25.87 + *  beginning of the following web page:
   25.88 + *  http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx
   25.89 + */
   25.90 +#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_HINT_WINRT_HANDLE_BACK_BUTTON"
   25.91 +
   25.92  /**
   25.93   *  \brief  A variable that dictates policy for fullscreen Spaces on Mac OS X.
   25.94   *
    26.1 --- a/include/SDL_main.h	Sun Mar 09 10:38:30 2014 -0700
    26.2 +++ b/include/SDL_main.h	Sun Mar 09 11:36:47 2014 -0700
    26.3 @@ -39,6 +39,18 @@
    26.4   */
    26.5  #define SDL_MAIN_AVAILABLE
    26.6  
    26.7 +#elif defined(__WINRT__)
    26.8 +/* On WinRT, SDL provides a main function that initializes CoreApplication,
    26.9 +   creating an instance of IFrameworkView in the process.
   26.10 +
   26.11 +   Please note that #include'ing SDL_main.h is not enough to get a main()
   26.12 +   function working.  In non-XAML apps, the file,
   26.13 +   src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled
   26.14 +   into the app itself.  In XAML apps, the function, SDL_WinRTRunApp must be
   26.15 +   called, with a pointer to the Direct3D-hosted XAML control passed in.
   26.16 +*/
   26.17 +#define SDL_MAIN_NEEDED
   26.18 +
   26.19  #elif defined(__IPHONEOS__)
   26.20  /* On iOS SDL provides a main function that creates an application delegate
   26.21     and starts the iOS application run loop.
   26.22 @@ -115,6 +127,24 @@
   26.23  #endif /* __WIN32__ */
   26.24  
   26.25  
   26.26 +#ifdef __WINRT__
   26.27 +
   26.28 +/**
   26.29 + *  \brief Initializes and launches an SDL/WinRT application.
   26.30 + *
   26.31 + *  \param mainFunction The SDL app's C-style main().
   26.32 + *  \param xamlBackgroundPanel An optional, XAML-based, background panel.
   26.33 + *     For Non-XAML apps, this value must be set to NULL.  For XAML apps,
   26.34 + *     pass in a pointer to a SwapChainBackgroundPanel, casted to an
   26.35 + *     IInspectable (via reinterpret_cast).
   26.36 + *  \ret 0 on success, -1 on failure.  On failure, use SDL_GetError to retrieve more
   26.37 + *      information on the failure.
   26.38 + */
   26.39 +extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel);
   26.40 +
   26.41 +#endif /* __WINRT__ */
   26.42 +
   26.43 +
   26.44  #ifdef __cplusplus
   26.45  }
   26.46  #endif
    27.1 --- a/include/SDL_platform.h	Sun Mar 09 10:38:30 2014 -0700
    27.2 +++ b/include/SDL_platform.h	Sun Mar 09 11:36:47 2014 -0700
    27.3 @@ -113,10 +113,27 @@
    27.4  #undef __SOLARIS__
    27.5  #define __SOLARIS__ 1
    27.6  #endif
    27.7 +
    27.8  #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
    27.9 +/* Try to find out if we're compiling for WinRT or non-WinRT */
   27.10 +#if defined(_MSC_VER) && (_MSC_VER >= 1700)	/* _MSC_VER==1700 for MSVC 2012 */
   27.11 +#include <winapifamily.h>
   27.12 +#endif /* _MSC_VER >= 1700 */
   27.13 +/* Default to classic, Win32/Win64/Desktop compilation either if:
   27.14 +     1. the version of Windows is explicity set to a 'Desktop' (non-Metro) app
   27.15 +     2. the version of Windows cannot be determined via winapifamily.h
   27.16 +   If neither is true, then see if we're compiling for WinRT.
   27.17 + */
   27.18 +#if ! defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
   27.19  #undef __WINDOWS__
   27.20  #define __WINDOWS__   1
   27.21 -#endif
   27.22 +/* See if we're compiling for WinRT: */
   27.23 +#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
   27.24 +#undef __WINRT__
   27.25 +#define __WINRT__ 1
   27.26 +#endif /* ! defined(WINAPI_FAMILY_PARTITION) */
   27.27 +#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
   27.28 +
   27.29  #if defined(__WINDOWS__)
   27.30  #undef __WIN32__
   27.31  #define __WIN32__ 1
    28.1 --- a/include/SDL_stdinc.h	Sun Mar 09 10:38:30 2014 -0700
    28.2 +++ b/include/SDL_stdinc.h	Sun Mar 09 11:36:47 2014 -0700
    28.3 @@ -71,8 +71,18 @@
    28.4  # include <ctype.h>
    28.5  #endif
    28.6  #ifdef HAVE_MATH_H
    28.7 +# if defined(__WINRT__)
    28.8 +/* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on
    28.9 +   WinRT.  See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
   28.10 +   for more information.
   28.11 +*/
   28.12 +#  define _USE_MATH_DEFINES
   28.13 +# endif
   28.14  # include <math.h>
   28.15  #endif
   28.16 +#ifdef HAVE_FLOAT_H
   28.17 +# include <float.h>
   28.18 +#endif
   28.19  #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
   28.20  # include <iconv.h>
   28.21  #endif
    29.1 --- a/include/SDL_system.h	Sun Mar 09 10:38:30 2014 -0700
    29.2 +++ b/include/SDL_system.h	Sun Mar 09 11:36:47 2014 -0700
    29.3 @@ -116,6 +116,70 @@
    29.4  
    29.5  #endif /* __ANDROID__ */
    29.6  
    29.7 +/* Platform specific functions for WinRT */
    29.8 +#if defined(__WINRT__) && __WINRT__
    29.9 +
   29.10 +/**
   29.11 + *  \brief WinRT / Windows Phone path types
   29.12 + */
   29.13 +typedef enum
   29.14 +{
   29.15 +    /** \brief The installed app's root directory.
   29.16 +        Files here are likely to be read-only. */
   29.17 +    SDL_WINRT_PATH_INSTALLED_LOCATION,
   29.18 +
   29.19 +    /** \brief The app's local data store.  Files may be written here */
   29.20 +    SDL_WINRT_PATH_LOCAL_FOLDER,
   29.21 +
   29.22 +    /** \brief The app's roaming data store.  Unsupported on Windows Phone.
   29.23 +        Files written here may be copied to other machines via a network
   29.24 +        connection.
   29.25 +    */
   29.26 +    SDL_WINRT_PATH_ROAMING_FOLDER,
   29.27 +
   29.28 +    /** \brief The app's temporary data store.  Unsupported on Windows Phone.
   29.29 +        Files written here may be deleted at any time. */
   29.30 +    SDL_WINRT_PATH_TEMP_FOLDER
   29.31 +} SDL_WinRT_Path;
   29.32 +
   29.33 +
   29.34 +/**
   29.35 + *  \brief Retrieves a WinRT defined path on the local file system
   29.36 + *
   29.37 + *  \note Documentation on most app-specific path types on WinRT
   29.38 + *      can be found on MSDN, at the URL:
   29.39 + *      http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
   29.40 + *
   29.41 + *  \param pathType The type of path to retrieve.
   29.42 + *  \ret A UCS-2 string (16-bit, wide-char) containing the path, or NULL
   29.43 + *      if the path is not available for any reason.  Not all paths are
   29.44 + *      available on all versions of Windows.  This is especially true on
   29.45 + *      Windows Phone.  Check the documentation for the given
   29.46 + *      SDL_WinRT_Path for more information on which path types are
   29.47 + *      supported where.
   29.48 + */
   29.49 +extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
   29.50 +
   29.51 +/**
   29.52 + *  \brief Retrieves a WinRT defined path on the local file system
   29.53 + *
   29.54 + *  \note Documentation on most app-specific path types on WinRT
   29.55 + *      can be found on MSDN, at the URL:
   29.56 + *      http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
   29.57 + *
   29.58 + *  \param pathType The type of path to retrieve.
   29.59 + *  \ret A UTF-8 string (8-bit, multi-byte) containing the path, or NULL
   29.60 + *      if the path is not available for any reason.  Not all paths are
   29.61 + *      available on all versions of Windows.  This is especially true on
   29.62 + *      Windows Phone.  Check the documentation for the given
   29.63 + *      SDL_WinRT_Path for more information on which path types are
   29.64 + *      supported where.
   29.65 + */
   29.66 +extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
   29.67 +
   29.68 +#endif /* __WINRT__ */
   29.69 +
   29.70 +
   29.71  /* Ends C function definitions when using C++ */
   29.72  #ifdef __cplusplus
   29.73  }
    30.1 --- a/include/SDL_syswm.h	Sun Mar 09 10:38:30 2014 -0700
    30.2 +++ b/include/SDL_syswm.h	Sun Mar 09 11:36:47 2014 -0700
    30.3 @@ -56,6 +56,10 @@
    30.4  #include <windows.h>
    30.5  #endif
    30.6  
    30.7 +#if defined(SDL_VIDEO_DRIVER_WINRT)
    30.8 +#include <Inspectable.h>
    30.9 +#endif
   30.10 +
   30.11  /* This is the structure for custom window manager events */
   30.12  #if defined(SDL_VIDEO_DRIVER_X11)
   30.13  #if defined(__APPLE__) && defined(__MACH__)
   30.14 @@ -90,6 +94,7 @@
   30.15  #include <UIKit/UIKit.h>
   30.16  #else
   30.17  typedef struct _UIWindow UIWindow;
   30.18 +typedef struct _UIViewController UIViewController;
   30.19  #endif
   30.20  #endif
   30.21  
   30.22 @@ -105,6 +110,7 @@
   30.23  {
   30.24      SDL_SYSWM_UNKNOWN,
   30.25      SDL_SYSWM_WINDOWS,
   30.26 +    SDL_SYSWM_WINRT,
   30.27      SDL_SYSWM_X11,
   30.28      SDL_SYSWM_DIRECTFB,
   30.29      SDL_SYSWM_COCOA,
   30.30 @@ -175,6 +181,12 @@
   30.31              HWND window;                /**< The window handle */
   30.32          } win;
   30.33  #endif
   30.34 +#if defined(SDL_VIDEO_DRIVER_WINRT)
   30.35 +        struct
   30.36 +        {
   30.37 +            IInspectable * window;      /**< The WinRT CoreWindow */
   30.38 +        } winrt;
   30.39 +#endif
   30.40  #if defined(SDL_VIDEO_DRIVER_X11)
   30.41          struct
   30.42          {
    31.1 --- a/include/begin_code.h	Sun Mar 09 10:38:30 2014 -0700
    31.2 +++ b/include/begin_code.h	Sun Mar 09 11:36:47 2014 -0700
    31.3 @@ -43,7 +43,7 @@
    31.4  
    31.5  /* Some compilers use a special export keyword */
    31.6  #ifndef DECLSPEC
    31.7 -# if defined(__WIN32__)
    31.8 +# if defined(__WIN32__) || defined(__WINRT__)
    31.9  #  ifdef __BORLANDC__
   31.10  #   ifdef BUILD_SDL
   31.11  #    define DECLSPEC
   31.12 @@ -66,7 +66,7 @@
   31.13  
   31.14  /* By default SDL uses the C calling convention */
   31.15  #ifndef SDLCALL
   31.16 -#if defined(__WIN32__) && !defined(__GNUC__)
   31.17 +#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
   31.18  #define SDLCALL __cdecl
   31.19  #else
   31.20  #define SDLCALL
    32.1 --- a/src/SDL_assert.c	Sun Mar 09 10:38:30 2014 -0700
    32.2 +++ b/src/SDL_assert.c	Sun Mar 09 11:36:47 2014 -0700
    32.3 @@ -39,8 +39,10 @@
    32.4  #else  /* fprintf, _exit(), etc. */
    32.5  #include <stdio.h>
    32.6  #include <stdlib.h>
    32.7 +#if ! defined(__WINRT__)
    32.8  #include <unistd.h>
    32.9  #endif
   32.10 +#endif
   32.11  
   32.12  static SDL_assert_state
   32.13  SDL_PromptAssertion(const SDL_assert_data *data, void *userdata);
    33.1 --- a/src/SDL_log.c	Sun Mar 09 10:38:30 2014 -0700
    33.2 +++ b/src/SDL_log.c	Sun Mar 09 11:36:47 2014 -0700
    33.3 @@ -20,7 +20,7 @@
    33.4  */
    33.5  #include "./SDL_internal.h"
    33.6  
    33.7 -#if defined(__WIN32__)
    33.8 +#if defined(__WIN32__) || defined(__WINRT__)
    33.9  #include "core/windows/SDL_windows.h"
   33.10  #endif
   33.11  
   33.12 @@ -318,13 +318,15 @@
   33.13  SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
   33.14                const char *message)
   33.15  {
   33.16 -#if defined(__WIN32__)
   33.17 +#if defined(__WIN32__) || defined(__WINRT__)
   33.18      /* Way too many allocations here, urgh */
   33.19      /* Note: One can't call SDL_SetError here, since that function itself logs. */
   33.20      {
   33.21          char *output;
   33.22          size_t length;
   33.23          LPTSTR tstr;
   33.24 +
   33.25 +#ifndef __WINRT__
   33.26          BOOL attachResult;
   33.27          DWORD attachError;
   33.28          unsigned long charsWritten; 
   33.29 @@ -356,6 +358,7 @@
   33.30                          stderrHandle = GetStdHandle(STD_ERROR_HANDLE);
   33.31                  }
   33.32          }
   33.33 +#endif /* ifndef __WINRT__ */
   33.34  
   33.35          length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1;
   33.36          output = SDL_stack_alloc(char, length);
   33.37 @@ -365,6 +368,7 @@
   33.38          /* Output to debugger */
   33.39          OutputDebugString(tstr);
   33.40         
   33.41 +#ifndef __WINRT__
   33.42          /* Screen output to stderr, if console was attached. */
   33.43          if (consoleAttached == 1) {
   33.44                  if (!WriteConsole(stderrHandle, tstr, lstrlen(tstr), &charsWritten, NULL)) {
   33.45 @@ -374,6 +378,7 @@
   33.46                      OutputDebugString(TEXT("Insufficient heap memory to write message\r\n"));
   33.47                  }
   33.48          }
   33.49 +#endif /* ifndef __WINRT__ */
   33.50  
   33.51          SDL_free(tstr);
   33.52          SDL_stack_free(output);
    34.1 --- a/src/atomic/SDL_spinlock.c	Sun Mar 09 10:38:30 2014 -0700
    34.2 +++ b/src/atomic/SDL_spinlock.c	Sun Mar 09 11:36:47 2014 -0700
    34.3 @@ -20,7 +20,7 @@
    34.4  */
    34.5  #include "../SDL_internal.h"
    34.6  
    34.7 -#ifdef __WIN32__
    34.8 +#if defined(__WIN32__) || defined(__WINRT__)
    34.9  #include "../core/windows/SDL_windows.h"
   34.10  #endif
   34.11  
    35.1 --- a/src/audio/xaudio2/SDL_xaudio2.c	Sun Mar 09 10:38:30 2014 -0700
    35.2 +++ b/src/audio/xaudio2/SDL_xaudio2.c	Sun Mar 09 11:36:47 2014 -0700
    35.3 @@ -18,6 +18,32 @@
    35.4       misrepresented as being the original software.
    35.5    3. This notice may not be removed or altered from any source distribution.
    35.6  */
    35.7 +
    35.8 +/* WinRT NOTICE:
    35.9 +
   35.10 +   A few changes to SDL's XAudio2 backend were warranted by API
   35.11 +   changes to Windows.  Many, but not all of these are documented by Microsoft
   35.12 +   at:
   35.13 +   http://blogs.msdn.com/b/chuckw/archive/2012/04/02/xaudio2-and-windows-8-consumer-preview.aspx
   35.14 +
   35.15 +   1. Windows' thread synchronization function, CreateSemaphore, was removed
   35.16 +      from WinRT.  SDL's semaphore API was substituted instead.
   35.17 +   2. The method calls, IXAudio2::GetDeviceCount and IXAudio2::GetDeviceDetails
   35.18 +      were removed from the XAudio2 API.  Microsoft is telling developers to
   35.19 +      use APIs in Windows::Foundation instead.
   35.20 +      For SDL, the missing methods were reimplemented using the APIs Microsoft
   35.21 +      said to use.
   35.22 +   3. CoInitialize and CoUninitialize are not available in WinRT.
   35.23 +      These calls were removed, as COM will have been initialized earlier,
   35.24 +      at least by the call to the WinRT app's main function
   35.25 +      (aka 'int main(Platform::Array<Platform::String^>^)).  (DLudwig:
   35.26 +      This was my understanding of how WinRT: the 'main' function uses
   35.27 +      a tag of [MTAThread], which should initialize COM.  My understanding
   35.28 +      of COM is somewhat limited, and I may be incorrect here.)
   35.29 +   4. IXAudio2::CreateMasteringVoice changed its integer-based 'DeviceIndex'
   35.30 +      argument to a string-based one, 'szDeviceId'.  In WinRT, the
   35.31 +      string-based argument will be used.
   35.32 +*/
   35.33  #include "../../SDL_internal.h"
   35.34  
   35.35  #if SDL_AUDIO_DRIVER_XAUDIO2
   35.36 @@ -31,6 +57,9 @@
   35.37  #ifdef __GNUC__
   35.38  /* The configure script already did any necessary checking */
   35.39  #  define SDL_XAUDIO2_HAS_SDK 1
   35.40 +#elif defined(__WINRT__)
   35.41 +/* WinRT always has access to the .the XAudio 2 SDK */
   35.42 +#  define SDL_XAUDIO2_HAS_SDK
   35.43  #else
   35.44  /* XAudio2 exists as of the March 2008 DirectX SDK 
   35.45     The XAudio2 implementation available in the Windows 8 SDK targets Windows 8 and newer.
   35.46 @@ -42,16 +71,36 @@
   35.47  #else
   35.48  #  define SDL_XAUDIO2_HAS_SDK 1
   35.49  #endif
   35.50 -#endif /* __GNUC__ */
   35.51 +#endif
   35.52  
   35.53  #ifdef SDL_XAUDIO2_HAS_SDK
   35.54  
   35.55 +/* Check to see if we're compiling for XAudio 2.8, or higher. */
   35.56 +#ifdef WINVER
   35.57 +#if WINVER >= 0x0602  /* Windows 8 SDK or higher? */
   35.58 +#define SDL_XAUDIO2_WIN8 1
   35.59 +#endif
   35.60 +#endif
   35.61 +
   35.62 +/* The XAudio header file, when #include'd on WinRT, will only compile in C++
   35.63 +   files, but not C.  A few preprocessor-based hacks are defined below in order
   35.64 +   to get xaudio2.h to compile in the C/non-C++ file, SDL_xaudio2.c.
   35.65 + */
   35.66 +#ifdef __WINRT__
   35.67 +#define uuid(x)
   35.68 +#define DX_BUILD
   35.69 +#endif
   35.70 +
   35.71  #define INITGUID 1
   35.72  #include <xaudio2.h>
   35.73  
   35.74  /* Hidden "this" pointer for the audio functions */
   35.75  #define _THIS   SDL_AudioDevice *this
   35.76  
   35.77 +#ifdef __WINRT__
   35.78 +#include "SDL_xaudio2_winrthelpers.h"
   35.79 +#endif
   35.80 +
   35.81  /* Fixes bug 1210 where some versions of gcc need named parameters */
   35.82  #ifdef __GNUC__
   35.83  #ifdef THIS
   35.84 @@ -69,7 +118,7 @@
   35.85      IXAudio2 *ixa2;
   35.86      IXAudio2SourceVoice *source;
   35.87      IXAudio2MasteringVoice *mastering;
   35.88 -    HANDLE semaphore;
   35.89 +    SDL_sem * semaphore;
   35.90      Uint8 *mixbuf;
   35.91      int mixlen;
   35.92      Uint8 *nextbuf;
   35.93 @@ -114,7 +163,7 @@
   35.94  {
   35.95      /* Just signal the SDL audio thread and get out of XAudio2's way. */
   35.96      SDL_AudioDevice *this = (SDL_AudioDevice *) data;
   35.97 -    ReleaseSemaphore(this->hidden->semaphore, 1, NULL);
   35.98 +    SDL_SemPost(this->hidden->semaphore);
   35.99  }
  35.100  
  35.101  static void STDMETHODCALLTYPE
  35.102 @@ -180,7 +229,7 @@
  35.103  XAUDIO2_WaitDevice(_THIS)
  35.104  {
  35.105      if (this->enabled) {
  35.106 -        WaitForSingleObject(this->hidden->semaphore, INFINITE);
  35.107 +        SDL_SemWait(this->hidden->semaphore);
  35.108      }
  35.109  }
  35.110  
  35.111 @@ -191,10 +240,18 @@
  35.112      XAUDIO2_VOICE_STATE state;
  35.113      SDL_assert(!this->enabled);  /* flag that stops playing. */
  35.114      IXAudio2SourceVoice_Discontinuity(source);
  35.115 +#if SDL_XAUDIO2_WIN8
  35.116 +    IXAudio2SourceVoice_GetState(source, &state, 0);
  35.117 +#else
  35.118      IXAudio2SourceVoice_GetState(source, &state);
  35.119 +#endif
  35.120      while (state.BuffersQueued > 0) {
  35.121 -        WaitForSingleObject(this->hidden->semaphore, INFINITE);
  35.122 +        SDL_SemWait(this->hidden->semaphore);
  35.123 +#if SDL_XAUDIO2_WIN8
  35.124 +        IXAudio2SourceVoice_GetState(source, &state, 0);
  35.125 +#else
  35.126          IXAudio2SourceVoice_GetState(source, &state);
  35.127 +#endif
  35.128      }
  35.129  }
  35.130  
  35.131 @@ -223,7 +280,7 @@
  35.132          }
  35.133          SDL_free(this->hidden->mixbuf);
  35.134          if (this->hidden->semaphore != NULL) {
  35.135 -            CloseHandle(this->hidden->semaphore);
  35.136 +            SDL_DestroySemaphore(this->hidden->semaphore);
  35.137          }
  35.138  
  35.139          SDL_free(this->hidden);
  35.140 @@ -240,7 +297,11 @@
  35.141      SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
  35.142      IXAudio2 *ixa2 = NULL;
  35.143      IXAudio2SourceVoice *source = NULL;
  35.144 +#if defined(SDL_XAUDIO2_WIN8)
  35.145 +    LPCWSTR devId = NULL;
  35.146 +#else
  35.147      UINT32 devId = 0;  /* 0 == system default device. */
  35.148 +#endif
  35.149  
  35.150      static IXAudio2VoiceCallbackVtbl callbacks_vtable = {
  35.151          VoiceCBOnVoiceProcessPassStart,
  35.152 @@ -260,6 +321,18 @@
  35.153          return SDL_SetError("XAudio2: XAudio2Create() failed at open.");
  35.154      }
  35.155  
  35.156 +    /*
  35.157 +    XAUDIO2_DEBUG_CONFIGURATION debugConfig;
  35.158 +    debugConfig.TraceMask = XAUDIO2_LOG_ERRORS; //XAUDIO2_LOG_WARNINGS | XAUDIO2_LOG_DETAIL | XAUDIO2_LOG_FUNC_CALLS | XAUDIO2_LOG_TIMING | XAUDIO2_LOG_LOCKS | XAUDIO2_LOG_MEMORY | XAUDIO2_LOG_STREAMING;
  35.159 +    debugConfig.BreakMask = XAUDIO2_LOG_ERRORS; //XAUDIO2_LOG_WARNINGS;
  35.160 +    debugConfig.LogThreadID = TRUE;
  35.161 +    debugConfig.LogFileline = TRUE;
  35.162 +    debugConfig.LogFunctionName = TRUE;
  35.163 +    debugConfig.LogTiming = TRUE;
  35.164 +    ixa2->SetDebugConfiguration(&debugConfig);
  35.165 +    */
  35.166 +
  35.167 +#if ! defined(__WINRT__)
  35.168      if (devname != NULL) {
  35.169          UINT32 devcount = 0;
  35.170          UINT32 i = 0;
  35.171 @@ -288,6 +361,7 @@
  35.172              return SDL_SetError("XAudio2: Requested device not found.");
  35.173          }
  35.174      }
  35.175 +#endif
  35.176  
  35.177      /* Initialize all variables that we clean on shutdown */
  35.178      this->hidden = (struct SDL_PrivateAudioData *)
  35.179 @@ -299,7 +373,7 @@
  35.180      SDL_memset(this->hidden, 0, (sizeof *this->hidden));
  35.181  
  35.182      this->hidden->ixa2 = ixa2;
  35.183 -    this->hidden->semaphore = CreateSemaphore(NULL, 1, 2, NULL);
  35.184 +    this->hidden->semaphore = SDL_CreateSemaphore(1);
  35.185      if (this->hidden->semaphore == NULL) {
  35.186          XAUDIO2_CloseDevice(this);
  35.187          return SDL_SetError("XAudio2: CreateSemaphore() failed!");
  35.188 @@ -342,9 +416,15 @@
  35.189         stereo output to appropriate surround sound configurations
  35.190         instead of clamping to 2 channels, even though we'll configure the
  35.191         Source Voice for whatever number of channels you supply. */
  35.192 +#if SDL_XAUDIO2_WIN8
  35.193 +    result = IXAudio2_CreateMasteringVoice(ixa2, &this->hidden->mastering,
  35.194 +                                           XAUDIO2_DEFAULT_CHANNELS,
  35.195 +                                           this->spec.freq, 0, devId, NULL, AudioCategory_GameEffects);
  35.196 +#else
  35.197      result = IXAudio2_CreateMasteringVoice(ixa2, &this->hidden->mastering,
  35.198                                             XAUDIO2_DEFAULT_CHANNELS,
  35.199                                             this->spec.freq, 0, devId, NULL);
  35.200 +#endif
  35.201      if (result != S_OK) {
  35.202          XAUDIO2_CloseDevice(this);
  35.203          return SDL_SetError("XAudio2: Couldn't create mastering voice");
  35.204 @@ -363,11 +443,23 @@
  35.205          waveformat.nChannels * (waveformat.wBitsPerSample / 8);
  35.206      waveformat.nAvgBytesPerSec =
  35.207          waveformat.nSamplesPerSec * waveformat.nBlockAlign;
  35.208 +    waveformat.cbSize = sizeof(waveformat);
  35.209  
  35.210 +#ifdef __WINRT__
  35.211 +    // DLudwig: for now, make XAudio2 do sample rate conversion, just to
  35.212 +    // get the loopwave test to work.
  35.213 +    //
  35.214 +    // TODO, WinRT: consider removing WinRT-specific source-voice creation code from SDL_xaudio2.c
  35.215 +    result = IXAudio2_CreateSourceVoice(ixa2, &source, &waveformat,
  35.216 +                                        0,
  35.217 +                                        1.0f, &callbacks, NULL, NULL);
  35.218 +#else
  35.219      result = IXAudio2_CreateSourceVoice(ixa2, &source, &waveformat,
  35.220                                          XAUDIO2_VOICE_NOSRC |
  35.221                                          XAUDIO2_VOICE_NOPITCH,
  35.222                                          1.0f, &callbacks, NULL, NULL);
  35.223 +
  35.224 +#endif
  35.225      if (result != S_OK) {
  35.226          XAUDIO2_CloseDevice(this);
  35.227          return SDL_SetError("XAudio2: Couldn't create source voice");
  35.228 @@ -393,7 +485,9 @@
  35.229  static void
  35.230  XAUDIO2_Deinitialize(void)
  35.231  {
  35.232 +#if defined(__WIN32__)
  35.233      WIN_CoUninitialize();
  35.234 +#endif
  35.235  }
  35.236  
  35.237  #endif  /* SDL_XAUDIO2_HAS_SDK */
  35.238 @@ -408,13 +502,18 @@
  35.239  #else
  35.240      /* XAudio2Create() is a macro that uses COM; we don't load the .dll */
  35.241      IXAudio2 *ixa2 = NULL;
  35.242 +#if defined(__WIN32__)
  35.243 +    // TODO, WinRT: Investigate using CoInitializeEx here
  35.244      if (FAILED(WIN_CoInitialize())) {
  35.245          SDL_SetError("XAudio2: CoInitialize() failed");
  35.246          return 0;
  35.247      }
  35.248 +#endif
  35.249  
  35.250      if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) {
  35.251 +#if defined(__WIN32__)
  35.252          WIN_CoUninitialize();
  35.253 +#endif
  35.254          SDL_SetError("XAudio2: XAudio2Create() failed at initialization");
  35.255          return 0;  /* not available. */
  35.256      }
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp	Sun Mar 09 11:36:47 2014 -0700
    36.3 @@ -0,0 +1,69 @@
    36.4 +
    36.5 +#include <xaudio2.h>
    36.6 +#include "SDL_xaudio2_winrthelpers.h"
    36.7 +
    36.8 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
    36.9 +using Windows::Devices::Enumeration::DeviceClass;
   36.10 +using Windows::Devices::Enumeration::DeviceInformation;
   36.11 +using Windows::Devices::Enumeration::DeviceInformationCollection;
   36.12 +#endif
   36.13 +
   36.14 +extern "C" HRESULT __cdecl IXAudio2_GetDeviceCount(IXAudio2 * ixa2, UINT32 * devcount)
   36.15 +{
   36.16 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
   36.17 +    // There doesn't seem to be any audio device enumeration on Windows Phone.
   36.18 +    // In lieu of this, just treat things as if there is one and only one
   36.19 +    // audio device.
   36.20 +    *devcount = 1;
   36.21 +    return S_OK;
   36.22 +#else
   36.23 +    // TODO, WinRT: make xaudio2 device enumeration only happen once, and in the background
   36.24 +    auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender);
   36.25 +    while (operation->Status != Windows::Foundation::AsyncStatus::Completed)
   36.26 +    {
   36.27 +    }
   36.28 + 
   36.29 +    DeviceInformationCollection^ devices = operation->GetResults();
   36.30 +    *devcount = devices->Size;
   36.31 +    return S_OK;
   36.32 +#endif
   36.33 +}
   36.34 +
   36.35 +extern "C" HRESULT IXAudio2_GetDeviceDetails(IXAudio2 * unused, UINT32 index, XAUDIO2_DEVICE_DETAILS * details)
   36.36 +{
   36.37 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
   36.38 +    // Windows Phone doesn't seem to have the same device enumeration APIs that
   36.39 +    // Windows 8/RT has, or it doesn't have them at all.  In lieu of this,
   36.40 +    // just treat things as if there is one, and only one, default device.
   36.41 +    if (index != 0)
   36.42 +    {
   36.43 +        return XAUDIO2_E_INVALID_CALL;
   36.44 +    }
   36.45 +
   36.46 +    if (details)
   36.47 +    {
   36.48 +        wcsncpy_s(details->DeviceID, ARRAYSIZE(details->DeviceID), L"default", _TRUNCATE);
   36.49 +        wcsncpy_s(details->DisplayName, ARRAYSIZE(details->DisplayName), L"default", _TRUNCATE);
   36.50 +    }
   36.51 +    return S_OK;
   36.52 +#else
   36.53 +    auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender);
   36.54 +    while (operation->Status != Windows::Foundation::AsyncStatus::Completed)
   36.55 +    {
   36.56 +    }
   36.57 + 
   36.58 +    DeviceInformationCollection^ devices = operation->GetResults();
   36.59 +    if (index >= devices->Size)
   36.60 +    {
   36.61 +        return XAUDIO2_E_INVALID_CALL;
   36.62 +    }
   36.63 +
   36.64 +    DeviceInformation^ d = devices->GetAt(index);
   36.65 +    if (details)
   36.66 +    {
   36.67 +        wcsncpy_s(details->DeviceID, ARRAYSIZE(details->DeviceID), d->Id->Data(), _TRUNCATE);
   36.68 +        wcsncpy_s(details->DisplayName, ARRAYSIZE(details->DisplayName), d->Name->Data(), _TRUNCATE);
   36.69 +    }
   36.70 +    return S_OK;
   36.71 +#endif
   36.72 +}
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h	Sun Mar 09 11:36:47 2014 -0700
    37.3 @@ -0,0 +1,52 @@
    37.4 +
    37.5 +#pragma once
    37.6 +
    37.7 +//
    37.8 +// Re-implementation of methods removed from XAudio2 (in WinRT):
    37.9 +//
   37.10 +
   37.11 +typedef struct XAUDIO2_DEVICE_DETAILS
   37.12 +{
   37.13 +    WCHAR DeviceID[256];
   37.14 +    WCHAR DisplayName[256];
   37.15 +    /* Other fields exist in the pre-Windows 8 version of this struct, however
   37.16 +       they weren't used by SDL, so they weren't added.
   37.17 +    */
   37.18 +} XAUDIO2_DEVICE_DETAILS;
   37.19 +
   37.20 +
   37.21 +#ifdef __cplusplus
   37.22 +extern "C" {
   37.23 +#endif
   37.24 +
   37.25 +HRESULT IXAudio2_GetDeviceCount(IXAudio2 * unused, UINT32 * devcount);
   37.26 +HRESULT IXAudio2_GetDeviceDetails(IXAudio2 * unused, UINT32 index, XAUDIO2_DEVICE_DETAILS * details);
   37.27 +
   37.28 +#ifdef __cplusplus
   37.29 +}
   37.30 +#endif
   37.31 +
   37.32 +
   37.33 +//
   37.34 +// C-style macros to call XAudio2's methods in C++:
   37.35 +//
   37.36 +#ifdef __cplusplus
   37.37 +/*
   37.38 +#define IXAudio2_CreateMasteringVoice(A, B, C, D, E, F, G) (A)->CreateMasteringVoice((B), (C), (D), (E), (F), (G))
   37.39 +#define IXAudio2_CreateSourceVoice(A, B, C, D, E, F, G, H) (A)->CreateSourceVoice((B), (C), (D), (E), (F), (G), (H))
   37.40 +#define IXAudio2_QueryInterface(A, B, C) (A)->QueryInterface((B), (C))
   37.41 +#define IXAudio2_Release(A) (A)->Release()
   37.42 +#define IXAudio2_StartEngine(A) (A)->StartEngine()
   37.43 +#define IXAudio2_StopEngine(A) (A)->StopEngine()
   37.44 +
   37.45 +#define IXAudio2MasteringVoice_DestroyVoice(A) (A)->DestroyVoice()
   37.46 +
   37.47 +#define IXAudio2SourceVoice_DestroyVoice(A) (A)->DestroyVoice()
   37.48 +#define IXAudio2SourceVoice_Discontinuity(A) (A)->Discontinuity()
   37.49 +#define IXAudio2SourceVoice_FlushSourceBuffers(A) (A)->FlushSourceBuffers()
   37.50 +#define IXAudio2SourceVoice_GetState(A, B) (A)->GetState((B))
   37.51 +#define IXAudio2SourceVoice_Start(A, B, C) (A)->Start((B), (C))
   37.52 +#define IXAudio2SourceVoice_Stop(A, B, C) (A)->Stop((B), (C))
   37.53 +#define IXAudio2SourceVoice_SubmitSourceBuffer(A, B, C) (A)->SubmitSourceBuffer((B), (C))
   37.54 +*/
   37.55 +#endif // ifdef __cplusplus
    38.1 --- a/src/core/windows/SDL_windows.c	Sun Mar 09 10:38:30 2014 -0700
    38.2 +++ b/src/core/windows/SDL_windows.c	Sun Mar 09 11:36:47 2014 -0700
    38.3 @@ -20,26 +20,33 @@
    38.4  */
    38.5  #include "../../SDL_internal.h"
    38.6  
    38.7 -#ifdef __WIN32__
    38.8 +#if defined(__WIN32__) || defined(__WINRT__)
    38.9  
   38.10  #include "SDL_windows.h"
   38.11  #include "SDL_error.h"
   38.12  #include "SDL_assert.h"
   38.13  
   38.14 -#include <objbase.h>  /* for CoInitialize/CoUninitialize */
   38.15 +#include <objbase.h>  /* for CoInitialize/CoUninitialize (Win32 only) */
   38.16 +
   38.17 +/* Sets an error message based on GetLastError() */
   38.18 +int
   38.19 +WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr)
   38.20 +{
   38.21 +    TCHAR buffer[1024];
   38.22 +    char *message;
   38.23 +    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, 0,
   38.24 +                  buffer, SDL_arraysize(buffer), NULL);
   38.25 +    message = WIN_StringToUTF8(buffer);
   38.26 +    SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message);
   38.27 +    SDL_free(message);
   38.28 +    return -1;
   38.29 +}
   38.30  
   38.31  /* Sets an error message based on GetLastError() */
   38.32  int
   38.33  WIN_SetError(const char *prefix)
   38.34  {
   38.35 -    TCHAR buffer[1024];
   38.36 -    char *message;
   38.37 -    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
   38.38 -                  buffer, SDL_arraysize(buffer), NULL);
   38.39 -    message = WIN_StringToUTF8(buffer);
   38.40 -    SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message);
   38.41 -    SDL_free(message);
   38.42 -    return -1;
   38.43 +    return WIN_SetErrorFromHRESULT(prefix, GetLastError());
   38.44  }
   38.45  
   38.46  HRESULT
   38.47 @@ -50,6 +57,14 @@
   38.48  
   38.49         If you need multi-threaded mode, call CoInitializeEx() before SDL_Init()
   38.50      */
   38.51 +#ifdef __WINRT__
   38.52 +    /* DLudwig: On WinRT, it is assumed that COM was initialized in main().
   38.53 +       CoInitializeEx is available (not CoInitialize though), however
   38.54 +       on WinRT, main() is typically declared with the [MTAThread]
   38.55 +       attribute, which, AFAIK, should initialize COM.
   38.56 +    */
   38.57 +    return S_OK;
   38.58 +#else
   38.59      HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
   38.60      if (hr == RPC_E_CHANGED_MODE) {
   38.61          hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
   38.62 @@ -62,12 +77,15 @@
   38.63      }
   38.64  
   38.65      return hr;
   38.66 +#endif
   38.67  }
   38.68  
   38.69  void
   38.70  WIN_CoUninitialize(void)
   38.71  {
   38.72 +#ifndef __WINRT__
   38.73      CoUninitialize();
   38.74 +#endif
   38.75  }
   38.76  
   38.77  #endif /* __WIN32__ */
    39.1 --- a/src/core/windows/SDL_windows.h	Sun Mar 09 10:38:30 2014 -0700
    39.2 +++ b/src/core/windows/SDL_windows.h	Sun Mar 09 11:36:47 2014 -0700
    39.3 @@ -24,6 +24,7 @@
    39.4  #ifndef _INCLUDED_WINDOWS_H
    39.5  #define _INCLUDED_WINDOWS_H
    39.6  
    39.7 +#if defined(__WIN32__)
    39.8  #define WIN32_LEAN_AND_MEAN
    39.9  #define STRICT
   39.10  #ifndef UNICODE
   39.11 @@ -31,6 +32,7 @@
   39.12  #endif
   39.13  #undef _WIN32_WINNT
   39.14  #define _WIN32_WINNT  0x501   /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input */
   39.15 +#endif
   39.16  
   39.17  #include <windows.h>
   39.18  
   39.19 @@ -44,6 +46,9 @@
   39.20  #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)(S), SDL_strlen(S)+1)
   39.21  #endif
   39.22  
   39.23 +/* Sets an error message based on a given HRESULT */
   39.24 +extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr);
   39.25 +
   39.26  /* Sets an error message based on GetLastError(). Always return -1. */
   39.27  extern int WIN_SetError(const char *prefix);
   39.28  
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/src/core/winrt/SDL_winrtapp_common.cpp	Sun Mar 09 11:36:47 2014 -0700
    40.3 @@ -0,0 +1,16 @@
    40.4 +
    40.5 +#include <SDL_system.h>
    40.6 +#include "SDL_winrtapp_direct3d.h"
    40.7 +#include "SDL_winrtapp_xaml.h"
    40.8 +
    40.9 +int (*WINRT_SDLAppEntryPoint)(int, char **) = NULL;
   40.10 +
   40.11 +extern "C" DECLSPEC int
   40.12 +SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel)
   40.13 +{
   40.14 +    if (xamlBackgroundPanel) {
   40.15 +        return SDL_WinRTInitXAMLApp(mainFunction, xamlBackgroundPanel);
   40.16 +    } else {
   40.17 +        return SDL_WinRTInitNonXAMLApp(mainFunction);
   40.18 +    }
   40.19 +}
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/src/core/winrt/SDL_winrtapp_common.h	Sun Mar 09 11:36:47 2014 -0700
    41.3 @@ -0,0 +1,31 @@
    41.4 +/*
    41.5 +  Simple DirectMedia Layer
    41.6 +  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
    41.7 +
    41.8 +  This software is provided 'as-is', without any express or implied
    41.9 +  warranty.  In no event will the authors be held liable for any damages
   41.10 +  arising from the use of this software.
   41.11 +
   41.12 +  Permission is granted to anyone to use this software for any purpose,
   41.13 +  including commercial applications, and to alter it and redistribute it
   41.14 +  freely, subject to the following restrictions:
   41.15 +
   41.16 +  1. The origin of this software must not be misrepresented; you must not
   41.17 +     claim that you wrote the original software. If you use this software
   41.18 +     in a product, an acknowledgment in the product documentation would be
   41.19 +     appreciated but is not required.
   41.20 +  2. Altered source versions must be plainly marked as such, and must not be
   41.21 +     misrepresented as being the original software.
   41.22 +  3. This notice may not be removed or altered from any source distribution.
   41.23 +*/
   41.24 +#include "SDL_config.h"
   41.25 +
   41.26 +#ifndef _SDL_winrtapp_common_h
   41.27 +#define _SDL_winrtapp_common_h
   41.28 +
   41.29 +/* A pointer to the app's C-style main() function (which is a different
   41.30 +   function than the WinRT app's actual entry point).
   41.31 + */
   41.32 +extern int (*WINRT_SDLAppEntryPoint)(int, char **);
   41.33 +
   41.34 +#endif // ifndef _SDL_winrtapp_common_h
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp	Sun Mar 09 11:36:47 2014 -0700
    42.3 @@ -0,0 +1,668 @@
    42.4 +
    42.5 +/* Standard C++11 includes */
    42.6 +#include <functional>
    42.7 +#include <string>
    42.8 +#include <sstream>
    42.9 +using namespace std;
   42.10 +
   42.11 +
   42.12 +/* Windows includes */
   42.13 +#include "ppltasks.h"
   42.14 +using namespace concurrency;
   42.15 +using namespace Windows::ApplicationModel;
   42.16 +using namespace Windows::ApplicationModel::Core;
   42.17 +using namespace Windows::ApplicationModel::Activation;
   42.18 +using namespace Windows::Devices::Input;
   42.19 +using namespace Windows::Graphics::Display;
   42.20 +using namespace Windows::Foundation;
   42.21 +using namespace Windows::System;
   42.22 +using namespace Windows::UI::Core;
   42.23 +using namespace Windows::UI::Input;
   42.24 +
   42.25 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
   42.26 +using namespace Windows::Phone::UI::Input;
   42.27 +#endif
   42.28 +
   42.29 +
   42.30 +/* SDL includes */
   42.31 +extern "C" {
   42.32 +#include "SDL_assert.h"
   42.33 +#include "SDL_events.h"
   42.34 +#include "SDL_hints.h"
   42.35 +#include "SDL_log.h"
   42.36 +#include "SDL_main.h"
   42.37 +#include "SDL_stdinc.h"
   42.38 +#include "SDL_render.h"
   42.39 +#include "../../video/SDL_sysvideo.h"
   42.40 +//#include "../../SDL_hints_c.h"
   42.41 +#include "../../events/SDL_events_c.h"
   42.42 +#include "../../events/SDL_keyboard_c.h"
   42.43 +#include "../../events/SDL_mouse_c.h"
   42.44 +#include "../../events/SDL_windowevents_c.h"
   42.45 +#include "../../render/SDL_sysrender.h"
   42.46 +#include "../windows/SDL_windows.h"
   42.47 +}
   42.48 +
   42.49 +#include "../../video/winrt/SDL_winrtevents_c.h"
   42.50 +#include "../../video/winrt/SDL_winrtvideo_cpp.h"
   42.51 +#include "SDL_winrtapp_common.h"
   42.52 +#include "SDL_winrtapp_direct3d.h"
   42.53 +
   42.54 +
   42.55 +// Compile-time debugging options:
   42.56 +// To enable, uncomment; to disable, comment them out.
   42.57 +//#define LOG_POINTER_EVENTS 1
   42.58 +//#define LOG_WINDOW_EVENTS 1
   42.59 +//#define LOG_ORIENTATION_EVENTS 1
   42.60 +
   42.61 +
   42.62 +// HACK, DLudwig: record a reference to the global, WinRT 'app'/view.
   42.63 +// SDL/WinRT will use this throughout its code.
   42.64 +//
   42.65 +// TODO, WinRT: consider replacing SDL_WinRTGlobalApp with something
   42.66 +// non-global, such as something created inside
   42.67 +// SDL_InitSubSystem(SDL_INIT_VIDEO), or something inside
   42.68 +// SDL_CreateWindow().
   42.69 +SDL_WinRTApp ^ SDL_WinRTGlobalApp = nullptr;
   42.70 +
   42.71 +ref class SDLApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
   42.72 +{
   42.73 +public:
   42.74 +    virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
   42.75 +};
   42.76 +
   42.77 +IFrameworkView^ SDLApplicationSource::CreateView()
   42.78 +{
   42.79 +    // TODO, WinRT: see if this function (CreateView) can ever get called
   42.80 +    // more than once.  For now, just prevent it from ever assigning
   42.81 +    // SDL_WinRTGlobalApp more than once.
   42.82 +    SDL_assert(!SDL_WinRTGlobalApp);
   42.83 +    SDL_WinRTApp ^ app = ref new SDL_WinRTApp();
   42.84 +    if (!SDL_WinRTGlobalApp)
   42.85 +    {
   42.86 +        SDL_WinRTGlobalApp = app;
   42.87 +    }
   42.88 +    return app;
   42.89 +}
   42.90 +
   42.91 +int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **))
   42.92 +{
   42.93 +    WINRT_SDLAppEntryPoint = mainFunction;
   42.94 +    auto direct3DApplicationSource = ref new SDLApplicationSource();
   42.95 +    CoreApplication::Run(direct3DApplicationSource);
   42.96 +    return 0;
   42.97 +}
   42.98 +
   42.99 +static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue)
  42.100 +{
  42.101 +    SDL_assert(SDL_strcmp(name, SDL_HINT_ORIENTATIONS) == 0);
  42.102 +
  42.103 +    // Start with no orientation flags, then add each in as they're parsed
  42.104 +    // from newValue.
  42.105 +    unsigned int orientationFlags = 0;
  42.106 +    if (newValue) {
  42.107 +        std::istringstream tokenizer(newValue);
  42.108 +        while (!tokenizer.eof()) {
  42.109 +            std::string orientationName;
  42.110 +            std::getline(tokenizer, orientationName, ' ');
  42.111 +            if (orientationName == "LandscapeLeft") {
  42.112 +                orientationFlags |= (unsigned int) DisplayOrientations::LandscapeFlipped;
  42.113 +            } else if (orientationName == "LandscapeRight") {
  42.114 +                orientationFlags |= (unsigned int) DisplayOrientations::Landscape;
  42.115 +            } else if (orientationName == "Portrait") {
  42.116 +                orientationFlags |= (unsigned int) DisplayOrientations::Portrait;
  42.117 +            } else if (orientationName == "PortraitUpsideDown") {
  42.118 +                orientationFlags |= (unsigned int) DisplayOrientations::PortraitFlipped;
  42.119 +            }
  42.120 +        }
  42.121 +    }
  42.122 +
  42.123 +    // If no valid orientation flags were specified, use a reasonable set of defaults:
  42.124 +    if (!orientationFlags) {
  42.125 +        // TODO, WinRT: consider seeing if an app's default orientation flags can be found out via some API call(s).
  42.126 +        orientationFlags = (unsigned int) ( \
  42.127 +            DisplayOrientations::Landscape |
  42.128 +            DisplayOrientations::LandscapeFlipped |
  42.129 +            DisplayOrientations::Portrait |
  42.130 +            DisplayOrientations::PortraitFlipped);
  42.131 +    }
  42.132 +
  42.133 +    // Set the orientation/rotation preferences.  Please note that this does
  42.134 +    // not constitute a 100%-certain lock of a given set of possible
  42.135 +    // orientations.  According to Microsoft's documentation on WinRT [1]
  42.136 +    // when a device is not capable of being rotated, Windows may ignore
  42.137 +    // the orientation preferences, and stick to what the device is capable of
  42.138 +    // displaying.
  42.139 +    //
  42.140 +    // [1] Documentation on the 'InitialRotationPreference' setting for a
  42.141 +    // Windows app's manifest file describes how some orientation/rotation
  42.142 +    // preferences may be ignored.  See
  42.143 +    // http://msdn.microsoft.com/en-us/library/windows/apps/hh700343.aspx
  42.144 +    // for details.  Microsoft's "Display orientation sample" also gives an
  42.145 +    // outline of how Windows treats device rotation
  42.146 +    // (http://code.msdn.microsoft.com/Display-Orientation-Sample-19a58e93).
  42.147 +    DisplayProperties::AutoRotationPreferences = (DisplayOrientations) orientationFlags;
  42.148 +}
  42.149 +
  42.150 +static void
  42.151 +WINRT_ProcessWindowSizeChange()
  42.152 +{
  42.153 +    // Make the new window size be the one true fullscreen mode.
  42.154 +    // This change was initially done, in part, to allow the Direct3D 11.1
  42.155 +    // renderer to receive window-resize events as a device rotates.
  42.156 +    // Before, rotating a device from landscape, to portrait, and then
  42.157 +    // back to landscape would cause the Direct3D 11.1 swap buffer to
  42.158 +    // not get resized appropriately.  SDL would, on the rotation from
  42.159 +    // landscape to portrait, re-resize the SDL window to it's initial
  42.160 +    // size (landscape).  On the subsequent rotation, SDL would drop the
  42.161 +    // window-resize event as it appeared the SDL window didn't change
  42.162 +    // size, and the Direct3D 11.1 renderer wouldn't resize its swap
  42.163 +    // chain.
  42.164 +    SDL_DisplayMode newDisplayMode;
  42.165 +    if (WINRT_CalcDisplayModeUsingNativeWindow(&newDisplayMode) != 0) {
  42.166 +        return;
  42.167 +    }
  42.168 +
  42.169 +    // Make note of the old display mode, and it's old driverdata.
  42.170 +    SDL_DisplayMode oldDisplayMode;
  42.171 +    SDL_zero(oldDisplayMode);
  42.172 +    if (WINRT_GlobalSDLVideoDevice) {
  42.173 +        oldDisplayMode = WINRT_GlobalSDLVideoDevice->displays[0].desktop_mode;
  42.174 +    }
  42.175 +
  42.176 +    // Setup the new display mode in the appropriate spots.
  42.177 +    if (WINRT_GlobalSDLVideoDevice) {
  42.178 +        // Make a full copy of the display mode for display_modes[0],
  42.179 +        // one with with a separately malloced 'driverdata' field.
  42.180 +        // SDL_VideoQuit(), if called, will attempt to free the driverdata
  42.181 +        // fields in 'desktop_mode' and each entry in the 'display_modes'
  42.182 +        // array.
  42.183 +        if (WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0].driverdata) {
  42.184 +            // Free the previous mode's memory
  42.185 +            SDL_free(WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0].driverdata);
  42.186 +            WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0].driverdata = NULL;
  42.187 +        }
  42.188 +        if (WINRT_DuplicateDisplayMode(&(WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0]), &newDisplayMode) != 0) {
  42.189 +            // Uh oh, something went wrong.  A malloc call probably failed.
  42.190 +            SDL_free(newDisplayMode.driverdata);
  42.191 +            return;
  42.192 +        }
  42.193 +
  42.194 +        // Install 'newDisplayMode' into 'current_mode' and 'desktop_mode'.
  42.195 +        WINRT_GlobalSDLVideoDevice->displays[0].current_mode = newDisplayMode;
  42.196 +        WINRT_GlobalSDLVideoDevice->displays[0].desktop_mode = newDisplayMode;
  42.197 +    }
  42.198 +
  42.199 +    if (WINRT_GlobalSDLWindow) {
  42.200 +        // Send a window-resize event to the rest of SDL, and to apps:
  42.201 +        SDL_SendWindowEvent(
  42.202 +            WINRT_GlobalSDLWindow,
  42.203 +            SDL_WINDOWEVENT_RESIZED,
  42.204 +            newDisplayMode.w,
  42.205 +            newDisplayMode.h);
  42.206 +
  42.207 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  42.208 +        // HACK: On Windows Phone, make sure that orientation changes from
  42.209 +        // Landscape to LandscapeFlipped, Portrait to PortraitFlipped,
  42.210 +        // or vice-versa on either of those two, lead to the Direct3D renderer
  42.211 +        // getting updated.
  42.212 +        const DisplayOrientations oldOrientation = ((SDL_DisplayModeData *)oldDisplayMode.driverdata)->currentOrientation;
  42.213 +        const DisplayOrientations newOrientation = ((SDL_DisplayModeData *)newDisplayMode.driverdata)->currentOrientation;
  42.214 +
  42.215 +        if ((oldOrientation == DisplayOrientations::Landscape && newOrientation == DisplayOrientations::LandscapeFlipped) ||
  42.216 +            (oldOrientation == DisplayOrientations::LandscapeFlipped && newOrientation == DisplayOrientations::Landscape) ||
  42.217 +            (oldOrientation == DisplayOrientations::Portrait && newOrientation == DisplayOrientations::PortraitFlipped) ||
  42.218 +            (oldOrientation == DisplayOrientations::PortraitFlipped && newOrientation == DisplayOrientations::Portrait))
  42.219 +        {
  42.220 +            // One of the reasons this event is getting sent out is because SDL
  42.221 +            // will ignore requests to send out SDL_WINDOWEVENT_RESIZED events
  42.222 +            // if and when the event size doesn't change (and the Direct3D 11.1
  42.223 +            // renderer doesn't get the memo).
  42.224 +            //
  42.225 +            // Make sure that the display/window size really didn't change.  If
  42.226 +            // it did, then a SDL_WINDOWEVENT_SIZE_CHANGED event got sent, and
  42.227 +            // the Direct3D 11.1 renderer picked it up, presumably.
  42.228 +            if (oldDisplayMode.w == newDisplayMode.w &&
  42.229 +                oldDisplayMode.h == newDisplayMode.h)
  42.230 +            {
  42.231 +                SDL_SendWindowEvent(
  42.232 +                    WINRT_GlobalSDLWindow,
  42.233 +                    SDL_WINDOWEVENT_SIZE_CHANGED,
  42.234 +                    newDisplayMode.w,
  42.235 +                    newDisplayMode.h);
  42.236 +            }
  42.237 +        }
  42.238 +#endif
  42.239 +    }
  42.240 +    
  42.241 +    // Finally, free the 'driverdata' field of the old 'desktop_mode'.
  42.242 +    if (oldDisplayMode.driverdata) {
  42.243 +        SDL_free(oldDisplayMode.driverdata);
  42.244 +        oldDisplayMode.driverdata = NULL;
  42.245 +    }
  42.246 +}
  42.247 +
  42.248 +SDL_WinRTApp::SDL_WinRTApp() :
  42.249 +    m_windowClosed(false),
  42.250 +    m_windowVisible(true)
  42.251 +{
  42.252 +}
  42.253 +
  42.254 +void SDL_WinRTApp::Initialize(CoreApplicationView^ applicationView)
  42.255 +{
  42.256 +    applicationView->Activated +=
  42.257 +        ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &SDL_WinRTApp::OnActivated);
  42.258 +
  42.259 +    CoreApplication::Suspending +=
  42.260 +        ref new EventHandler<SuspendingEventArgs^>(this, &SDL_WinRTApp::OnSuspending);
  42.261 +
  42.262 +    CoreApplication::Resuming +=
  42.263 +        ref new EventHandler<Platform::Object^>(this, &SDL_WinRTApp::OnResuming);
  42.264 +
  42.265 +    CoreApplication::Exiting +=
  42.266 +        ref new EventHandler<Platform::Object^>(this, &SDL_WinRTApp::OnExiting);
  42.267 +
  42.268 +    DisplayProperties::OrientationChanged +=
  42.269 +        ref new DisplayPropertiesEventHandler(this, &SDL_WinRTApp::OnOrientationChanged);
  42.270 +
  42.271 +    // Register the hint, SDL_HINT_ORIENTATIONS, with SDL.  This needs to be
  42.272 +    // done before the hint's callback is registered (as of Feb 22, 2013),
  42.273 +    // otherwise the hint callback won't get registered.
  42.274 +    //
  42.275 +    // TODO, WinRT: see if an app's default orientation can be found out via WinRT API(s), then set the initial value of SDL_HINT_ORIENTATIONS accordingly.
  42.276 +    //SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight Portrait PortraitUpsideDown");   // DavidL: this is no longer needed (for SDL_AddHintCallback)
  42.277 +    SDL_AddHintCallback(SDL_HINT_ORIENTATIONS, WINRT_SetDisplayOrientationsPreference, NULL);
  42.278 +}
  42.279 +
  42.280 +void SDL_WinRTApp::OnOrientationChanged(Object^ sender)
  42.281 +{
  42.282 +#if LOG_ORIENTATION_EVENTS==1
  42.283 +    CoreWindow^ window = CoreWindow::GetForCurrentThread();
  42.284 +    if (window) {
  42.285 +        SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, CoreWindow Size={%f,%f}\n",
  42.286 +            __FUNCTION__,
  42.287 +            (int)DisplayProperties::CurrentOrientation,
  42.288 +            (int)DisplayProperties::NativeOrientation,
  42.289 +            (int)DisplayProperties::AutoRotationPreferences,
  42.290 +            window->Bounds.Width,
  42.291 +            window->Bounds.Height);
  42.292 +    } else {
  42.293 +        SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d\n",
  42.294 +            __FUNCTION__,
  42.295 +            (int)DisplayProperties::CurrentOrientation,
  42.296 +            (int)DisplayProperties::NativeOrientation,
  42.297 +            (int)DisplayProperties::AutoRotationPreferences);
  42.298 +    }
  42.299 +#endif
  42.300 +
  42.301 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  42.302 +    // On Windows Phone, treat an orientation change as a change in window size.
  42.303 +    // The native window's size doesn't seem to change, however SDL will simulate
  42.304 +    // a window size change.
  42.305 +    WINRT_ProcessWindowSizeChange();
  42.306 +#endif
  42.307 +}
  42.308 +
  42.309 +void SDL_WinRTApp::SetWindow(CoreWindow^ window)
  42.310 +{
  42.311 +#if LOG_WINDOW_EVENTS==1
  42.312 +    SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, window Size={%f,%f}\n",
  42.313 +        __FUNCTION__,
  42.314 +        (int)DisplayProperties::CurrentOrientation,
  42.315 +        (int)DisplayProperties::NativeOrientation,
  42.316 +        (int)DisplayProperties::AutoRotationPreferences,
  42.317 +        window->Bounds.Width,
  42.318 +        window->Bounds.Height);
  42.319 +#endif
  42.320 +
  42.321 +    window->SizeChanged += 
  42.322 +        ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &SDL_WinRTApp::OnWindowSizeChanged);
  42.323 +
  42.324 +    window->VisibilityChanged +=
  42.325 +        ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &SDL_WinRTApp::OnVisibilityChanged);
  42.326 +
  42.327 +    window->Closed += 
  42.328 +        ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &SDL_WinRTApp::OnWindowClosed);
  42.329 +
  42.330 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
  42.331 +    window->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0);
  42.332 +#endif
  42.333 +
  42.334 +    window->PointerPressed +=
  42.335 +        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerPressed);
  42.336 +
  42.337 +    window->PointerMoved +=
  42.338 +        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerMoved);
  42.339 +
  42.340 +    window->PointerReleased +=
  42.341 +        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerReleased);
  42.342 +
  42.343 +    window->PointerWheelChanged +=
  42.344 +        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerWheelChanged);
  42.345 +
  42.346 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
  42.347 +    // Retrieves relative-only mouse movements:
  42.348 +    Windows::Devices::Input::MouseDevice::GetForCurrentView()->MouseMoved +=
  42.349 +        ref new TypedEventHandler<MouseDevice^, MouseEventArgs^>(this, &SDL_WinRTApp::OnMouseMoved);
  42.350 +#endif
  42.351 +
  42.352 +    window->KeyDown +=
  42.353 +        ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &SDL_WinRTApp::OnKeyDown);
  42.354 +
  42.355 +    window->KeyUp +=
  42.356 +        ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &SDL_WinRTApp::OnKeyUp);
  42.357 +
  42.358 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  42.359 +    HardwareButtons::BackPressed +=
  42.360 +        ref new EventHandler<BackPressedEventArgs^>(this, &SDL_WinRTApp::OnBackButtonPressed);
  42.361 +#endif
  42.362 +
  42.363 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP  // for Windows 8/8.1/RT apps... (and not Phone apps)
  42.364 +    // Make sure we know when a user has opened the app's settings pane.
  42.365 +    // This is needed in order to display a privacy policy, which needs
  42.366 +    // to be done for network-enabled apps, as per Windows Store requirements.
  42.367 +    using namespace Windows::UI::ApplicationSettings;
  42.368 +    SettingsPane::GetForCurrentView()->CommandsRequested +=
  42.369 +        ref new TypedEventHandler<SettingsPane^, SettingsPaneCommandsRequestedEventArgs^>
  42.370 +            (this, &SDL_WinRTApp::OnSettingsPaneCommandsRequested);
  42.371 +#endif
  42.372 +}
  42.373 +
  42.374 +void SDL_WinRTApp::Load(Platform::String^ entryPoint)
  42.375 +{
  42.376 +}
  42.377 +
  42.378 +void SDL_WinRTApp::Run()
  42.379 +{
  42.380 +    SDL_SetMainReady();
  42.381 +    if (WINRT_SDLAppEntryPoint)
  42.382 +    {
  42.383 +        // TODO, WinRT: pass the C-style main() a reasonably realistic
  42.384 +        // representation of command line arguments.
  42.385 +        int argc = 0;
  42.386 +        char **argv = NULL;
  42.387 +        WINRT_SDLAppEntryPoint(argc, argv);
  42.388 +    }
  42.389 +}
  42.390 +
  42.391 +void SDL_WinRTApp::PumpEvents()
  42.392 +{
  42.393 +    if (!m_windowClosed)
  42.394 +    {
  42.395 +        if (m_windowVisible)
  42.396 +        {
  42.397 +            CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
  42.398 +        }
  42.399 +        else
  42.400 +        {
  42.401 +            CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending);
  42.402 +        }
  42.403 +    }
  42.404 +}
  42.405 +
  42.406 +void SDL_WinRTApp::Uninitialize()
  42.407 +{
  42.408 +}
  42.409 +
  42.410 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
  42.411 +void SDL_WinRTApp::OnSettingsPaneCommandsRequested(
  42.412 +    Windows::UI::ApplicationSettings::SettingsPane ^p,
  42.413 +    Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args)
  42.414 +{
  42.415 +    using namespace Platform;
  42.416 +    using namespace Windows::UI::ApplicationSettings;
  42.417 +    using namespace Windows::UI::Popups;
  42.418 +
  42.419 +    String ^privacyPolicyURL = nullptr;     // a URL to an app's Privacy Policy
  42.420 +    String ^privacyPolicyLabel = nullptr;   // label/link text
  42.421 +    const char *tmpHintValue = NULL;        // SDL_GetHint-retrieved value, used immediately
  42.422 +    wchar_t *tmpStr = NULL;                 // used for UTF8 to UCS2 conversion
  42.423 +
  42.424 +    // Setup a 'Privacy Policy' link, if one is available (via SDL_GetHint):
  42.425 +    tmpHintValue = SDL_GetHint(SDL_HINT_WINRT_PRIVACY_POLICY_URL);
  42.426 +    if (tmpHintValue && tmpHintValue[0] != '\0') {
  42.427 +        // Convert the privacy policy's URL to UCS2:
  42.428 +        tmpStr = WIN_UTF8ToString(tmpHintValue);
  42.429 +        privacyPolicyURL = ref new String(tmpStr);
  42.430 +        SDL_free(tmpStr);
  42.431 +
  42.432 +        // Optionally retrieve custom label-text for the link.  If this isn't
  42.433 +        // available, a default value will be used instead.
  42.434 +        tmpHintValue = SDL_GetHint(SDL_HINT_WINRT_PRIVACY_POLICY_LABEL);
  42.435 +        if (tmpHintValue && tmpHintValue[0] != '\0') {
  42.436 +            tmpStr = WIN_UTF8ToString(tmpHintValue);
  42.437 +            privacyPolicyLabel = ref new String(tmpStr);
  42.438 +            SDL_free(tmpStr);
  42.439 +        } else {
  42.440 +            privacyPolicyLabel = ref new String(L"Privacy Policy");
  42.441 +        }
  42.442 +
  42.443 +        // Register the link, along with a handler to be called if and when it is
  42.444 +        // clicked:
  42.445 +        auto cmd = ref new SettingsCommand(L"privacyPolicy", privacyPolicyLabel,
  42.446 +            ref new UICommandInvokedHandler([=](IUICommand ^) {
  42.447 +                Windows::System::Launcher::LaunchUriAsync(ref new Uri(privacyPolicyURL));
  42.448 +        }));
  42.449 +        args->Request->ApplicationCommands->Append(cmd);
  42.450 +    }
  42.451 +}
  42.452 +#endif // if WINAPI_FAMILY == WINAPI_FAMILY_APP
  42.453 +
  42.454 +void SDL_WinRTApp::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args)
  42.455 +{
  42.456 +#if LOG_WINDOW_EVENTS==1
  42.457 +    SDL_Log("%s, size={%f,%f}, current orientation=%d, native orientation=%d, auto rot. pref=%d, WINRT_GlobalSDLWindow?=%s\n",
  42.458 +        __FUNCTION__,
  42.459 +        args->Size.Width, args->Size.Height,
  42.460 +        (int)DisplayProperties::CurrentOrientation,
  42.461 +        (int)DisplayProperties::NativeOrientation,
  42.462 +        (int)DisplayProperties::AutoRotationPreferences,
  42.463 +        (WINRT_GlobalSDLWindow ? "yes" : "no"));
  42.464 +#endif
  42.465 +
  42.466 +    WINRT_ProcessWindowSizeChange();
  42.467 +}
  42.468 +
  42.469 +void SDL_WinRTApp::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args)
  42.470 +{
  42.471 +#if LOG_WINDOW_EVENTS==1
  42.472 +    SDL_Log("%s, visible?=%s, WINRT_GlobalSDLWindow?=%s\n",
  42.473 +        __FUNCTION__,
  42.474 +        (args->Visible ? "yes" : "no"),
  42.475 +        (WINRT_GlobalSDLWindow ? "yes" : "no"));
  42.476 +#endif
  42.477 +
  42.478 +    m_windowVisible = args->Visible;
  42.479 +    if (WINRT_GlobalSDLWindow) {
  42.480 +        SDL_bool wasSDLWindowSurfaceValid = WINRT_GlobalSDLWindow->surface_valid;
  42.481 +
  42.482 +        if (args->Visible) {
  42.483 +            SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SHOWN, 0, 0);
  42.484 +        } else {
  42.485 +            SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_HIDDEN, 0, 0);
  42.486 +        }
  42.487 +
  42.488 +        // HACK: Prevent SDL's window-hide handling code, which currently
  42.489 +        // triggers a fake window resize (possibly erronously), from
  42.490 +        // marking the SDL window's surface as invalid.
  42.491 +        //
  42.492 +        // A better solution to this probably involves figuring out if the
  42.493 +        // fake window resize can be prevented.
  42.494 +        WINRT_GlobalSDLWindow->surface_valid = wasSDLWindowSurfaceValid;
  42.495 +    }
  42.496 +}
  42.497 +
  42.498 +void SDL_WinRTApp::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
  42.499 +{
  42.500 +#if LOG_WINDOW_EVENTS==1
  42.501 +    SDL_Log("%s\n", __FUNCTION__);
  42.502 +#endif
  42.503 +    m_windowClosed = true;
  42.504 +}
  42.505 +
  42.506 +void SDL_WinRTApp::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
  42.507 +{
  42.508 +    CoreWindow::GetForCurrentThread()->Activate();
  42.509 +}
  42.510 +
  42.511 +static int SDLCALL RemoveAppSuspendAndResumeEvents(void * userdata, SDL_Event * event)
  42.512 +{
  42.513 +    if (event->type == SDL_WINDOWEVENT)
  42.514 +    {
  42.515 +        switch (event->window.event)
  42.516 +        {
  42.517 +            case SDL_WINDOWEVENT_MINIMIZED:
  42.518 +            case SDL_WINDOWEVENT_RESTORED:
  42.519 +                // Return 0 to indicate that the event should be removed from the
  42.520 +                // event queue:
  42.521 +                return 0;
  42.522 +            default:
  42.523 +                break;
  42.524 +        }
  42.525 +    }
  42.526 +
  42.527 +    // Return 1 to indicate that the event should stay in the event queue:
  42.528 +    return 1;
  42.529 +}
  42.530 +
  42.531 +void SDL_WinRTApp::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args)
  42.532 +{
  42.533 +    // Save app state asynchronously after requesting a deferral. Holding a deferral
  42.534 +    // indicates that the application is busy performing suspending operations. Be
  42.535 +    // aware that a deferral may not be held indefinitely. After about five seconds,
  42.536 +    // the app will be forced to exit.
  42.537 +    SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral();
  42.538 +    create_task([this, deferral]()
  42.539 +    {
  42.540 +        // Send a window-minimized event immediately to observers.
  42.541 +        // CoreDispatcher::ProcessEvents, which is the backbone on which
  42.542 +        // SDL_WinRTApp::PumpEvents is built, will not return to its caller
  42.543 +        // once it sends out a suspend event.  Any events posted to SDL's
  42.544 +        // event queue won't get received until the WinRT app is resumed.
  42.545 +        // SDL_AddEventWatch() may be used to receive app-suspend events on
  42.546 +        // WinRT.
  42.547 +        //
  42.548 +        // In order to prevent app-suspend events from being received twice:
  42.549 +        // first via a callback passed to SDL_AddEventWatch, and second via
  42.550 +        // SDL's event queue, the event will be sent to SDL, then immediately
  42.551 +        // removed from the queue.
  42.552 +        if (WINRT_GlobalSDLWindow)
  42.553 +        {
  42.554 +            SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_MINIMIZED, 0, 0);   // TODO: see if SDL_WINDOWEVENT_SIZE_CHANGED should be getting triggered here (it is, currently)
  42.555 +            SDL_FilterEvents(RemoveAppSuspendAndResumeEvents, 0);
  42.556 +        }
  42.557 +
  42.558 +        SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
  42.559 +        SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
  42.560 +
  42.561 +        deferral->Complete();
  42.562 +    });
  42.563 +}
  42.564 +
  42.565 +void SDL_WinRTApp::OnResuming(Platform::Object^ sender, Platform::Object^ args)
  42.566 +{
  42.567 +    SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
  42.568 +    SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
  42.569 +
  42.570 +    // Restore any data or state that was unloaded on suspend. By default, data
  42.571 +    // and state are persisted when resuming from suspend. Note that this event
  42.572 +    // does not occur if the app was previously terminated.
  42.573 +    if (WINRT_GlobalSDLWindow)
  42.574 +    {
  42.575 +        SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_RESTORED, 0, 0);    // TODO: see if SDL_WINDOWEVENT_SIZE_CHANGED should be getting triggered here (it is, currently)
  42.576 +
  42.577 +        // Remove the app-resume event from the queue, as is done with the
  42.578 +        // app-suspend event.
  42.579 +        //
  42.580 +        // TODO, WinRT: consider posting this event to the queue even though
  42.581 +        // its counterpart, the app-suspend event, effectively has to be
  42.582 +        // processed immediately.
  42.583 +        SDL_FilterEvents(RemoveAppSuspendAndResumeEvents, 0);
  42.584 +    }
  42.585 +}
  42.586 +
  42.587 +void SDL_WinRTApp::OnExiting(Platform::Object^ sender, Platform::Object^ args)
  42.588 +{
  42.589 +    SDL_SendAppEvent(SDL_APP_TERMINATING);
  42.590 +}
  42.591 +
  42.592 +static void
  42.593 +WINRT_LogPointerEvent(const char * header, Windows::UI::Core::PointerEventArgs ^ args, Windows::Foundation::Point transformedPoint)
  42.594 +{
  42.595 +    Windows::UI::Input::PointerPoint ^ pt = args->CurrentPoint;
  42.596 +    SDL_Log("%s: Position={%f,%f}, Transformed Pos={%f, %f}, MouseWheelDelta=%d, FrameId=%d, PointerId=%d, SDL button=%d\n",
  42.597 +        header,
  42.598 +        pt->Position.X, pt->Position.Y,
  42.599 +        transformedPoint.X, transformedPoint.Y,
  42.600 +        pt->Properties->MouseWheelDelta,
  42.601 +        pt->FrameId,
  42.602 +        pt->PointerId,
  42.603 +        WINRT_GetSDLButtonForPointerPoint(pt));
  42.604 +}
  42.605 +
  42.606 +void SDL_WinRTApp::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args)
  42.607 +{
  42.608 +#if LOG_POINTER_EVENTS
  42.609 +    WINRT_LogPointerEvent("pointer pressed", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
  42.610 +#endif
  42.611 +
  42.612 +    WINRT_ProcessPointerPressedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
  42.613 +}
  42.614 +
  42.615 +void SDL_WinRTApp::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args)
  42.616 +{
  42.617 +#if LOG_POINTER_EVENTS
  42.618 +    WINRT_LogPointerEvent("pointer moved", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
  42.619 +#endif
  42.620 +
  42.621 +    WINRT_ProcessPointerMovedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
  42.622 +}
  42.623 +
  42.624 +void SDL_WinRTApp::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args)
  42.625 +{
  42.626 +#if LOG_POINTER_EVENTS
  42.627 +    WINRT_LogPointerEvent("pointer released", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
  42.628 +#endif
  42.629 +
  42.630 +    WINRT_ProcessPointerReleasedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
  42.631 +}
  42.632 +
  42.633 +void SDL_WinRTApp::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args)
  42.634 +{
  42.635 +#if LOG_POINTER_EVENTS
  42.636 +    WINRT_LogPointerEvent("pointer wheel changed", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
  42.637 +#endif
  42.638 +
  42.639 +    WINRT_ProcessPointerWheelChangedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
  42.640 +}
  42.641 +
  42.642 +void SDL_WinRTApp::OnMouseMoved(MouseDevice^ mouseDevice, MouseEventArgs^ args)
  42.643 +{
  42.644 +    WINRT_ProcessMouseMovedEvent(WINRT_GlobalSDLWindow, args);
  42.645 +}
  42.646 +
  42.647 +void SDL_WinRTApp::OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args)
  42.648 +{
  42.649 +    WINRT_ProcessKeyDownEvent(args);
  42.650 +}
  42.651 +
  42.652 +void SDL_WinRTApp::OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args)
  42.653 +{
  42.654 +    WINRT_ProcessKeyUpEvent(args);
  42.655 +}
  42.656 +
  42.657 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  42.658 +void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args)
  42.659 +{
  42.660 +    SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_AC_BACK);
  42.661 +    SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_AC_BACK);
  42.662 +
  42.663 +    const char *hint = SDL_GetHint(SDL_HINT_WINRT_HANDLE_BACK_BUTTON);
  42.664 +    if (hint) {
  42.665 +        if (*hint == '1') {
  42.666 +            args->Handled = true;
  42.667 +        }
  42.668 +    }
  42.669 +}
  42.670 +#endif
  42.671 +
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/src/core/winrt/SDL_winrtapp_direct3d.h	Sun Mar 09 11:36:47 2014 -0700
    43.3 @@ -0,0 +1,58 @@
    43.4 +#pragma once
    43.5 +
    43.6 +#include <Windows.h>
    43.7 +
    43.8 +extern int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **));
    43.9 +
   43.10 +ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFrameworkView
   43.11 +{
   43.12 +public:
   43.13 +    SDL_WinRTApp();
   43.14 +    
   43.15 +    // IFrameworkView Methods.
   43.16 +    virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
   43.17 +    virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
   43.18 +    virtual void Load(Platform::String^ entryPoint);
   43.19 +    virtual void Run();
   43.20 +    virtual void Uninitialize();
   43.21 +
   43.22 +internal:
   43.23 +    // SDL-specific methods
   43.24 +    void PumpEvents();
   43.25 +
   43.26 +protected:
   43.27 +    // Event Handlers.
   43.28 +
   43.29 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP  // for Windows 8/8.1/RT apps... (and not Phone apps)
   43.30 +    void OnSettingsPaneCommandsRequested(
   43.31 +        Windows::UI::ApplicationSettings::SettingsPane ^p,
   43.32 +        Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args);
   43.33 +#endif // if WINAPI_FAMILY == WINAPI_FAMILY_APP
   43.34 +
   43.35 +    void OnOrientationChanged(Platform::Object^ sender);
   43.36 +    void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
   43.37 +    void OnLogicalDpiChanged(Platform::Object^ sender);
   43.38 +    void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
   43.39 +    void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
   43.40 +    void OnResuming(Platform::Object^ sender, Platform::Object^ args);
   43.41 +    void OnExiting(Platform::Object^ sender, Platform::Object^ args);
   43.42 +    void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
   43.43 +    void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
   43.44 +    void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
   43.45 +    void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
   43.46 +    void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
   43.47 +    void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
   43.48 +    void OnMouseMoved(Windows::Devices::Input::MouseDevice^ mouseDevice, Windows::Devices::Input::MouseEventArgs^ args);
   43.49 +    void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
   43.50 +    void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
   43.51 +
   43.52 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
   43.53 +    void OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args);
   43.54 +#endif
   43.55 +
   43.56 +private:
   43.57 +    bool m_windowClosed;
   43.58 +    bool m_windowVisible;
   43.59 +};
   43.60 +
   43.61 +extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/src/core/winrt/SDL_winrtapp_xaml.cpp	Sun Mar 09 11:36:47 2014 -0700
    44.3 @@ -0,0 +1,158 @@
    44.4 +/*
    44.5 +  Simple DirectMedia Layer
    44.6 +  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    44.7 +
    44.8 +  This software is provided 'as-is', without any express or implied
    44.9 +  warranty.  In no event will the authors be held liable for any damages
   44.10 +  arising from the use of this software.
   44.11 +
   44.12 +  Permission is granted to anyone to use this software for any purpose,
   44.13 +  including commercial applications, and to alter it and redistribute it
   44.14 +  freely, subject to the following restrictions:
   44.15 +
   44.16 +  1. The origin of this software must not be misrepresented; you must not
   44.17 +     claim that you wrote the original software. If you use this software
   44.18 +     in a product, an acknowledgment in the product documentation would be
   44.19 +     appreciated but is not required.
   44.20 +  2. Altered source versions must be plainly marked as such, and must not be
   44.21 +     misrepresented as being the original software.
   44.22 +  3. This notice may not be removed or altered from any source distribution.
   44.23 +*/
   44.24 +
   44.25 +/* Windows includes */
   44.26 +#include <agile.h>
   44.27 +#include <Windows.h>
   44.28 +
   44.29 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
   44.30 +#include <windows.ui.xaml.media.dxinterop.h>
   44.31 +#endif
   44.32 +
   44.33 +
   44.34 +/* SDL includes */
   44.35 +#include "SDL.h"
   44.36 +#include "../../video/winrt/SDL_winrtevents_c.h"
   44.37 +#include "../../video/winrt/SDL_winrtvideo_cpp.h"
   44.38 +#include "SDL_winrtapp_common.h"
   44.39 +#include "SDL_winrtapp_xaml.h"
   44.40 +
   44.41 +
   44.42 +
   44.43 +/* SDL-internal globals: */
   44.44 +SDL_bool WINRT_XAMLWasEnabled = SDL_FALSE;
   44.45 +
   44.46 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
   44.47 +ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative = NULL;
   44.48 +static Windows::Foundation::EventRegistrationToken	WINRT_XAMLAppEventToken;
   44.49 +#endif
   44.50 +
   44.51 +
   44.52 +/*
   44.53 + * Input event handlers (XAML)
   44.54 + */
   44.55 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
   44.56 +
   44.57 +static void
   44.58 +WINRT_OnPointerPressedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
   44.59 +{
   44.60 +    WINRT_ProcessPointerPressedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr));
   44.61 +}
   44.62 +
   44.63 +static void
   44.64 +WINRT_OnPointerMovedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
   44.65 +{
   44.66 +    WINRT_ProcessPointerMovedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr));
   44.67 +}
   44.68 +
   44.69 +static void
   44.70 +WINRT_OnPointerReleasedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
   44.71 +{
   44.72 +    WINRT_ProcessPointerReleasedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr));
   44.73 +}
   44.74 +
   44.75 +static void
   44.76 +WINRT_OnPointerWheelChangedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
   44.77 +{
   44.78 +    WINRT_ProcessPointerWheelChangedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr));
   44.79 +}
   44.80 +
   44.81 +#endif // WINAPI_FAMILY == WINAPI_FAMILY_APP
   44.82 +
   44.83 +
   44.84 +/*
   44.85 + * XAML-to-SDL Rendering Callback
   44.86 + */
   44.87 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
   44.88 +
   44.89 +static void
   44.90 +WINRT_OnRenderViaXAML(_In_ Platform::Object^ sender, _In_ Platform::Object^ args)
   44.91 +{
   44.92 +    WINRT_CycleXAMLThread();
   44.93 +}
   44.94 +
   44.95 +#endif // WINAPI_FAMILY == WINAPI_FAMILY_APP
   44.96 +
   44.97 +
   44.98 +/*
   44.99 + * SDL + XAML Initialization
  44.100 + */
  44.101 +
  44.102 +int
  44.103 +SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAsIInspectable)
  44.104 +{
  44.105 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  44.106 +    return SDL_SetError("XAML support is not yet available in Windows Phone.");
  44.107 +#else
  44.108 +    // Declare C++/CX namespaces:
  44.109 +    using namespace Platform;
  44.110 +    using namespace Windows::Foundation;
  44.111 +    using namespace Windows::UI::Core;
  44.112 +    using namespace Windows::UI::Xaml;
  44.113 +    using namespace Windows::UI::Xaml::Controls;
  44.114 +    using namespace Windows::UI::Xaml::Input;
  44.115 +    using namespace Windows::UI::Xaml::Media;
  44.116 +
  44.117 +    // Make sure we have a valid XAML element (to draw onto):
  44.118 +    if ( ! backgroundPanelAsIInspectable) {
  44.119 +        return SDL_SetError("'backgroundPanelAsIInspectable' can't be NULL");
  44.120 +    }
  44.121 +
  44.122 +    Platform::Object ^ backgroundPanel = reinterpret_cast<Object ^>((IInspectable *) backgroundPanelAsIInspectable);
  44.123 +    SwapChainBackgroundPanel ^swapChainBackgroundPanel = dynamic_cast<SwapChainBackgroundPanel ^>(backgroundPanel);
  44.124 +    if ( ! swapChainBackgroundPanel) {
  44.125 +        return SDL_SetError("An unknown or unsupported type of XAML control was specified.");
  44.126 +    }
  44.127 +
  44.128 +    // Setup event handlers:
  44.129 +    swapChainBackgroundPanel->PointerPressed += ref new PointerEventHandler(WINRT_OnPointerPressedViaXAML);
  44.130 +    swapChainBackgroundPanel->PointerReleased += ref new PointerEventHandler(WINRT_OnPointerReleasedViaXAML);
  44.131 +    swapChainBackgroundPanel->PointerWheelChanged += ref new PointerEventHandler(WINRT_OnPointerWheelChangedViaXAML);
  44.132 +    swapChainBackgroundPanel->PointerMoved += ref new PointerEventHandler(WINRT_OnPointerMovedViaXAML);
  44.133 +
  44.134 +    // Setup for rendering:
  44.135 +    IInspectable *panelInspectable = (IInspectable*) reinterpret_cast<IInspectable*>(swapChainBackgroundPanel);
  44.136 +    panelInspectable->QueryInterface(__uuidof(ISwapChainBackgroundPanelNative), (void **)&WINRT_GlobalSwapChainBackgroundPanelNative);
  44.137 +
  44.138 +    WINRT_XAMLAppEventToken = CompositionTarget::Rendering::add(ref new EventHandler<Object^>(WINRT_OnRenderViaXAML));
  44.139 +
  44.140 +    // Make sure the app is ready to call the SDL-centric main() function:
  44.141 +    WINRT_SDLAppEntryPoint = mainFunction;
  44.142 +    SDL_SetMainReady();
  44.143 +
  44.144 +    // Make sure video-init knows that we're initializing XAML:
  44.145 +    SDL_bool oldXAMLWasEnabledValue = WINRT_XAMLWasEnabled;
  44.146 +    WINRT_XAMLWasEnabled = SDL_TRUE;
  44.147 +
  44.148 +    // Make sure video modes are detected now, while we still have access to the WinRT
  44.149 +    // CoreWindow.  WinRT will not allow the app's CoreWindow to be accessed via the
  44.150 +    // SDL/WinRT thread.
  44.151 +    if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) {
  44.152 +        // SDL_InitSubSystem will, on error, set the SDL error.  Let that propogate to
  44.153 +        // the caller to here:
  44.154 +        WINRT_XAMLWasEnabled = oldXAMLWasEnabledValue;
  44.155 +        return -1;
  44.156 +    }
  44.157 +
  44.158 +    // All done, for now.
  44.159 +    return 0;
  44.160 +#endif // WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP  /  else
  44.161 +}
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/src/core/winrt/SDL_winrtapp_xaml.h	Sun Mar 09 11:36:47 2014 -0700
    45.3 @@ -0,0 +1,33 @@
    45.4 +/*
    45.5 +  Simple DirectMedia Layer
    45.6 +  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
    45.7 +
    45.8 +  This software is provided 'as-is', without any express or implied
    45.9 +  warranty.  In no event will the authors be held liable for any damages
   45.10 +  arising from the use of this software.
   45.11 +
   45.12 +  Permission is granted to anyone to use this software for any purpose,
   45.13 +  including commercial applications, and to alter it and redistribute it
   45.14 +  freely, subject to the following restrictions:
   45.15 +
   45.16 +  1. The origin of this software must not be misrepresented; you must not
   45.17 +     claim that you wrote the original software. If you use this software
   45.18 +     in a product, an acknowledgment in the product documentation would be
   45.19 +     appreciated but is not required.
   45.20 +  2. Altered source versions must be plainly marked as such, and must not be
   45.21 +     misrepresented as being the original software.
   45.22 +  3. This notice may not be removed or altered from any source distribution.
   45.23 +*/
   45.24 +#include "SDL_config.h"
   45.25 +
   45.26 +#ifndef _SDL_winrtapp_xaml_h
   45.27 +#define _SDL_winrtapp_xaml_h
   45.28 +
   45.29 +#include "SDL_types.h"
   45.30 +
   45.31 +#ifdef __cplusplus
   45.32 +extern SDL_bool WINRT_XAMLWasEnabled;
   45.33 +extern int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAsIInspectable);
   45.34 +#endif // ifdef __cplusplus
   45.35 +
   45.36 +#endif // ifndef _SDL_winrtapp_xaml_h
    46.1 --- a/src/file/SDL_rwops.c	Sun Mar 09 10:38:30 2014 -0700
    46.2 +++ b/src/file/SDL_rwops.c	Sun Mar 09 11:36:47 2014 -0700
    46.3 @@ -316,6 +316,10 @@
    46.4      if (fseeko(context->hidden.stdio.fp, (off_t)offset, whence) == 0) {
    46.5          return ftello(context->hidden.stdio.fp);
    46.6      }
    46.7 +#elif defined(HAVE__FSEEKI64)
    46.8 +    if (_fseeki64(context->hidden.stdio.fp, offset, whence) == 0) {
    46.9 +        return _ftelli64(context->hidden.stdio.fp);
   46.10 +    }
   46.11  #else
   46.12      if (fseek(context->hidden.stdio.fp, offset, whence) == 0) {
   46.13          return ftell(context->hidden.stdio.fp);
   46.14 @@ -522,6 +526,9 @@
   46.15      {
   46.16          #ifdef __APPLE__
   46.17          FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode);
   46.18 +        #elif __WINRT__
   46.19 +        FILE *fp = NULL;
   46.20 +        fopen_s(&fp, file, mode);
   46.21          #else
   46.22          FILE *fp = fopen(file, mode);
   46.23          #endif
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/src/filesystem/winrt/SDL_sysfilesystem.cpp	Sun Mar 09 11:36:47 2014 -0700
    47.3 @@ -0,0 +1,154 @@
    47.4 +/* TODO, WinRT: include copyright info in SDL_winrtpaths.cpp
    47.5 +   TODO, WinRT: remove the need to compile this with C++/CX (/ZW) extensions, and if possible, without C++ at all
    47.6 +*/
    47.7 +
    47.8 +#include "SDL_config.h"
    47.9 +
   47.10 +#ifdef __WINRT__
   47.11 +
   47.12 +extern "C" {
   47.13 +#include "SDL_filesystem.h"
   47.14 +#include "SDL_error.h"
   47.15 +#include "SDL_stdinc.h"
   47.16 +#include "SDL_system.h"
   47.17 +#include "../../core/windows/SDL_windows.h"
   47.18 +}
   47.19 +
   47.20 +#include <string>
   47.21 +#include <unordered_map>
   47.22 +
   47.23 +using namespace std;
   47.24 +using namespace Windows::Storage;
   47.25 +
   47.26 +extern "C" const wchar_t *
   47.27 +SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType)
   47.28 +{
   47.29 +    switch (pathType) {
   47.30 +        case SDL_WINRT_PATH_INSTALLED_LOCATION:
   47.31 +        {
   47.32 +            static wstring path;
   47.33 +            if (path.empty()) {
   47.34 +                path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data();
   47.35 +            }
   47.36 +            return path.c_str();
   47.37 +        }
   47.38 +
   47.39 +        case SDL_WINRT_PATH_LOCAL_FOLDER:
   47.40 +        {
   47.41 +            static wstring path;
   47.42 +            if (path.empty()) {
   47.43 +                path = ApplicationData::Current->LocalFolder->Path->Data();
   47.44 +            }
   47.45 +            return path.c_str();
   47.46 +        }
   47.47 +
   47.48 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
   47.49 +        case SDL_WINRT_PATH_ROAMING_FOLDER:
   47.50 +        {
   47.51 +            static wstring path;
   47.52 +            if (path.empty()) {
   47.53 +                path = ApplicationData::Current->RoamingFolder->Path->Data();
   47.54 +            }
   47.55 +            return path.c_str();
   47.56 +        }
   47.57 +
   47.58 +        case SDL_WINRT_PATH_TEMP_FOLDER:
   47.59 +        {
   47.60 +            static wstring path;
   47.61 +            if (path.empty()) {
   47.62 +                path = ApplicationData::Current->TemporaryFolder->Path->Data();
   47.63 +            }
   47.64 +            return path.c_str();
   47.65 +        }
   47.66 +#endif
   47.67 +
   47.68 +        default:
   47.69 +            break;
   47.70 +    }
   47.71 +
   47.72 +    SDL_Unsupported();
   47.73 +    return NULL;
   47.74 +}
   47.75 +
   47.76 +extern "C" const char *
   47.77 +SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType)
   47.78 +{
   47.79 +    typedef unordered_map<SDL_WinRT_Path, string> UTF8PathMap;
   47.80 +    static UTF8PathMap utf8Paths;
   47.81 +
   47.82 +    UTF8PathMap::iterator searchResult = utf8Paths.find(pathType);
   47.83 +    if (searchResult != utf8Paths.end()) {
   47.84 +        return searchResult->second.c_str();
   47.85 +    }
   47.86 +
   47.87 +    const wchar_t * ucs2Path = SDL_WinRTGetFSPathUNICODE(pathType);
   47.88 +    if (!ucs2Path) {
   47.89 +        return NULL;
   47.90 +    }
   47.91 +
   47.92 +    char * utf8Path = WIN_StringToUTF8(ucs2Path);
   47.93 +    utf8Paths[pathType] = utf8Path;
   47.94 +    SDL_free(utf8Path);
   47.95 +    return utf8Paths[pathType].c_str();
   47.96 +}
   47.97 +
   47.98 +extern "C" char *
   47.99 +SDL_GetBasePath(void)
  47.100 +{
  47.101 +    const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_INSTALLED_LOCATION);
  47.102 +    size_t destPathLen;
  47.103 +    char * destPath = NULL;
  47.104 +
  47.105 +    if (!srcPath) {
  47.106 +        SDL_SetError("Couldn't locate our basepath: %s", SDL_GetError());
  47.107 +        return NULL;
  47.108 +    }
  47.109 +
  47.110 +    destPathLen = SDL_strlen(srcPath) + 2;
  47.111 +    destPath = (char *) SDL_malloc(destPathLen);
  47.112 +    if (!destPath) {
  47.113 +        SDL_OutOfMemory();
  47.114 +        return NULL;
  47.115 +    }
  47.116 +
  47.117 +    SDL_snprintf(destPath, destPathLen, "%s\\", srcPath);
  47.118 +    return destPath;
  47.119 +}
  47.120 +
  47.121 +extern "C" char *
  47.122 +SDL_GetPrefPath(const char *org, const char *app)
  47.123 +{
  47.124 +    /* WinRT note: The 'SHGetFolderPath' API that is used in Windows 7 and
  47.125 +     * earlier is not available on WinRT or Windows Phone.  WinRT provides
  47.126 +     * a similar API, but SHGetFolderPath can't be called, at least not
  47.127 +     * without violating Microsoft's app-store requirements.
  47.128 +     */
  47.129 +
  47.130 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  47.131 +    /* A 'Roaming' folder is not available in Windows Phone 8, however a 'Local' folder is. */
  47.132 +    const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_LOCAL_FOLDER);
  47.133 +#else
  47.134 +    /* A 'Roaming' folder is available on Windows 8 and 8.1.  Use that. */
  47.135 +    const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_ROAMING_FOLDER);
  47.136 +#endif
  47.137 +
  47.138 +    size_t destPathLen;
  47.139 +    char * destPath = NULL;
  47.140 +
  47.141 +    if (!srcPath) {
  47.142 +        SDL_SetError("Couldn't locate our basepath: %s", SDL_GetError());
  47.143 +        return NULL;
  47.144 +    }
  47.145 +
  47.146 +    destPathLen = SDL_strlen(srcPath) + SDL_strlen(org) + SDL_strlen(app) + 4;
  47.147 +    destPath = (char *) SDL_malloc(destPathLen);
  47.148 +    if (!destPath) {
  47.149 +        SDL_OutOfMemory();
  47.150 +        return NULL;
  47.151 +    }
  47.152 +
  47.153 +    SDL_snprintf(destPath, destPathLen, "%s\\%s\\%s\\", srcPath, org, app);
  47.154 +    return destPath;
  47.155 +}
  47.156 +
  47.157 +#endif /* __WINRT__ */
    48.1 --- a/src/joystick/SDL_gamecontroller.c	Sun Mar 09 10:38:30 2014 -0700
    48.2 +++ b/src/joystick/SDL_gamecontroller.c	Sun Mar 09 11:36:47 2014 -0700
    48.3 @@ -88,7 +88,7 @@
    48.4  } ControllerMapping_t;
    48.5  
    48.6  static ControllerMapping_t *s_pSupportedControllers = NULL;
    48.7 -#ifdef SDL_JOYSTICK_DINPUT
    48.8 +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
    48.9  static ControllerMapping_t *s_pXInputMapping = NULL;
   48.10  #endif
   48.11  
   48.12 @@ -279,7 +279,7 @@
   48.13   */
   48.14  ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
   48.15  {
   48.16 -#ifdef SDL_JOYSTICK_DINPUT
   48.17 +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
   48.18      if ( SDL_SYS_IsXInputDeviceIndex(device_index) && s_pXInputMapping )
   48.19      {
   48.20          return s_pXInputMapping;
   48.21 @@ -737,7 +737,7 @@
   48.22      char *pchMapping;
   48.23      SDL_JoystickGUID jGUID;
   48.24      ControllerMapping_t *pControllerMapping;
   48.25 -#ifdef SDL_JOYSTICK_DINPUT
   48.26 +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
   48.27      SDL_bool is_xinput_mapping = SDL_FALSE;
   48.28  #endif
   48.29  
   48.30 @@ -745,7 +745,7 @@
   48.31      if (!pchGUID) {
   48.32          return SDL_SetError("Couldn't parse GUID from %s", mappingString);
   48.33      }
   48.34 -#ifdef SDL_JOYSTICK_DINPUT
   48.35 +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
   48.36      if ( !SDL_strcasecmp( pchGUID, "xinput" ) ) {
   48.37          is_xinput_mapping = SDL_TRUE;
   48.38      }
   48.39 @@ -782,7 +782,7 @@
   48.40              SDL_free( pchMapping );
   48.41              return SDL_OutOfMemory();
   48.42          }
   48.43 -#ifdef SDL_JOYSTICK_DINPUT
   48.44 +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
   48.45          if ( is_xinput_mapping )
   48.46          {
   48.47              s_pXInputMapping = pControllerMapping;
    49.1 --- a/src/joystick/SDL_gamecontrollerdb.h	Sun Mar 09 10:38:30 2014 -0700
    49.2 +++ b/src/joystick/SDL_gamecontrollerdb.h	Sun Mar 09 11:36:47 2014 -0700
    49.3 @@ -42,6 +42,8 @@
    49.4      "25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,",
    49.5      "4c05c405000000000000504944564944,PS4 Controller,a:a3,a:b1,b:b2,back:b8,dpdown:h0.0,dpdown:h0.4,dpleft:h0.8,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,guide:b12,leftshoulder:b4,leftshoulder:h0.0,leftstick:b10,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightshoulder:b6,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:a4,x:b0,y:b3,",
    49.6      "xinput,X360 Controller,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b0,guide:b14,leftshoulder:b8,leftstick:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:a5,rightx:a2,righty:a3,start:b4,x:b12,y:b13,",
    49.7 +#elif defined(SDL_JOYSTICK_XINPUT)
    49.8 +    "xinput,X360 Controller,a:b10,b:b11,back:b5,dpdown:b1,dpleft:b2,dpright:b3,dpup:b0,guide:b14,leftshoulder:b8,leftstick:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:a5,rightx:a2,righty:a3,start:b4,x:b12,y:b13,",
    49.9  #elif defined(__MACOSX__)
   49.10      "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
   49.11      "6d0400000000000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */
    50.1 --- a/src/joystick/SDL_sysjoystick.h	Sun Mar 09 10:38:30 2014 -0700
    50.2 +++ b/src/joystick/SDL_sysjoystick.h	Sun Mar 09 11:36:47 2014 -0700
    50.3 @@ -108,7 +108,7 @@
    50.4  /* Function to return the stable GUID for a opened joystick */
    50.5  extern SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick);
    50.6  
    50.7 -#ifdef SDL_JOYSTICK_DINPUT
    50.8 +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
    50.9  /* Function to get the current instance id of the joystick located at device_index */
   50.10  extern SDL_bool SDL_SYS_IsXInputDeviceIndex( int device_index );
   50.11  extern SDL_bool SDL_SYS_IsXInputJoystick(SDL_Joystick * joystick);
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/src/joystick/winrt/SDL_xinputjoystick.c	Sun Mar 09 11:36:47 2014 -0700
    51.3 @@ -0,0 +1,537 @@
    51.4 +/*
    51.5 +  Simple DirectMedia Layer
    51.6 +  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    51.7 +
    51.8 +  This software is provided 'as-is', without any express or implied
    51.9 +  warranty.  In no event will the authors be held liable for any damages
   51.10 +  arising from the use of this software.
   51.11 +
   51.12 +  Permission is granted to anyone to use this software for any purpose,
   51.13 +  including commercial applications, and to alter it and redistribute it
   51.14 +  freely, subject to the following restrictions:
   51.15 +
   51.16 +  1. The origin of this software must not be misrepresented; you must not
   51.17 +     claim that you wrote the original software. If you use this software
   51.18 +     in a product, an acknowledgment in the product documentation would be
   51.19 +     appreciated but is not required.
   51.20 +  2. Altered source versions must be plainly marked as such, and must not be
   51.21 +     misrepresented as being the original software.
   51.22 +  3. This notice may not be removed or altered from any source distribution.
   51.23 +*/
   51.24 +#include "SDL_config.h"
   51.25 +
   51.26 +#if SDL_JOYSTICK_XINPUT
   51.27 +
   51.28 +/* SDL_xinputjoystick.c implements an XInput-only joystick and game controller
   51.29 +   backend that is suitable for use on WinRT.  SDL's DirectInput backend, also
   51.30 +   XInput-capable, was not used as DirectInput is not available on WinRT (or,
   51.31 +   at least, it isn't a public API).  Some portions of this XInput backend
   51.32 +   may copy parts of the XInput-using code from the DirectInput backend.
   51.33 +   Refactoring the common parts into one location may be good to-do at some
   51.34 +   point.
   51.35 +
   51.36 +   TODO, WinRT: add hotplug support for XInput based game controllers
   51.37 +*/
   51.38 +
   51.39 +#include "SDL_joystick.h"
   51.40 +#include "../SDL_sysjoystick.h"
   51.41 +#include "../SDL_joystick_c.h"
   51.42 +#include "SDL_events.h"
   51.43 +#include "../../events/SDL_events_c.h"
   51.44 +#include "SDL_timer.h"
   51.45 +
   51.46 +#include <Windows.h>
   51.47 +#include <Xinput.h>
   51.48 +
   51.49 +struct joystick_hwdata {
   51.50 +    //Uint8 bXInputHaptic; // Supports force feedback via XInput.
   51.51 +    DWORD userIndex;    // The XInput device index, in the range [0, XUSER_MAX_COUNT-1] (probably [0,3]).
   51.52 +    XINPUT_STATE XInputState;   // the last-read in XInputState, kept around to compare old and new values
   51.53 +    SDL_bool isDeviceConnected; // was the device connected (on the last detection-polling, or during backend-initialization)?
   51.54 +    SDL_bool isDeviceConnectionEventPending;    // was a device added, and is the associated add-event pending?
   51.55 +    SDL_bool isDeviceRemovalEventPending;   // was the device removed, and is the associated remove-event pending?
   51.56 +};
   51.57 +
   51.58 +/* Keep track of data on all XInput devices, regardless of whether or not
   51.59 +   they've been opened (via SDL_JoystickOpen).
   51.60 + */
   51.61 +static struct joystick_hwdata g_XInputData[XUSER_MAX_COUNT];
   51.62 +
   51.63 +/* Device detection can be extremely costly performance-wise, in some cases.
   51.64 +   In particular, if no devices are connected, calls to detect a single device,
   51.65 +   via either XInputGetState() or XInputGetCapabilities(), can take upwards of
   51.66 +   20 ms on a 1st generation Surface RT, more if devices are detected across
   51.67 +   all of of XInput's four device slots.  WinRT and XInput do not appear to
   51.68 +   have callback-based APIs to notify an app when a device is connected, at
   51.69 +   least as of Windows 8.1.  The synchronous XInput calls must be used.
   51.70 +
   51.71 +   Once a device is connected, calling XInputGetState() is a much less costly
   51.72 +   operation, with individual calls costing well under 1 ms, and often under
   51.73 +   0.1 ms [on a 1st gen Surface RT].
   51.74 +
   51.75 +   With XInput's performance limitations in mind, a separate device-detection
   51.76 +   thread will be utilized (by SDL) to try to move costly XInput calls off the
   51.77 +   main thread.  Polling of active devices still, however, occurs on the main
   51.78 +   thread.
   51.79 + */
   51.80 +static SDL_Thread * g_DeviceDetectionThread = NULL;
   51.81 +static SDL_mutex * g_DeviceInfoLock = NULL;
   51.82 +static SDL_bool g_DeviceDetectionQuit = SDL_FALSE;
   51.83 +
   51.84 +/* Main function for the device-detection thread.
   51.85 + */
   51.86 +static int
   51.87 +DeviceDetectionThreadMain(void * _data)
   51.88 +{
   51.89 +    DWORD result;
   51.90 +    XINPUT_CAPABILITIES tempXInputCaps;
   51.91 +    int i;
   51.92 +
   51.93 +    while (1) {
   51.94 +        /* See if the device-detection thread is being asked to shutdown.
   51.95 +         */
   51.96 +        SDL_LockMutex(g_DeviceInfoLock);
   51.97 +        if (g_DeviceDetectionQuit) {
   51.98 +            SDL_UnlockMutex(g_DeviceInfoLock);
   51.99 +            break;
  51.100 +        }
  51.101 +        SDL_UnlockMutex(g_DeviceInfoLock);
  51.102 +
  51.103 +        /* Add a short delay to prevent the device-detection thread from eating
  51.104 +           up too much CPU time:
  51.105 +         */
  51.106 +        SDL_Delay(300);
  51.107 +
  51.108 +        /* TODO, WinRT: try making the device-detection thread wakeup sooner from its CPU-preserving SDL_Delay, if the thread was asked to quit.
  51.109 +         */
  51.110 +
  51.111 +        /* See if any new devices are connected. */
  51.112 +        SDL_LockMutex(g_DeviceInfoLock);
  51.113 +        for (i = 0; i < XUSER_MAX_COUNT; ++i) {
  51.114 +            if (!g_XInputData[i].isDeviceConnected &&
  51.115 +                !g_XInputData[i].isDeviceConnectionEventPending &&
  51.116 +                !g_XInputData[i].isDeviceRemovalEventPending)
  51.117 +            {
  51.118 +                SDL_UnlockMutex(g_DeviceInfoLock);
  51.119 +                result = XInputGetCapabilities(i, 0, &tempXInputCaps);
  51.120 +                SDL_LockMutex(g_DeviceInfoLock);
  51.121 +                if (result == ERROR_SUCCESS) {
  51.122 +                    /* Yes, a device is connected.  Mark it as such.
  51.123 +                       Others will be told about this (via an
  51.124 +                       SDL_JOYDEVICEADDED event) in the next call to
  51.125 +                       SDL_SYS_JoystickDetect.
  51.126 +                     */
  51.127 +                    g_XInputData[i].isDeviceConnected = SDL_TRUE;
  51.128 +                    g_XInputData[i].isDeviceConnectionEventPending = SDL_TRUE;
  51.129 +                }
  51.130 +            }
  51.131 +        }
  51.132 +        SDL_UnlockMutex(g_DeviceInfoLock);
  51.133 +    }
  51.134 +
  51.135 +    return 0;
  51.136 +}
  51.137 +
  51.138 +/* Function to scan the system for joysticks.
  51.139 + * It should return 0, or -1 on an unrecoverable fatal error.
  51.140 + */
  51.141 +int
  51.142 +SDL_SYS_JoystickInit(void)
  51.143 +{
  51.144 +    HRESULT result = S_OK;
  51.145 +    XINPUT_STATE tempXInputState;
  51.146 +    int i;
  51.147 +
  51.148 +    SDL_zero(g_XInputData);
  51.149 +
  51.150 +    /* Make initial notes on whether or not devices are connected (or not).
  51.151 +     */
  51.152 +    for (i = 0; i < XUSER_MAX_COUNT; ++i) {
  51.153 +        result = XInputGetState(i, &tempXInputState);
  51.154 +        if (result == ERROR_SUCCESS) {
  51.155 +            g_XInputData[i].isDeviceConnected = SDL_TRUE;
  51.156 +        }
  51.157 +    }
  51.158 +
  51.159 +    /* Start up the device-detection thread.
  51.160 +     */
  51.161 +    g_DeviceDetectionQuit = SDL_FALSE;
  51.162 +    g_DeviceInfoLock = SDL_CreateMutex();
  51.163 +    g_DeviceDetectionThread = SDL_CreateThread(DeviceDetectionThreadMain, "SDL_joystick", NULL);
  51.164 +
  51.165 +    return (0);
  51.166 +}
  51.167 +
  51.168 +int SDL_SYS_NumJoysticks()
  51.169 +{
  51.170 +    int joystickCount = 0;
  51.171 +    DWORD i;
  51.172 +
  51.173 +    /* Iterate through each possible XInput device and see if something
  51.174 +       was connected (at joystick init, or during the last polling).
  51.175 +     */
  51.176 +    SDL_LockMutex(g_DeviceInfoLock);
  51.177 +    for (i = 0; i < XUSER_MAX_COUNT; ++i) {
  51.178 +        if (g_XInputData[i].isDeviceConnected) {
  51.179 +            ++joystickCount;
  51.180 +        }
  51.181 +    }
  51.182 +    SDL_UnlockMutex(g_DeviceInfoLock);
  51.183 +
  51.184 +    return joystickCount;
  51.185 +}
  51.186 +
  51.187 +void SDL_SYS_JoystickDetect()
  51.188 +{
  51.189 +    DWORD i;
  51.190 +    SDL_Event event;
  51.191 +
  51.192 +    /* Iterate through each possible XInput device, seeing if any devices
  51.193 +       have been connected, or if they were removed.
  51.194 +     */
  51.195 +    SDL_LockMutex(g_DeviceInfoLock);
  51.196 +    for (i = 0; i < XUSER_MAX_COUNT; ++i) {
  51.197 +        /* See if any new devices are connected. */
  51.198 +        if (g_XInputData[i].isDeviceConnectionEventPending) {
  51.199 +#if !SDL_EVENTS_DISABLED
  51.200 +            SDL_zero(event);
  51.201 +            event.type = SDL_JOYDEVICEADDED;
  51.202 +                
  51.203 +            if (SDL_GetEventState(event.type) == SDL_ENABLE) {
  51.204 +                event.jdevice.which = i;
  51.205 +                if ((SDL_EventOK == NULL)
  51.206 +                    || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
  51.207 +                    SDL_PushEvent(&event);
  51.208 +                }
  51.209 +            }
  51.210 +#endif
  51.211 +            g_XInputData[i].isDeviceConnectionEventPending = SDL_FALSE;
  51.212 +        } else if (g_XInputData[i].isDeviceRemovalEventPending) {
  51.213 +            /* A device was previously marked as removed (by
  51.214 +               SDL_SYS_JoystickUpdate).  Tell others about the device removal.
  51.215 +            */
  51.216 +
  51.217 +            g_XInputData[i].isDeviceRemovalEventPending = SDL_FALSE;
  51.218 +
  51.219 +#if !SDL_EVENTS_DISABLED
  51.220 +            SDL_zero(event);
  51.221 +            event.type = SDL_JOYDEVICEREMOVED;
  51.222 +                
  51.223 +            if (SDL_GetEventState(event.type) == SDL_ENABLE) {
  51.224 +                event.jdevice.which = i; //joystick->hwdata->userIndex;
  51.225 +                if ((SDL_EventOK == NULL)
  51.226 +                    || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
  51.227 +                    SDL_PushEvent(&event);
  51.228 +                }
  51.229 +            }
  51.230 +#endif
  51.231 +        }
  51.232 +    }
  51.233 +    SDL_UnlockMutex(g_DeviceInfoLock);
  51.234 +}
  51.235 +
  51.236 +SDL_bool SDL_SYS_JoystickNeedsPolling()
  51.237 +{
  51.238 +    /* Since XInput, or WinRT, provides any events to indicate when a game
  51.239 +       controller gets connected, and instead indicates device availability
  51.240 +       solely through polling, we'll poll (for new devices).
  51.241 +     */
  51.242 +    return SDL_TRUE;
  51.243 +}
  51.244 +
  51.245 +/* Internal function to retreive device capabilities.
  51.246 +   This function will return an SDL-standard value of 0 on success
  51.247 +   (a device is connected, and data on it was retrieved), or -1
  51.248 +   on failure (no device was connected, or some other error
  51.249 +   occurred.  SDL_SetError() will be invoked to set an appropriate
  51.250 +   error message.
  51.251 + */
  51.252 +static int
  51.253 +SDL_XInput_GetDeviceCapabilities(int device_index, XINPUT_CAPABILITIES * pDeviceCaps)
  51.254 +{
  51.255 +    HRESULT dwResult;
  51.256 +
  51.257 +    /* Make sure that the device index is a valid one.  If not, return to the
  51.258 +       caller with an error.
  51.259 +     */
  51.260 +    if (device_index < 0 || device_index >= XUSER_MAX_COUNT) {
  51.261 +        return SDL_SetError("invalid/unavailable device index");
  51.262 +    }
  51.263 +
  51.264 +    /* See if a device exists, and if so, what its capabilities are.  If a
  51.265 +       device is not available, return to the caller with an error.
  51.266 +     */
  51.267 +    switch ((dwResult = XInputGetCapabilities(device_index, 0, pDeviceCaps))) {
  51.268 +        case ERROR_SUCCESS:
  51.269 +            /* A device is available, and its capabilities were retrieved! */
  51.270 +            return 0;
  51.271 +        case ERROR_DEVICE_NOT_CONNECTED:
  51.272 +            return SDL_SetError("no device is connected at joystick index, %d", device_index);
  51.273 +        default:
  51.274 +            return SDL_SetError("an unknown error occurred when retrieving info on a device at joystick index, %d", device_index);
  51.275 +    }
  51.276 +}
  51.277 +
  51.278 +/* Function to get the device-dependent name of a joystick */
  51.279 +const char *
  51.280 +SDL_SYS_JoystickNameForDeviceIndex(int device_index)
  51.281 +{
  51.282 +    XINPUT_CAPABILITIES deviceCaps;
  51.283 +
  51.284 +    if (SDL_XInput_GetDeviceCapabilities(device_index, &deviceCaps) != 0) {
  51.285 +        /* Uh oh.  Device capabilities couldn't be retrieved.  Return to the
  51.286 +           caller.  SDL_SetError() has already been invoked (with relevant
  51.287 +           information).
  51.288 +         */
  51.289 +        return NULL;
  51.290 +    }
  51.291 +
  51.292 +    switch (deviceCaps.SubType) {
  51.293 +        default:
  51.294 +            if (deviceCaps.Type == XINPUT_DEVTYPE_GAMEPAD) {
  51.295 +                return "Undefined game controller";
  51.296 +            } else {
  51.297 +                return "Undefined controller";
  51.298 +            }
  51.299 +        case XINPUT_DEVSUBTYPE_UNKNOWN:
  51.300 +            if (deviceCaps.Type == XINPUT_DEVTYPE_GAMEPAD) {
  51.301 +                return "Unknown game controller";
  51.302 +            } else {
  51.303 +                return "Unknown controller";
  51.304 +            }
  51.305 +        case XINPUT_DEVSUBTYPE_GAMEPAD:
  51.306 +            return "Gamepad controller";
  51.307 +        case XINPUT_DEVSUBTYPE_WHEEL:
  51.308 +            return "Racing wheel controller";
  51.309 +        case XINPUT_DEVSUBTYPE_ARCADE_STICK:
  51.310 +            return "Arcade stick controller";
  51.311 +        case XINPUT_DEVSUBTYPE_FLIGHT_STICK:
  51.312 +            return "Flight stick controller";
  51.313 +        case XINPUT_DEVSUBTYPE_DANCE_PAD:
  51.314 +            return "Dance pad controller";
  51.315 +        case XINPUT_DEVSUBTYPE_GUITAR:
  51.316 +            return "Guitar controller";
  51.317 +        case XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE:
  51.318 +            return "Guitar controller, Alternate";
  51.319 +        case XINPUT_DEVSUBTYPE_GUITAR_BASS:
  51.320 +            return "Guitar controller, Bass";
  51.321 +        case XINPUT_DEVSUBTYPE_DRUM_KIT:
  51.322 +            return "Drum controller";
  51.323 +        case XINPUT_DEVSUBTYPE_ARCADE_PAD:
  51.324 +            return "Arcade pad controller";
  51.325 +    }
  51.326 +}
  51.327 +
  51.328 +/* Function to perform the mapping from device index to the instance id for this index */
  51.329 +SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
  51.330 +{
  51.331 +    return device_index;
  51.332 +}
  51.333 +
  51.334 +/* Function to open a joystick for use.
  51.335 +   The joystick to open is specified by the index field of the joystick.
  51.336 +   This should fill the nbuttons and naxes fields of the joystick structure.
  51.337 +   It returns 0, or -1 if there is an error.
  51.338 + */
  51.339 +int
  51.340 +SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
  51.341 +{
  51.342 +    XINPUT_CAPABILITIES deviceCaps;
  51.343 +
  51.344 +    if (SDL_XInput_GetDeviceCapabilities(device_index, &deviceCaps) != 0) {
  51.345 +        /* Uh oh.  Device capabilities couldn't be retrieved.  Return to the
  51.346 +           caller.  SDL_SetError() has already been invoked (with relevant
  51.347 +           information).
  51.348 +         */
  51.349 +        return -1;
  51.350 +    }
  51.351 +
  51.352 +    /* For now, only game pads are supported.  If the device is something other
  51.353 +       than that, return an error to the caller.
  51.354 +     */
  51.355 +    if (deviceCaps.Type != XINPUT_DEVTYPE_GAMEPAD) {
  51.356 +        return SDL_SetError("a device is connected (at joystick index, %d), but it is of an unknown device type (deviceCaps.Flags=%ul)",
  51.357 +            device_index, (unsigned int)deviceCaps.Flags);
  51.358 +    }
  51.359 +
  51.360 +    /* Create the joystick data structure */
  51.361 +    joystick->instance_id = device_index;
  51.362 +    joystick->hwdata = &g_XInputData[device_index];
  51.363 +
  51.364 +    // The XInput API has a hard coded button/axis mapping, so we just match it
  51.365 +    joystick->naxes = 6;
  51.366 +    joystick->nbuttons = 15;
  51.367 +    joystick->nballs = 0;
  51.368 +    joystick->nhats = 0;
  51.369 +
  51.370 +    /* We're done! */
  51.371 +    return (0);
  51.372 +}
  51.373 +
  51.374 +/* Function to determine is this joystick is attached to the system right now */
  51.375 +SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
  51.376 +{
  51.377 +    SDL_bool isDeviceConnected;
  51.378 +    SDL_LockMutex(g_DeviceInfoLock);
  51.379 +    isDeviceConnected = joystick->hwdata->isDeviceConnected;
  51.380 +    SDL_UnlockMutex(g_DeviceInfoLock);
  51.381 +    return isDeviceConnected;
  51.382 +}
  51.383 +
  51.384 +/* Function to return > 0 if a bit array of buttons differs after applying a mask
  51.385 +*/
  51.386 +static int ButtonChanged( int ButtonsNow, int ButtonsPrev, int ButtonMask )
  51.387 +{
  51.388 +    return ( ButtonsNow & ButtonMask ) != ( ButtonsPrev & ButtonMask );
  51.389 +}
  51.390 +
  51.391 +/* Function to update the state of a joystick - called as a device poll.
  51.392 + * This function shouldn't update the joystick structure directly,
  51.393 + * but instead should call SDL_PrivateJoystick*() to deliver events
  51.394 + * and update joystick device state.
  51.395 + */
  51.396 +void
  51.397 +SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
  51.398 +{
  51.399 +    HRESULT result;
  51.400 +    XINPUT_STATE prevXInputState;
  51.401 +
  51.402 +    SDL_LockMutex(g_DeviceInfoLock);
  51.403 +
  51.404 +    /* Before polling for new data, make note of the old data */
  51.405 +    prevXInputState = joystick->hwdata->XInputState;
  51.406 +
  51.407 +    /* Poll for new data */
  51.408 +    result = XInputGetState(joystick->hwdata->userIndex, &joystick->hwdata->XInputState);
  51.409 +    if (result == ERROR_DEVICE_NOT_CONNECTED) {
  51.410 +        if (joystick->hwdata->isDeviceConnected) {
  51.411 +            joystick->hwdata->isDeviceConnected = SDL_FALSE;
  51.412 +            joystick->hwdata->isDeviceRemovalEventPending = SDL_TRUE;
  51.413 +            /* TODO, WinRT: make sure isDeviceRemovalEventPending gets cleared as appropriate, and that quick re-plugs don't cause trouble */
  51.414 +        }
  51.415 +        SDL_UnlockMutex(g_DeviceInfoLock);
  51.416 +        return;
  51.417 +    }
  51.418 +
  51.419 +    /* Make sure the device is marked as connected */
  51.420 +    joystick->hwdata->isDeviceConnected = SDL_TRUE;
  51.421 +
  51.422 +    // only fire events if the data changed from last time
  51.423 +    if ( joystick->hwdata->XInputState.dwPacketNumber != 0 
  51.424 +        && joystick->hwdata->XInputState.dwPacketNumber != prevXInputState.dwPacketNumber )
  51.425 +    {
  51.426 +        XINPUT_STATE *pXInputState = &joystick->hwdata->XInputState;
  51.427 +        XINPUT_STATE *pXInputStatePrev = &prevXInputState;
  51.428 +
  51.429 +        SDL_PrivateJoystickAxis(joystick, 0, (Sint16)pXInputState->Gamepad.sThumbLX );
  51.430 +        SDL_PrivateJoystickAxis(joystick, 1, (Sint16)(-1*pXInputState->Gamepad.sThumbLY-1) );
  51.431 +        SDL_PrivateJoystickAxis(joystick, 2, (Sint16)pXInputState->Gamepad.sThumbRX );
  51.432 +        SDL_PrivateJoystickAxis(joystick, 3, (Sint16)(-1*pXInputState->Gamepad.sThumbRY-1) );
  51.433 +        SDL_PrivateJoystickAxis(joystick, 4, (Sint16)((int)pXInputState->Gamepad.bLeftTrigger*32767/255) );
  51.434 +        SDL_PrivateJoystickAxis(joystick, 5, (Sint16)((int)pXInputState->Gamepad.bRightTrigger*32767/255) );
  51.435 +
  51.436 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_UP ) )
  51.437 +            SDL_PrivateJoystickButton(joystick, 0, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP ? SDL_PRESSED :	SDL_RELEASED );
  51.438 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_DOWN ) )
  51.439 +            SDL_PrivateJoystickButton(joystick, 1, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN ? SDL_PRESSED :	SDL_RELEASED );
  51.440 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_LEFT ) )
  51.441 +            SDL_PrivateJoystickButton(joystick, 2, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT ? SDL_PRESSED :	SDL_RELEASED );
  51.442 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_RIGHT ) )
  51.443 +            SDL_PrivateJoystickButton(joystick, 3, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT ? SDL_PRESSED :	SDL_RELEASED );
  51.444 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_START ) )
  51.445 +            SDL_PrivateJoystickButton(joystick, 4, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_START ? SDL_PRESSED :	SDL_RELEASED );
  51.446 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_BACK ) )
  51.447 +            SDL_PrivateJoystickButton(joystick, 5, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_BACK ? SDL_PRESSED :	SDL_RELEASED );
  51.448 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_LEFT_THUMB ) )
  51.449 +            SDL_PrivateJoystickButton(joystick, 6, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB ? SDL_PRESSED :	SDL_RELEASED );
  51.450 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_RIGHT_THUMB ) )
  51.451 +            SDL_PrivateJoystickButton(joystick, 7, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB ? SDL_PRESSED :	SDL_RELEASED );
  51.452 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_LEFT_SHOULDER ) )
  51.453 +            SDL_PrivateJoystickButton(joystick, 8, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER ? SDL_PRESSED :	SDL_RELEASED );
  51.454 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_RIGHT_SHOULDER ) )
  51.455 +            SDL_PrivateJoystickButton(joystick, 9, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER ? SDL_PRESSED :	SDL_RELEASED );
  51.456 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_A ) )
  51.457 +            SDL_PrivateJoystickButton(joystick, 10, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_A ? SDL_PRESSED :	SDL_RELEASED );
  51.458 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_B ) )
  51.459 +            SDL_PrivateJoystickButton(joystick, 11, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_B ? SDL_PRESSED :	SDL_RELEASED );
  51.460 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_X ) )
  51.461 +            SDL_PrivateJoystickButton(joystick, 12, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_X ? SDL_PRESSED :	SDL_RELEASED );
  51.462 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_Y ) )
  51.463 +            SDL_PrivateJoystickButton(joystick, 13, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_Y ? SDL_PRESSED :	SDL_RELEASED );
  51.464 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons,  0x400 ) )
  51.465 +            SDL_PrivateJoystickButton(joystick, 14, pXInputState->Gamepad.wButtons & 0x400 ? SDL_PRESSED :	SDL_RELEASED ); // 0x400 is the undocumented code for the guide button
  51.466 +    }
  51.467 +
  51.468 +    SDL_UnlockMutex(g_DeviceInfoLock);
  51.469 +}
  51.470 +
  51.471 +/* Function to close a joystick after use */
  51.472 +void
  51.473 +SDL_SYS_JoystickClose(SDL_Joystick * joystick)
  51.474 +{
  51.475 +    /* Clear cached button data on the joystick */
  51.476 +    SDL_LockMutex(g_DeviceInfoLock);
  51.477 +    SDL_zero(joystick->hwdata->XInputState);
  51.478 +    SDL_UnlockMutex(g_DeviceInfoLock);
  51.479 +
  51.480 +    /* There's need to free 'hwdata', as it's a pointer to a global array.
  51.481 +       The field will be cleared anyways, just to indicate that it's not
  51.482 +       currently needed.
  51.483 +     */
  51.484 +    joystick->hwdata = NULL;
  51.485 +}
  51.486 +
  51.487 +/* Function to perform any system-specific joystick related cleanup */
  51.488 +void
  51.489 +SDL_SYS_JoystickQuit(void)
  51.490 +{
  51.491 +    /* Tell the joystick detection thread to stop, then wait for it to finish */
  51.492 +    SDL_LockMutex(g_DeviceInfoLock);
  51.493 +    g_DeviceDetectionQuit = SDL_TRUE;
  51.494 +    SDL_UnlockMutex(g_DeviceInfoLock);
  51.495 +    SDL_WaitThread(g_DeviceDetectionThread, NULL);
  51.496 +
  51.497 +    /* Clean up device-detection stuff */
  51.498 +    SDL_DestroyMutex(g_DeviceInfoLock);
  51.499 +    g_DeviceInfoLock = NULL;
  51.500 +    g_DeviceDetectionThread = NULL;
  51.501 +    g_DeviceDetectionQuit = SDL_FALSE;
  51.502 +
  51.503 +    return;
  51.504 +}
  51.505 +
  51.506 +SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
  51.507 +{
  51.508 +    SDL_JoystickGUID guid;
  51.509 +    // the GUID is just the first 16 chars of the name for now
  51.510 +    const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
  51.511 +    SDL_zero( guid );
  51.512 +    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
  51.513 +    return guid;
  51.514 +}
  51.515 +
  51.516 +
  51.517 +SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
  51.518 +{
  51.519 +    SDL_JoystickGUID guid;
  51.520 +    // the GUID is just the first 16 chars of the name for now
  51.521 +    const char *name = joystick->name;
  51.522 +    SDL_zero( guid );
  51.523 +    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
  51.524 +    return guid;
  51.525 +}
  51.526 +
  51.527 +SDL_bool SDL_SYS_IsXInputDeviceIndex(int device_index)
  51.528 +{
  51.529 +    /* The XInput-capable DirectInput joystick backend implements the same
  51.530 +       function (SDL_SYS_IsXInputDeviceIndex), however in that case, not all
  51.531 +       joystick devices are XInput devices.  In this case, with the
  51.532 +       WinRT-enabled XInput-only backend, all "joystick" devices are XInput
  51.533 +       devices.
  51.534 +     */
  51.535 +    return SDL_TRUE;
  51.536 +}
  51.537 +
  51.538 +#endif /* SDL_JOYSTICK_XINPUT */
  51.539 +
  51.540 +/* vi: set ts=4 sw=4 expandtab: */
    52.1 --- a/src/loadso/windows/SDL_sysloadso.c	Sun Mar 09 10:38:30 2014 -0700
    52.2 +++ b/src/loadso/windows/SDL_sysloadso.c	Sun Mar 09 11:36:47 2014 -0700
    52.3 @@ -33,7 +33,15 @@
    52.4  SDL_LoadObject(const char *sofile)
    52.5  {
    52.6      LPTSTR tstr = WIN_UTF8ToString(sofile);
    52.7 +#ifdef __WINRT__
    52.8 +    /* WinRT only publically supports LoadPackagedLibrary() for loading .dll
    52.9 +       files.  LoadLibrary() is a private API, and not available for apps
   52.10 +       (that can be published to MS' Windows Store.)
   52.11 +    */
   52.12 +    void *handle = (void *) LoadPackagedLibrary(tstr, 0);
   52.13 +#else
   52.14      void *handle = (void *) LoadLibrary(tstr);
   52.15 +#endif
   52.16      SDL_free(tstr);
   52.17  
   52.18      /* Generate an error message if all loads failed */
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/src/main/winrt/SDL_winrt_main_NonXAML.cpp	Sun Mar 09 11:36:47 2014 -0700
    53.3 @@ -0,0 +1,56 @@
    53.4 +
    53.5 +#include <SDL_main.h>
    53.6 +#include <wrl.h>
    53.7 +
    53.8 +/* At least one file in any SDL/WinRT app appears to require compilation
    53.9 +   with C++/CX, otherwise a Windows Metadata file won't get created, and
   53.10 +   an APPX0702 build error can appear shortly after linking.
   53.11 +
   53.12 +   The following set of preprocessor code forces this file to be compiled
   53.13 +   as C++/CX, which appears to cause Visual C++ 2012's build tools to
   53.14 +   create this .winmd file, and will help allow builds of SDL/WinRT apps
   53.15 +   to proceed without error.
   53.16 +
   53.17 +   If other files in an app's project enable C++/CX compilation, then it might
   53.18 +   be possible for SDL_winrt_main_NonXAML.cpp to be compiled without /ZW,
   53.19 +   for Visual C++'s build tools to create a winmd file, and for the app to
   53.20 +   build without APPX0702 errors.  In this case, if
   53.21 +   SDL_WINRT_METADATA_FILE_AVAILABLE is defined as a C/C++ macro, then
   53.22 +   the #error (to force C++/CX compilation) will be disabled.
   53.23 +
   53.24 +   Please note that /ZW can be specified on a file-by-file basis.  To do this,
   53.25 +   right click on the file in Visual C++, click Properties, then change the
   53.26 +   setting through the dialog that comes up.
   53.27 +*/
   53.28 +#ifndef SDL_WINRT_METADATA_FILE_AVAILABLE
   53.29 +#ifndef __cplusplus_winrt
   53.30 +#error SDL_winrt_main_NonXAML.cpp must be compiled with /ZW, otherwise build errors due to missing .winmd files can occur.
   53.31 +#endif
   53.32 +#endif
   53.33 +
   53.34 +/* Prevent MSVC++ from warning about threading models when defining our
   53.35 +   custom WinMain.  The threading model will instead be set via a direct
   53.36 +   call to Windows::Foundation::Initialize (rather than via an attributed
   53.37 +   function).
   53.38 +
   53.39 +   To note, this warning (C4447) does not seem to come up unless this file
   53.40 +   is compiled with C++/CX enabled (via the /ZW compiler flag).
   53.41 +*/
   53.42 +#ifdef _MSC_VER
   53.43 +#pragma warning(disable:4447)
   53.44 +#endif
   53.45 +
   53.46 +/* Make sure the function to initialize the Windows Runtime gets linked in. */
   53.47 +#ifdef _MSC_VER
   53.48 +#pragma comment(lib, "runtimeobject.lib")
   53.49 +#endif
   53.50 +
   53.51 +int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
   53.52 +{
   53.53 +    if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) {
   53.54 +        return 1;
   53.55 +    }
   53.56 +
   53.57 +    SDL_WinRTRunApp(SDL_main, NULL);
   53.58 +    return 0;
   53.59 +}
    54.1 --- a/src/render/SDL_render.c	Sun Mar 09 10:38:30 2014 -0700
    54.2 +++ b/src/render/SDL_render.c	Sun Mar 09 11:36:47 2014 -0700
    54.3 @@ -50,6 +50,9 @@
    54.4  #if SDL_VIDEO_RENDER_D3D
    54.5      &D3D_RenderDriver,
    54.6  #endif
    54.7 +#if SDL_VIDEO_RENDER_D3D11
    54.8 +    &D3D11_RenderDriver,
    54.9 +#endif
   54.10  #if SDL_VIDEO_RENDER_OGL
   54.11      &GL_RenderDriver,
   54.12  #endif
    55.1 --- a/src/render/SDL_sysrender.h	Sun Mar 09 10:38:30 2014 -0700
    55.2 +++ b/src/render/SDL_sysrender.h	Sun Mar 09 11:36:47 2014 -0700
    55.3 @@ -171,6 +171,9 @@
    55.4  #if SDL_VIDEO_RENDER_D3D
    55.5  extern SDL_RenderDriver D3D_RenderDriver;
    55.6  #endif
    55.7 +#if SDL_VIDEO_RENDER_D3D11
    55.8 +extern SDL_RenderDriver D3D11_RenderDriver;
    55.9 +#endif
   55.10  #if SDL_VIDEO_RENDER_OGL
   55.11  extern SDL_RenderDriver GL_RenderDriver;
   55.12  #endif
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/src/render/direct3d11/SDL_render_d3d11.cpp	Sun Mar 09 11:36:47 2014 -0700
    56.3 @@ -0,0 +1,2386 @@
    56.4 +/*
    56.5 +  Simple DirectMedia Layer
    56.6 +  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
    56.7 +
    56.8 +  This software is provided 'as-is', without any express or implied
    56.9 +  warranty.  In no event will the authors be held liable for any damages
   56.10 +  arising from the use of this software.
   56.11 +
   56.12 +  Permission is granted to anyone to use this software for any purpose,
   56.13 +  including commercial applications, and to alter it and redistribute it
   56.14 +  freely, subject to the following restrictions:
   56.15 +
   56.16 +  1. The origin of this software must not be misrepresented; you must not
   56.17 +     claim that you wrote the original software. If you use this software
   56.18 +     in a product, an acknowledgment in the product documentation would be
   56.19 +     appreciated but is not required.
   56.20 +  2. Altered source versions must be plainly marked as such, and must not be
   56.21 +     misrepresented as being the original software.
   56.22 +  3. This notice may not be removed or altered from any source distribution.
   56.23 +*/
   56.24 +
   56.25 +#include "SDL_config.h"
   56.26 +
   56.27 +#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
   56.28 +
   56.29 +#ifdef __WINRT__
   56.30 +#include <windows.ui.core.h>
   56.31 +#include <windows.foundation.h>
   56.32 +
   56.33 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
   56.34 +#include <windows.ui.xaml.media.dxinterop.h>
   56.35 +#endif
   56.36 +
   56.37 +#endif
   56.38 +
   56.39 +extern "C" {
   56.40 +#include "../../core/windows/SDL_windows.h"
   56.41 +#include "SDL_hints.h"
   56.42 +#include "SDL_system.h"
   56.43 +#include "SDL_syswm.h"
   56.44 +#include "../SDL_sysrender.h"
   56.45 +#include "../../video/SDL_sysvideo.h"
   56.46 +}
   56.47 +
   56.48 +#include <string>
   56.49 +#include <vector>
   56.50 +
   56.51 +#include <D3D11_1.h>
   56.52 +#include <DirectXMath.h>
   56.53 +#include <wrl/client.h>
   56.54 +
   56.55 +
   56.56 +using namespace DirectX;
   56.57 +using namespace Microsoft::WRL;
   56.58 +using namespace std;
   56.59 +
   56.60 +#ifdef __WINRT__
   56.61 +using namespace Windows::Graphics::Display;
   56.62 +using namespace Windows::UI::Core;
   56.63 +#endif
   56.64 +
   56.65 +/* Texture sampling types */
   56.66 +static const D3D11_FILTER SDL_D3D11_NEAREST_PIXEL_FILTER = D3D11_FILTER_MIN_MAG_MIP_POINT;
   56.67 +static const D3D11_FILTER SDL_D3D11_LINEAR_FILTER = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
   56.68 +
   56.69 +/* Vertex shader, common values */
   56.70 +struct VertexShaderConstants
   56.71 +{
   56.72 +    DirectX::XMFLOAT4X4 model;
   56.73 +    DirectX::XMFLOAT4X4 projectionAndView;
   56.74 +};
   56.75 +
   56.76 +/* Per-vertex data */
   56.77 +struct VertexPositionColor
   56.78 +{
   56.79 +    DirectX::XMFLOAT3 pos;
   56.80 +    DirectX::XMFLOAT2 tex;
   56.81 +    DirectX::XMFLOAT4 color;
   56.82 +};
   56.83 +
   56.84 +/* Per-texture data */
   56.85 +typedef struct
   56.86 +{
   56.87 +    Microsoft::WRL::ComPtr<ID3D11Texture2D> mainTexture;
   56.88 +    Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> mainTextureResourceView;
   56.89 +    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> mainTextureRenderTargetView;
   56.90 +    SDL_PixelFormat * pixelFormat;
   56.91 +    Microsoft::WRL::ComPtr<ID3D11Texture2D> stagingTexture;
   56.92 +    DirectX::XMINT2 lockedTexturePosition;
   56.93 +    D3D11_FILTER scaleMode;
   56.94 +} D3D11_TextureData;
   56.95 +
   56.96 +/* Private renderer data */
   56.97 +typedef struct
   56.98 +{
   56.99 +    Microsoft::WRL::ComPtr<ID3D11Device1> d3dDevice;
  56.100 +    Microsoft::WRL::ComPtr<ID3D11DeviceContext1> d3dContext;
  56.101 +    Microsoft::WRL::ComPtr<IDXGISwapChain1> swapChain;
  56.102 +    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> mainRenderTargetView;
  56.103 +    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> currentOffscreenRenderTargetView;
  56.104 +    Microsoft::WRL::ComPtr<ID3D11InputLayout> inputLayout;
  56.105 +    Microsoft::WRL::ComPtr<ID3D11Buffer> vertexBuffer;
  56.106 +    Microsoft::WRL::ComPtr<ID3D11VertexShader> vertexShader;
  56.107 +    Microsoft::WRL::ComPtr<ID3D11PixelShader> texturePixelShader;
  56.108 +    Microsoft::WRL::ComPtr<ID3D11PixelShader> colorPixelShader;
  56.109 +    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeBlend;
  56.110 +    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeAdd;
  56.111 +    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeMod;
  56.112 +    Microsoft::WRL::ComPtr<ID3D11SamplerState> nearestPixelSampler;
  56.113 +    Microsoft::WRL::ComPtr<ID3D11SamplerState> linearSampler;
  56.114 +    D3D_FEATURE_LEVEL featureLevel;
  56.115 +
  56.116 +    // Rasterizers:
  56.117 +    // If this list starts to get unwieldy, then consider using a map<> of them.
  56.118 +    Microsoft::WRL::ComPtr<ID3D11RasterizerState> mainRasterizer;
  56.119 +    Microsoft::WRL::ComPtr<ID3D11RasterizerState> clippedRasterizer;
  56.120 +
  56.121 +    // Vertex buffer constants:
  56.122 +    VertexShaderConstants vertexShaderConstantsData;
  56.123 +    Microsoft::WRL::ComPtr<ID3D11Buffer> vertexShaderConstants;
  56.124 +
  56.125 +    // Cached renderer properties.
  56.126 +    DirectX::XMFLOAT2 windowSizeInDIPs;
  56.127 +    DirectX::XMFLOAT2 renderTargetSize;
  56.128 +    Windows::Graphics::Display::DisplayOrientations orientation;
  56.129 +
  56.130 +    // Transform used for display orientation.
  56.131 +    DirectX::XMFLOAT4X4 orientationTransform3D;
  56.132 +} D3D11_RenderData;
  56.133 +
  56.134 +
  56.135 +/* Direct3D 11.x shaders
  56.136 +
  56.137 +   SDL's shaders are compiled into SDL itself, to simplify distribution.
  56.138 +
  56.139 +   All Direct3D 11.x shaders were compiled with the following:
  56.140 +
  56.141 +   fxc /E"main" /T "<TYPE>" /Fo"<OUTPUT FILE>" "<INPUT FILE>"
  56.142 +
  56.143 +     Variables:
  56.144 +     - <TYPE>: the type of shader.  A table of utilized shader types is
  56.145 +       listed below.
  56.146 +     - <OUTPUT FILE>: where to store compiled output
  56.147 +     - <INPUT FILE>: where to read shader source code from
  56.148 +
  56.149 +     Shader types:
  56.150 +     - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT
  56.151 +     - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT
  56.152 +     - ps_4_0_level_9_3: Pixel shader for Windows Phone 8
  56.153 +     - vs_4_0_level_9_3: Vertex shader for Windows Phone 8
  56.154 +   
  56.155 +
  56.156 +   Shader object code was converted to a list of DWORDs via the following
  56.157 +   *nix style command (available separately from Windows + MSVC):
  56.158 +
  56.159 +     hexdump -v -e '6/4 "0x%08.8x, " "\n"' <FILE>
  56.160 +  */
  56.161 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  56.162 +#define D3D11_USE_SHADER_MODEL_4_0_level_9_3
  56.163 +#else
  56.164 +#define D3D11_USE_SHADER_MODEL_4_0_level_9_1
  56.165 +#endif
  56.166 +
  56.167 +/* The texture-rendering pixel shader:
  56.168 +
  56.169 +    --- D3D11_PixelShader_Textures.hlsl ---
  56.170 +    Texture2D theTexture : register(t0);
  56.171 +    SamplerState theSampler : register(s0);
  56.172 +
  56.173 +    struct PixelShaderInput
  56.174 +    {
  56.175 +        float4 pos : SV_POSITION;
  56.176 +        float2 tex : TEXCOORD0;
  56.177 +        float4 color : COLOR0;
  56.178 +    };
  56.179 +
  56.180 +    float4 main(PixelShaderInput input) : SV_TARGET
  56.181 +    {
  56.182 +        return theTexture.Sample(theSampler, input.tex) * input.color;
  56.183 +    }
  56.184 +*/
  56.185 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  56.186 +static const DWORD D3D11_PixelShader_Textures[] = {
  56.187 +    0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001,
  56.188 +    0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8,
  56.189 +    0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200,
  56.190 +    0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001,
  56.191 +    0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000,
  56.192 +    0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800,
  56.193 +    0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000,
  56.194 +    0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
  56.195 +    0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000,
  56.196 +    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
  56.197 +    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
  56.198 +    0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2,
  56.199 +    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
  56.200 +    0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
  56.201 +    0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003,
  56.202 +    0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000,
  56.203 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.204 +    0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.205 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.206 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8,
  56.207 +    0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100,
  56.208 +    0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
  56.209 +    0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005,
  56.210 +    0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874,
  56.211 +    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263,
  56.212 +    0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
  56.213 +    0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00,
  56.214 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  56.215 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  56.216 +    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
  56.217 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  56.218 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  56.219 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  56.220 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  56.221 +};
  56.222 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  56.223 +static const DWORD D3D11_PixelShader_Textures[] = {
  56.224 +    0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001,
  56.225 +    0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8,
  56.226 +    0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200,
  56.227 +    0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001,
  56.228 +    0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000,
  56.229 +    0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800,
  56.230 +    0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000,
  56.231 +    0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
  56.232 +    0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000,
  56.233 +    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
  56.234 +    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
  56.235 +    0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2,
  56.236 +    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
  56.237 +    0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
  56.238 +    0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003,
  56.239 +    0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000,
  56.240 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.241 +    0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.242 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.243 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8,
  56.244 +    0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100,
  56.245 +    0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
  56.246 +    0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005,
  56.247 +    0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874,
  56.248 +    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263,
  56.249 +    0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
  56.250 +    0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00,
  56.251 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  56.252 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  56.253 +    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
  56.254 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  56.255 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  56.256 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  56.257 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  56.258 +};
  56.259 +#else
  56.260 +#error "An appropriate 'textures' pixel shader is not defined"
  56.261 +#endif
  56.262 +
  56.263 +/* The color-only-rendering pixel shader:
  56.264 +
  56.265 +   --- D3D11_PixelShader_Colors.hlsl ---
  56.266 +   struct PixelShaderInput
  56.267 +   {
  56.268 +       float4 pos : SV_POSITION;
  56.269 +       float2 tex : TEXCOORD0;
  56.270 +       float4 color : COLOR0;
  56.271 +   };
  56.272 +
  56.273 +   float4 main(PixelShaderInput input) : SV_TARGET
  56.274 +   {
  56.275 +       return input.color;
  56.276 +   }
  56.277 +*/
  56.278 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  56.279 +static const DWORD D3D11_PixelShader_Colors[] = {
  56.280 +    0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001,
  56.281 +    0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140,
  56.282 +    0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200,
  56.283 +    0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
  56.284 +    0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001,
  56.285 +    0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040,
  56.286 +    0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2,
  56.287 +    0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002,
  56.288 +    0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000,
  56.289 +    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  56.290 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.291 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
  56.292 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.293 +    0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000,
  56.294 +    0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d,
  56.295 +    0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
  56.296 +    0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438,
  56.297 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  56.298 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  56.299 +    0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000,
  56.300 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  56.301 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  56.302 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  56.303 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  56.304 +};
  56.305 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  56.306 +static const DWORD D3D11_PixelShader_Colors[] = {
  56.307 +    0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001,
  56.308 +    0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140,
  56.309 +    0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200,
  56.310 +    0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
  56.311 +    0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001,
  56.312 +    0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040,
  56.313 +    0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2,
  56.314 +    0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002,
  56.315 +    0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000,
  56.316 +    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  56.317 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.318 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
  56.319 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.320 +    0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000,
  56.321 +    0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d,
  56.322 +    0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
  56.323 +    0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438,
  56.324 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  56.325 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  56.326 +    0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000,
  56.327 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  56.328 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  56.329 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  56.330 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  56.331 +};
  56.332 +#else
  56.333 +#error "An appropriate 'colors' pixel shader is not defined."
  56.334 +#endif
  56.335 +
  56.336 +/* The sole vertex shader:
  56.337 +
  56.338 +   --- D3D11_VertexShader.hlsl ---
  56.339 +   #pragma pack_matrix( row_major )
  56.340 +
  56.341 +   cbuffer VertexShaderConstants : register(b0)
  56.342 +   {
  56.343 +       matrix model;
  56.344 +       matrix projectionAndView;
  56.345 +   };
  56.346 +
  56.347 +   struct VertexShaderInput
  56.348 +   {
  56.349 +       float3 pos : POSITION;
  56.350 +       float2 tex : TEXCOORD0;
  56.351 +       float4 color : COLOR0;
  56.352 +   };
  56.353 +
  56.354 +   struct VertexShaderOutput
  56.355 +   {
  56.356 +       float4 pos : SV_POSITION;
  56.357 +       float2 tex : TEXCOORD0;
  56.358 +       float4 color : COLOR0;
  56.359 +   };
  56.360 +
  56.361 +   VertexShaderOutput main(VertexShaderInput input)
  56.362 +   {
  56.363 +       VertexShaderOutput output;
  56.364 +       float4 pos = float4(input.pos, 1.0f);
  56.365 +
  56.366 +       // Transform the vertex position into projected space.
  56.367 +       pos = mul(pos, model);
  56.368 +       pos = mul(pos, projectionAndView);
  56.369 +       output.pos = pos;
  56.370 +
  56.371 +       // Pass through texture coordinates and color values without transformation
  56.372 +       output.tex = input.tex;
  56.373 +       output.color = input.color;
  56.374 +
  56.375 +       return output;
  56.376 +   }
  56.377 +*/
  56.378 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  56.379 +static const DWORD D3D11_VertexShader[] = {
  56.380 +    0x43425844, 0x62dfae5f, 0x3e8bd8df, 0x9ec97127, 0x5044eefb, 0x00000001,
  56.381 +    0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0,
  56.382 +    0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200,
  56.383 +    0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000,
  56.384 +    0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0200,
  56.385 +    0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001,
  56.386 +    0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000,
  56.387 +    0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000,
  56.388 +    0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002,
  56.389 +    0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000,
  56.390 +    0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001,
  56.391 +    0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004,
  56.392 +    0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000,
  56.393 +    0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000,
  56.394 +    0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002,
  56.395 +    0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059,
  56.396 +    0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000,
  56.397 +    0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002,
  56.398 +    0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032,
  56.399 +    0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002,
  56.400 +    0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46,
  56.401 +    0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006,
  56.402 +    0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000,
  56.403 +    0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46,
  56.404 +    0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2,
  56.405 +    0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003,
  56.406 +    0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46,
  56.407 +    0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006,
  56.408 +    0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001,
  56.409 +    0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46,
  56.410 +    0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2,
  56.411 +    0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007,
  56.412 +    0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046,
  56.413 +    0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002,
  56.414 +    0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000,
  56.415 +    0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  56.416 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.417 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
  56.418 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.419 +    0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054,
  56.420 +    0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c,
  56.421 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
  56.422 +    0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174,
  56.423 +    0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000,
  56.424 +    0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4,
  56.425 +    0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4,
  56.426 +    0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000,
  56.427 +    0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077,
  56.428 +    0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564,
  56.429 +    0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336,
  56.430 +    0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050,
  56.431 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059,
  56.432 +    0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062,
  56.433 +    0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50,
  56.434 +    0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f,
  56.435 +    0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
  56.436 +    0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
  56.437 +    0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000,
  56.438 +    0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
  56.439 +    0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f
  56.440 +};
  56.441 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  56.442 +static const DWORD D3D11_VertexShader[] = {
  56.443 +    0x43425844, 0x01a24e41, 0x696af551, 0x4b2a87d1, 0x82ea03f6, 0x00000001,
  56.444 +    0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0,
  56.445 +    0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200,
  56.446 +    0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000,
  56.447 +    0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0201,
  56.448 +    0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001,
  56.449 +    0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000,
  56.450 +    0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000,
  56.451 +    0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002,
  56.452 +    0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000,
  56.453 +    0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001,
  56.454 +    0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004,
  56.455 +    0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000,
  56.456 +    0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000,
  56.457 +    0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002,
  56.458 +    0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059,
  56.459 +    0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000,
  56.460 +    0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002,
  56.461 +    0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032,
  56.462 +    0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002,
  56.463 +    0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46,
  56.464 +    0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006,
  56.465 +    0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000,
  56.466 +    0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46,
  56.467 +    0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2,
  56.468 +    0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003,
  56.469 +    0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46,
  56.470 +    0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006,
  56.471 +    0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001,
  56.472 +    0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46,
  56.473 +    0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2,
  56.474 +    0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007,
  56.475 +    0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046,
  56.476 +    0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002,
  56.477 +    0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000,
  56.478 +    0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  56.479 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.480 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
  56.481 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  56.482 +    0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054,
  56.483 +    0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c,
  56.484 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
  56.485 +    0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174,
  56.486 +    0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000,
  56.487 +    0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4,
  56.488 +    0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4,
  56.489 +    0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000,
  56.490 +    0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077,
  56.491 +    0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564,
  56.492 +    0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336,
  56.493 +    0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050,
  56.494 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059,
  56.495 +    0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062,
  56.496 +    0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50,
  56.497 +    0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f,
  56.498 +    0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
  56.499 +    0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
  56.500 +    0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000,
  56.501 +    0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
  56.502 +    0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f
  56.503 +};
  56.504 +#else
  56.505 +#error "An appropriate vertex shader is not defined."
  56.506 +#endif
  56.507 +
  56.508 +/* Direct3D 11.1 renderer implementation */
  56.509 +static SDL_Renderer *D3D11_CreateRenderer(SDL_Window * window, Uint32 flags);
  56.510 +static void D3D11_WindowEvent(SDL_Renderer * renderer,
  56.511 +                            const SDL_WindowEvent *event);
  56.512 +static int D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
  56.513 +static int D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
  56.514 +                             const SDL_Rect * rect, const void *srcPixels,
  56.515 +                             int srcPitch);
  56.516 +static int D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
  56.517 +                             const SDL_Rect * rect, void **pixels, int *pitch);
  56.518 +static void D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
  56.519 +static int D3D11_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
  56.520 +static int D3D11_UpdateViewport(SDL_Renderer * renderer);
  56.521 +static int D3D11_UpdateClipRect(SDL_Renderer * renderer);
  56.522 +static int D3D11_RenderClear(SDL_Renderer * renderer);
  56.523 +static int D3D11_RenderDrawPoints(SDL_Renderer * renderer,
  56.524 +                                  const SDL_FPoint * points, int count);
  56.525 +static int D3D11_RenderDrawLines(SDL_Renderer * renderer,
  56.526 +                                 const SDL_FPoint * points, int count);
  56.527 +static int D3D11_RenderFillRects(SDL_Renderer * renderer,
  56.528 +                                 const SDL_FRect * rects, int count);
  56.529 +static int D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
  56.530 +                            const SDL_Rect * srcrect, const SDL_FRect * dstrect);
  56.531 +static int D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
  56.532 +                              const SDL_Rect * srcrect, const SDL_FRect * dstrect,
  56.533 +                              const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip);
  56.534 +static int D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
  56.535 +                                  Uint32 format, void * pixels, int pitch);
  56.536 +static void D3D11_RenderPresent(SDL_Renderer * renderer);
  56.537 +static void D3D11_DestroyTexture(SDL_Renderer * renderer,
  56.538 +                                 SDL_Texture * texture);
  56.539 +static void D3D11_DestroyRenderer(SDL_Renderer * renderer);
  56.540 +
  56.541 +/* Direct3D 11.1 Internal Functions */
  56.542 +HRESULT D3D11_CreateDeviceResources(SDL_Renderer * renderer);
  56.543 +HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer);
  56.544 +HRESULT D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer);
  56.545 +HRESULT D3D11_HandleDeviceLost(SDL_Renderer * renderer);
  56.546 +
  56.547 +extern "C" SDL_RenderDriver D3D11_RenderDriver = {
  56.548 +    D3D11_CreateRenderer,
  56.549 +    {
  56.550 +        "direct3d 11.1",
  56.551 +        (
  56.552 +            SDL_RENDERER_ACCELERATED |
  56.553 +            SDL_RENDERER_PRESENTVSYNC |
  56.554 +            SDL_RENDERER_TARGETTEXTURE
  56.555 +        ),                          // flags.  see SDL_RendererFlags
  56.556 +        2,                          // num_texture_formats
  56.557 +        {                           // texture_formats
  56.558 +            SDL_PIXELFORMAT_RGB888,
  56.559 +            SDL_PIXELFORMAT_ARGB8888
  56.560 +        },
  56.561 +        0,                          // max_texture_width: will be filled in later
  56.562 +        0                           // max_texture_height: will be filled in later
  56.563 +    }
  56.564 +};
  56.565 +
  56.566 +
  56.567 +static Uint32
  56.568 +DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) {
  56.569 +    switch (dxgiFormat) {
  56.570 +        case DXGI_FORMAT_B8G8R8A8_UNORM:
  56.571 +            return SDL_PIXELFORMAT_ARGB8888;
  56.572 +        case DXGI_FORMAT_B8G8R8X8_UNORM:
  56.573 +            return SDL_PIXELFORMAT_RGB888;
  56.574 +        default:
  56.575 +            return SDL_PIXELFORMAT_UNKNOWN;
  56.576 +    }
  56.577 +}
  56.578 +
  56.579 +static DXGI_FORMAT
  56.580 +SDLPixelFormatToDXGIFormat(Uint32 sdlFormat)
  56.581 +{
  56.582 +    switch (sdlFormat) {
  56.583 +        case SDL_PIXELFORMAT_ARGB8888:
  56.584 +            return DXGI_FORMAT_B8G8R8A8_UNORM;
  56.585 +        case SDL_PIXELFORMAT_RGB888:
  56.586 +            return DXGI_FORMAT_B8G8R8X8_UNORM;
  56.587 +        default:
  56.588 +            return DXGI_FORMAT_UNKNOWN;
  56.589 +    }
  56.590 +}
  56.591 +
  56.592 +SDL_Renderer *
  56.593 +D3D11_CreateRenderer(SDL_Window * window, Uint32 flags)
  56.594 +{
  56.595 +    SDL_Renderer *renderer;
  56.596 +    D3D11_RenderData *data;
  56.597 +
  56.598 +    renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
  56.599 +    if (!renderer) {
  56.600 +        SDL_OutOfMemory();
  56.601 +        return NULL;
  56.602 +    }
  56.603 +    SDL_zerop(renderer);
  56.604 +
  56.605 +    data = new D3D11_RenderData;    // Use the C++ 'new' operator to make sure the struct's members initialize using C++ rules
  56.606 +    if (!data) {
  56.607 +        SDL_OutOfMemory();
  56.608 +        return NULL;
  56.609 +    }
  56.610 +    data->featureLevel = (D3D_FEATURE_LEVEL) 0;
  56.611 +    data->windowSizeInDIPs = XMFLOAT2(0, 0);
  56.612 +    data->renderTargetSize = XMFLOAT2(0, 0);
  56.613 +
  56.614 +    renderer->WindowEvent = D3D11_WindowEvent;
  56.615 +    renderer->CreateTexture = D3D11_CreateTexture;
  56.616 +    renderer->UpdateTexture = D3D11_UpdateTexture;
  56.617 +    renderer->LockTexture = D3D11_LockTexture;
  56.618 +    renderer->UnlockTexture = D3D11_UnlockTexture;
  56.619 +    renderer->SetRenderTarget = D3D11_SetRenderTarget;
  56.620 +    renderer->UpdateViewport = D3D11_UpdateViewport;
  56.621 +    renderer->UpdateClipRect = D3D11_UpdateClipRect;
  56.622 +    renderer->RenderClear = D3D11_RenderClear;
  56.623 +    renderer->RenderDrawPoints = D3D11_RenderDrawPoints;
  56.624 +    renderer->RenderDrawLines = D3D11_RenderDrawLines;
  56.625 +    renderer->RenderFillRects = D3D11_RenderFillRects;
  56.626 +    renderer->RenderCopy = D3D11_RenderCopy;
  56.627 +    renderer->RenderCopyEx = D3D11_RenderCopyEx;
  56.628 +    renderer->RenderReadPixels = D3D11_RenderReadPixels;
  56.629 +    renderer->RenderPresent = D3D11_RenderPresent;
  56.630 +    renderer->DestroyTexture = D3D11_DestroyTexture;
  56.631 +    renderer->DestroyRenderer = D3D11_DestroyRenderer;
  56.632 +    renderer->info = D3D11_RenderDriver.info;
  56.633 +    renderer->driverdata = data;
  56.634 +
  56.635 +    // HACK: make sure the SDL_Renderer references the SDL_Window data now, in
  56.636 +    // order to give init functions access to the underlying window handle:
  56.637 +    renderer->window = window;
  56.638 +
  56.639 +    /* Initialize Direct3D resources */
  56.640 +    if (FAILED(D3D11_CreateDeviceResources(renderer))) {
  56.641 +        D3D11_DestroyRenderer(renderer);
  56.642 +        return NULL;
  56.643 +    }
  56.644 +    if (FAILED(D3D11_CreateWindowSizeDependentResources(renderer))) {
  56.645 +        D3D11_DestroyRenderer(renderer);
  56.646 +        return NULL;
  56.647 +    }
  56.648 +
  56.649 +    // TODO, WinRT: fill in renderer->info.texture_formats where appropriate
  56.650 +
  56.651 +    return renderer;
  56.652 +}
  56.653 +
  56.654 +static void
  56.655 +D3D11_DestroyRenderer(SDL_Renderer * renderer)
  56.656 +{
  56.657 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
  56.658 +    if (data) {
  56.659 +        delete data;
  56.660 +        data = NULL;
  56.661 +    }
  56.662 +}
  56.663 +
  56.664 +static HRESULT
  56.665 +D3D11_CreateBlendMode(SDL_Renderer * renderer,
  56.666 +                      BOOL enableBlending,
  56.667 +                      D3D11_BLEND srcBlend,
  56.668 +                      D3D11_BLEND destBlend,
  56.669 +                      D3D11_BLEND srcBlendAlpha,
  56.670 +                      D3D11_BLEND destBlendAlpha,
  56.671 +                      ID3D11BlendState ** blendStateOutput)
  56.672 +{
  56.673 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
  56.674 +    HRESULT result = S_OK;
  56.675 +
  56.676 +    D3D11_BLEND_DESC blendDesc;
  56.677 +    memset(&blendDesc, 0, sizeof(blendDesc));
  56.678 +    blendDesc.AlphaToCoverageEnable = FALSE;
  56.679 +    blendDesc.IndependentBlendEnable = FALSE;
  56.680 +    blendDesc.RenderTarget[0].BlendEnable = enableBlending;
  56.681 +    blendDesc.RenderTarget[0].SrcBlend = srcBlend;
  56.682 +    blendDesc.RenderTarget[0].DestBlend = destBlend;
  56.683 +    blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
  56.684 +    blendDesc.RenderTarget[0].SrcBlendAlpha = srcBlendAlpha;
  56.685 +    blendDesc.RenderTarget[0].DestBlendAlpha = destBlendAlpha;
  56.686 +    blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
  56.687 +    blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
  56.688 +    result = data->d3dDevice->CreateBlendState(&blendDesc, blendStateOutput);
  56.689 +    if (FAILED(result)) {
  56.690 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBlendState", result);
  56.691 +        return result;
  56.692 +    }
  56.693 +
  56.694 +    return S_OK;
  56.695 +}
  56.696 +
  56.697 +// Create resources that depend on the device.
  56.698 +HRESULT
  56.699 +D3D11_CreateDeviceResources(SDL_Renderer * renderer)
  56.700 +{
  56.701 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
  56.702 +
  56.703 +    // This flag adds support for surfaces with a different color channel ordering
  56.704 +    // than the API default. It is required for compatibility with Direct2D.
  56.705 +    UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
  56.706 +
  56.707 +    // Make sure Direct3D's debugging feature gets used, if the app requests it.
  56.708 +    const char *hint = SDL_GetHint(SDL_HINT_RENDER_DIRECT3D11_DEBUG);
  56.709 +    if (hint) {
  56.710 +        if (*hint == '1') {
  56.711 +            creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
  56.712 +        }
  56.713 +    }
  56.714 +
  56.715 +    // This array defines the set of DirectX hardware feature levels this app will support.
  56.716 +    // Note the ordering should be preserved.
  56.717 +    // Don't forget to declare your application's minimum required feature level in its
  56.718 +    // description.  All applications are assumed to support 9.1 unless otherwise stated.
  56.719 +    D3D_FEATURE_LEVEL featureLevels[] = 
  56.720 +    {
  56.721 +        D3D_FEATURE_LEVEL_11_1,
  56.722 +        D3D_FEATURE_LEVEL_11_0,
  56.723 +        D3D_FEATURE_LEVEL_10_1,
  56.724 +        D3D_FEATURE_LEVEL_10_0,
  56.725 +        D3D_FEATURE_LEVEL_9_3,
  56.726 +        D3D_FEATURE_LEVEL_9_2,
  56.727 +        D3D_FEATURE_LEVEL_9_1
  56.728 +    };
  56.729 +
  56.730 +    // Create the Direct3D 11 API device object and a corresponding context.
  56.731 +    ComPtr<ID3D11Device> device;
  56.732 +    ComPtr<ID3D11DeviceContext> context;
  56.733 +    HRESULT result = S_OK;
  56.734 +    result = D3D11CreateDevice(
  56.735 +        nullptr, // Specify nullptr to use the default adapter.
  56.736 +        D3D_DRIVER_TYPE_HARDWARE,
  56.737 +        nullptr,
  56.738 +        creationFlags, // Set set debug and Direct2D compatibility flags.
  56.739 +        featureLevels, // List of feature levels this app can support.
  56.740 +        ARRAYSIZE(featureLevels),
  56.741 +        D3D11_SDK_VERSION, // Always set this to D3D11_SDK_VERSION for Windows Store apps.
  56.742 +        &device, // Returns the Direct3D device created.
  56.743 +        &data->featureLevel, // Returns feature level of device created.
  56.744 +        &context // Returns the device immediate context.
  56.745 +        );
  56.746 +    if (FAILED(result)) {
  56.747 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", D3D11CreateDevice", result);
  56.748 +        return result;
  56.749 +    }
  56.750 +
  56.751 +    // Get the Direct3D 11.1 API device and context interfaces.
  56.752 +    result = device.As(&(data->d3dDevice));
  56.753 +    if (FAILED(result)) {
  56.754 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device to ID3D11Device1", result);
  56.755 +        return result;
  56.756 +    }
  56.757 +
  56.758 +    result = context.As(&data->d3dContext);
  56.759 +    if (FAILED(result)) {
  56.760 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext to ID3D11DeviceContext1", result);
  56.761 +        return result;
  56.762 +    }
  56.763 +
  56.764 +    //
  56.765 +    // Make note of the maximum texture size
  56.766 +    // Max texture sizes are documented on MSDN, at:
  56.767 +    // http://msdn.microsoft.com/en-us/library/windows/apps/ff476876.aspx
  56.768 +    //
  56.769 +    switch (data->d3dDevice->GetFeatureLevel()) {
  56.770 +        case D3D_FEATURE_LEVEL_11_1:
  56.771 +        case D3D_FEATURE_LEVEL_11_0:
  56.772 +            renderer->info.max_texture_width = renderer->info.max_texture_height = 16384;
  56.773 +            break;
  56.774 +
  56.775 +        case D3D_FEATURE_LEVEL_10_1:
  56.776 +        case D3D_FEATURE_LEVEL_10_0:
  56.777 +            renderer->info.max_texture_width = renderer->info.max_texture_height = 8192;
  56.778 +            break;
  56.779 +
  56.780 +        case D3D_FEATURE_LEVEL_9_3:
  56.781 +            renderer->info.max_texture_width = renderer->info.max_texture_height = 4096;
  56.782 +            break;
  56.783 +
  56.784 +        case D3D_FEATURE_LEVEL_9_2:
  56.785 +        case D3D_FEATURE_LEVEL_9_1:
  56.786 +            renderer->info.max_texture_width = renderer->info.max_texture_height = 2048;
  56.787 +            break;
  56.788 +    }
  56.789 +
  56.790 +    //
  56.791 +    // Load in SDL's one and only vertex shader:
  56.792 +    //
  56.793 +    result = data->d3dDevice->CreateVertexShader(
  56.794 +        D3D11_VertexShader,
  56.795 +        sizeof(D3D11_VertexShader),
  56.796 +        nullptr,
  56.797 +        &data->vertexShader
  56.798 +        );
  56.799 +    if (FAILED(result)) {
  56.800 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateVertexShader", result);
  56.801 +        return result;
  56.802 +    }
  56.803 +
  56.804 +    //
  56.805 +    // Create an input layout for SDL's vertex shader:
  56.806 +    //
  56.807 +    const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = 
  56.808 +    {
  56.809 +        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  56.810 +        { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  56.811 +        { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  56.812 +    };
  56.813 +
  56.814 +    result = data->d3dDevice->CreateInputLayout(
  56.815 +        vertexDesc,
  56.816 +        ARRAYSIZE(vertexDesc),
  56.817 +        D3D11_VertexShader,
  56.818 +        sizeof(D3D11_VertexShader),
  56.819 +        &data->inputLayout
  56.820 +        );
  56.821 +    if (FAILED(result)) {
  56.822 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateInputLayout", result);
  56.823 +        return result;
  56.824 +    }
  56.825 +
  56.826 +    //
  56.827 +    // Load in SDL's pixel shaders
  56.828 +    //
  56.829 +
  56.830 +    result = data->d3dDevice->CreatePixelShader(
  56.831 +        D3D11_PixelShader_Textures,
  56.832 +        sizeof(D3D11_PixelShader_Textures),
  56.833 +        nullptr,
  56.834 +        &data->texturePixelShader
  56.835 +        );
  56.836 +    if (FAILED(result)) {
  56.837 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreatePixelShader ['textures' shader]", result);
  56.838 +        return result;
  56.839 +    }
  56.840 +
  56.841 +    result = data->d3dDevice->CreatePixelShader(
  56.842 +        D3D11_PixelShader_Colors,
  56.843 +        sizeof(D3D11_PixelShader_Colors),
  56.844 +        nullptr,
  56.845 +        &data->colorPixelShader
  56.846 +        );
  56.847 +    if (FAILED(result)) {
  56.848 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreatePixelShader ['color' shader]", result);
  56.849 +        return result;
  56.850 +    }
  56.851 +
  56.852 +    //
  56.853 +    // Setup space to hold vertex shader constants:
  56.854 +    //
  56.855 +    CD3D11_BUFFER_DESC constantBufferDesc(sizeof(VertexShaderConstants), D3D11_BIND_CONSTANT_BUFFER);
  56.856 +    result = data->d3dDevice->CreateBuffer(
  56.857 +		&constantBufferDesc,
  56.858 +		nullptr,
  56.859 +        &data->vertexShaderConstants
  56.860 +		);
  56.861 +    if (FAILED(result)) {
  56.862 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBuffer [vertex shader constants]", result);
  56.863 +        return result;
  56.864 +    }
  56.865 +
  56.866 +    //
  56.867 +    // Make sure that the vertex buffer, if already created, gets freed.
  56.868 +    // It will be recreated later.
  56.869 +    //
  56.870 +    data->vertexBuffer = nullptr;
  56.871 +
  56.872 +    //
  56.873 +    // Create samplers to use when drawing textures:
  56.874 +    //
  56.875 +    D3D11_SAMPLER_DESC samplerDesc;
  56.876 +    samplerDesc.Filter = SDL_D3D11_NEAREST_PIXEL_FILTER;
  56.877 +    samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
  56.878 +    samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
  56.879 +    samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
  56.880 +    samplerDesc.MipLODBias = 0.0f;
  56.881 +    samplerDesc.MaxAnisotropy = 1;
  56.882 +    samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
  56.883 +    samplerDesc.BorderColor[0] = 0.0f;
  56.884 +    samplerDesc.BorderColor[1] = 0.0f;
  56.885 +    samplerDesc.BorderColor[2] = 0.0f;
  56.886 +    samplerDesc.BorderColor[3] = 0.0f;
  56.887 +    samplerDesc.MinLOD = 0.0f;
  56.888 +    samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
  56.889 +    result = data->d3dDevice->CreateSamplerState(
  56.890 +        &samplerDesc,
  56.891 +        &data->nearestPixelSampler
  56.892 +        );
  56.893 +    if (FAILED(result)) {
  56.894 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateSamplerState [nearest-pixel filter]", result);
  56.895 +        return result;
  56.896 +    }
  56.897 +
  56.898 +    samplerDesc.Filter = SDL_D3D11_LINEAR_FILTER;
  56.899 +    result = data->d3dDevice->CreateSamplerState(
  56.900 +        &samplerDesc,
  56.901 +        &data->linearSampler
  56.902 +        );
  56.903 +    if (FAILED(result)) {
  56.904 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateSamplerState [linear filter]", result);
  56.905 +        return result;
  56.906 +    }
  56.907 +
  56.908 +    //
  56.909 +    // Setup Direct3D rasterizer states
  56.910 +    //
  56.911 +    D3D11_RASTERIZER_DESC rasterDesc;
  56.912 +    memset(&rasterDesc, 0, sizeof(rasterDesc));
  56.913 +	rasterDesc.AntialiasedLineEnable = false;
  56.914 +	rasterDesc.CullMode = D3D11_CULL_NONE;
  56.915 +	rasterDesc.DepthBias = 0;
  56.916 +	rasterDesc.DepthBiasClamp = 0.0f;
  56.917 +	rasterDesc.DepthClipEnable = true;
  56.918 +	rasterDesc.FillMode = D3D11_FILL_SOLID;
  56.919 +	rasterDesc.FrontCounterClockwise = false;
  56.920 +	rasterDesc.MultisampleEnable = false;
  56.921 +	rasterDesc.ScissorEnable = false;
  56.922 +	rasterDesc.SlopeScaledDepthBias = 0.0f;
  56.923 +	result = data->d3dDevice->CreateRasterizerState(&rasterDesc, &data->mainRasterizer);
  56.924 +	if (FAILED(result)) {
  56.925 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRasterizerState [main rasterizer]", result);
  56.926 +        return result;
  56.927 +    }
  56.928 +
  56.929 +    rasterDesc.ScissorEnable = true;
  56.930 +    result = data->d3dDevice->CreateRasterizerState(&rasterDesc, &data->clippedRasterizer);
  56.931 +	if (FAILED(result)) {
  56.932 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRasterizerState [clipped rasterizer]", result);
  56.933 +        return result;
  56.934 +    }
  56.935 +
  56.936 +    //
  56.937 +    // Create blending states:
  56.938 +    //
  56.939 +    result = D3D11_CreateBlendMode(
  56.940 +        renderer,
  56.941 +        TRUE,
  56.942 +        D3D11_BLEND_SRC_ALPHA,          /* srcBlend */
  56.943 +        D3D11_BLEND_INV_SRC_ALPHA,      /* destBlend */
  56.944 +        D3D11_BLEND_ONE,                /* srcBlendAlpha */
  56.945 +        D3D11_BLEND_INV_SRC_ALPHA,      /* destBlendAlpha */
  56.946 +        &data->blendModeBlend);
  56.947 +    if (FAILED(result)) {
  56.948 +        // D3D11_CreateBlendMode will set the SDL error, if it fails
  56.949 +        return result;
  56.950 +    }
  56.951 +
  56.952 +    result = D3D11_CreateBlendMode(
  56.953 +        renderer,
  56.954 +        TRUE,
  56.955 +        D3D11_BLEND_SRC_ALPHA,          /* srcBlend */
  56.956 +        D3D11_BLEND_ONE,                /* destBlend */
  56.957 +        D3D11_BLEND_ZERO,               /* srcBlendAlpha */
  56.958 +        D3D11_BLEND_ONE,                /* destBlendAlpha */
  56.959 +        &data->blendModeAdd);
  56.960 +    if (FAILED(result)) {
  56.961 +        // D3D11_CreateBlendMode will set the SDL error, if it fails
  56.962 +        return result;
  56.963 +    }
  56.964 +
  56.965 +    result = D3D11_CreateBlendMode(
  56.966 +        renderer,
  56.967 +        TRUE,
  56.968 +        D3D11_BLEND_ZERO,               /* srcBlend */
  56.969 +        D3D11_BLEND_SRC_COLOR,          /* destBlend */
  56.970 +        D3D11_BLEND_ZERO,               /* srcBlendAlpha */
  56.971 +        D3D11_BLEND_ONE,                /* destBlendAlpha */
  56.972 +        &data->blendModeMod);
  56.973 +    if (FAILED(result)) {
  56.974 +        // D3D11_CreateBlendMode will set the SDL error, if it fails
  56.975 +        return result;
  56.976 +    }
  56.977 +
  56.978 +    //
  56.979 +    // All done!
  56.980 +    //
  56.981 +    return S_OK;
  56.982 +}
  56.983 +
  56.984 +#ifdef __WINRT__
  56.985 +
  56.986 +static ABI::Windows::UI::Core::ICoreWindow *
  56.987 +D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer * renderer)
  56.988 +{
  56.989 +    SDL_Window * sdlWindow = renderer->window;
  56.990 +    if ( ! renderer->window ) {
  56.991 +        return nullptr;
  56.992 +    }
  56.993 +
  56.994 +    SDL_SysWMinfo sdlWindowInfo;
  56.995 +    SDL_VERSION(&sdlWindowInfo.version);
  56.996 +    if ( ! SDL_GetWindowWMInfo(sdlWindow, &sdlWindowInfo) ) {
  56.997 +        return nullptr;
  56.998 +    }
  56.999 +
 56.1000 +    if (sdlWindowInfo.subsystem != SDL_SYSWM_WINRT) {
 56.1001 +        return nullptr;
 56.1002 +    }
 56.1003 +
 56.1004 +    if ( ! sdlWindowInfo.info.winrt.window ) {
 56.1005 +        return nullptr;
 56.1006 +    }
 56.1007 +
 56.1008 +    ABI::Windows::UI::Core::ICoreWindow * coreWindow = nullptr;
 56.1009 +    if (FAILED(sdlWindowInfo.info.winrt.window->QueryInterface(&coreWindow))) {
 56.1010 +        return nullptr;
 56.1011 +    }
 56.1012 +
 56.1013 +    return coreWindow;
 56.1014 +}
 56.1015 +
 56.1016 +// Method to convert a length in device-independent pixels (DIPs) to a length in physical pixels.
 56.1017 +static float
 56.1018 +D3D11_ConvertDipsToPixels(float dips)
 56.1019 +{
 56.1020 +    static const float dipsPerInch = 96.0f;
 56.1021 +    return floor(dips * DisplayProperties::LogicalDpi / dipsPerInch + 0.5f); // Round to nearest integer.
 56.1022 +}
 56.1023 +#endif
 56.1024 +
 56.1025 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
 56.1026 +// TODO, WinRT, XAML: get the ISwapChainBackgroundPanelNative from something other than a global var
 56.1027 +extern ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative;
 56.1028 +#endif
 56.1029 +
 56.1030 +static DXGI_MODE_ROTATION
 56.1031 +D3D11_GetRotationForOrientation(Windows::Graphics::Display::DisplayOrientations orientation)
 56.1032 +{
 56.1033 +    switch (orientation)
 56.1034 +    {
 56.1035 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
 56.1036 +        //
 56.1037 +        // Windows Phone rotations
 56.1038 +        //
 56.1039 +        case DisplayOrientations::Landscape:
 56.1040 +            return DXGI_MODE_ROTATION_ROTATE90;
 56.1041 +        case DisplayOrientations::Portrait:
 56.1042 +            return DXGI_MODE_ROTATION_IDENTITY;
 56.1043 +        case DisplayOrientations::LandscapeFlipped:
 56.1044 +            return DXGI_MODE_ROTATION_ROTATE270;
 56.1045 +        case DisplayOrientations::PortraitFlipped:
 56.1046 +            return DXGI_MODE_ROTATION_ROTATE180;
 56.1047 +#else
 56.1048 +        //
 56.1049 +        // Non-Windows-Phone rotations (ex: Windows 8, Windows RT)
 56.1050 +        //
 56.1051 +        case DisplayOrientations::Landscape:
 56.1052 +            return DXGI_MODE_ROTATION_IDENTITY;
 56.1053 +        case DisplayOrientations::Portrait:
 56.1054 +            return DXGI_MODE_ROTATION_ROTATE270;
 56.1055 +        case DisplayOrientations::LandscapeFlipped:
 56.1056 +            return DXGI_MODE_ROTATION_ROTATE180;
 56.1057 +        case DisplayOrientations::PortraitFlipped:
 56.1058 +            return DXGI_MODE_ROTATION_ROTATE90;
 56.1059 +#endif // WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
 56.1060 +
 56.1061 +        default:
 56.1062 +            return DXGI_MODE_ROTATION_UNSPECIFIED;
 56.1063 +    }
 56.1064 +}
 56.1065 +
 56.1066 +static bool
 56.1067 +D3D11_IsDisplayRotated90Degrees(Windows::Graphics::Display::DisplayOrientations orientation)
 56.1068 +{
 56.1069 +    switch (D3D11_GetRotationForOrientation(orientation)) {
 56.1070 +        case DXGI_MODE_ROTATION_ROTATE90:
 56.1071 +        case DXGI_MODE_ROTATION_ROTATE270:
 56.1072 +            return true;
 56.1073 +        default:
 56.1074 +            return false;
 56.1075 +    }
 56.1076 +}
 56.1077 +
 56.1078 +static int
 56.1079 +D3D11_GetViewportAlignedD3DRect(SDL_Renderer * renderer, const SDL_Rect * sdlRect, D3D11_RECT * outRect)
 56.1080 +{
 56.1081 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
 56.1082 +    switch (D3D11_GetRotationForOrientation(data-> orientation)) {
 56.1083 +        case DXGI_MODE_ROTATION_IDENTITY:
 56.1084 +            outRect->left = sdlRect->x;
 56.1085 +            outRect->right = sdlRect->x + sdlRect->w;
 56.1086 +            outRect->top = sdlRect->y;
 56.1087 +            outRect->bottom = sdlRect->y + sdlRect->h;
 56.1088 +            break;
 56.1089 +        case DXGI_MODE_ROTATION_ROTATE270:
 56.1090 +            outRect->left = sdlRect->y;
 56.1091 +            outRect->right = sdlRect->y + sdlRect->h;
 56.1092 +            outRect->top = renderer->viewport.w - sdlRect->x - sdlRect->w;
 56.1093 +            outRect->bottom = renderer->viewport.w - sdlRect->x;
 56.1094 +            break;
 56.1095 +        case DXGI_MODE_ROTATION_ROTATE180:
 56.1096 +            outRect->left = renderer->viewport.w - sdlRect->x - sdlRect->w;
 56.1097 +            outRect->right = renderer->viewport.w - sdlRect->x;
 56.1098 +            outRect->top = renderer->viewport.h - sdlRect->y - sdlRect->h;
 56.1099 +            outRect->bottom = renderer->viewport.h - sdlRect->y;
 56.1100 +            break;
 56.1101 +        case DXGI_MODE_ROTATION_ROTATE90:
 56.1102 +            outRect->left = renderer->viewport.h - sdlRect->y - sdlRect->h;
 56.1103 +            outRect->right = renderer->viewport.h - sdlRect->y;
 56.1104 +            outRect->top = sdlRect->x;
 56.1105 +            outRect->bottom = sdlRect->x + sdlRect->h;
 56.1106 +            break;
 56.1107 +        default:
 56.1108 +            return SDL_SetError("The physical display is in an unknown or unsupported orientation");
 56.1109 +    }
 56.1110 +    return 0;
 56.1111 +}
 56.1112 +
 56.1113 +
 56.1114 +// Initialize all resources that change when the window's size changes.
 56.1115 +// TODO, WinRT: get D3D11_CreateWindowSizeDependentResources working on Win32
 56.1116 +HRESULT
 56.1117 +D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer)
 56.1118 +{
 56.1119 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
 56.1120 +    HRESULT result = S_OK;
 56.1121 +    ABI::Windows::UI::Core::ICoreWindow * coreWindow = D3D11_GetCoreWindowFromSDLRenderer(renderer);
 56.1122 +
 56.1123 +    // Store the window bounds so the next time we get a SizeChanged event we can
 56.1124 +    // avoid rebuilding everything if the size is identical.
 56.1125 +    ABI::Windows::Foundation::Rect nativeWindowBounds;
 56.1126 +    if (coreWindow) {
 56.1127 +        result = coreWindow->get_Bounds(&nativeWindowBounds);
 56.1128 +        if (FAILED(result)) {
 56.1129 +            WIN_SetErrorFromHRESULT(__FUNCTION__", ICoreWindow::get_Bounds [get native-window bounds]", result);
 56.1130 +            return result;
 56.1131 +        }
 56.1132 +    } else {
 56.1133 +        // TODO, WinRT, XAML: clean up window-bounds code in D3D11_CreateWindowSizeDependentResources
 56.1134 +        SDL_DisplayMode displayMode;
 56.1135 +        if (SDL_GetDesktopDisplayMode(0, &displayMode) < 0) {
 56.1136 +            SDL_SetError(__FUNCTION__", Get Window Bounds (XAML): Unable to retrieve the native window's size");
 56.1137 +            return E_FAIL;
 56.1138 +        }
 56.1139 +
 56.1140 +        nativeWindowBounds.Width = (FLOAT) displayMode.w;
 56.1141 +        nativeWindowBounds.Height = (FLOAT) displayMode.h;
 56.1142 +    }
 56.1143 +
 56.1144 +    // TODO, WinRT, XAML: see if window/control sizes are in DIPs, or something else.  If something else, then adjust renderer size tracking accordingly.
 56.1145 +    data->windowSizeInDIPs.x = nativeWindowBounds.Width;
 56.1146 +    data->windowSizeInDIPs.y = nativeWindowBounds.Height;
 56.1147 +
 56.1148 +    // Calculate the necessary swap chain and render target size in pixels.
 56.1149 +    float windowWidth = D3D11_ConvertDipsToPixels(data->windowSizeInDIPs.x);
 56.1150 +    float windowHeight = D3D11_ConvertDipsToPixels(data->windowSizeInDIPs.y);
 56.1151 +
 56.1152 +    // The width and height of the swap chain must be based on the window's
 56.1153 +    // landscape-oriented width and height. If the window is in a portrait
 56.1154 +    // orientation, the dimensions must be reversed.
 56.1155 +    data->orientation = DisplayProperties::CurrentOrientation;
 56.1156 +
 56.1157 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
 56.1158 +    const bool swapDimensions = false;
 56.1159 +#else
 56.1160 +    const bool swapDimensions = D3D11_IsDisplayRotated90Degrees(data->orientation);
 56.1161 +#endif
 56.1162 +    data->renderTargetSize.x = swapDimensions ? windowHeight : windowWidth;
 56.1163 +    data->renderTargetSize.y = swapDimensions ? windowWidth : windowHeight;
 56.1164 +
 56.1165 +    if(data->swapChain != nullptr)
 56.1166 +    {
 56.1167 +        // If the swap chain already exists, resize it.
 56.1168 +        result = data->swapChain->ResizeBuffers(
 56.1169 +            2, // Double-buffered swap chain.
 56.1170 +            static_cast<UINT>(data->renderTargetSize.x),
 56.1171 +            static_cast<UINT>(data->renderTargetSize.y),
 56.1172 +            DXGI_FORMAT_B8G8R8A8_UNORM,
 56.1173 +            0
 56.1174 +            );
 56.1175 +        if (FAILED(result)) {
 56.1176 +            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain1::ResizeBuffers", result);
 56.1177 +            return result;
 56.1178 +        }
 56.1179 +    }
 56.1180 +    else
 56.1181 +    {
 56.1182 +        const bool usingXAML = (coreWindow == nullptr);
 56.1183 +
 56.1184 +        // Otherwise, create a new one using the same adapter as the existing Direct3D device.
 56.1185 +        DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};
 56.1186 +        swapChainDesc.Width = static_cast<UINT>(data->renderTargetSize.x); // Match the size of the window.
 56.1187 +        swapChainDesc.Height = static_cast<UINT>(data->renderTargetSize.y);
 56.1188 +        swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // This is the most common swap chain format.
 56.1189 +        swapChainDesc.Stereo = false;
 56.1190 +        swapChainDesc.SampleDesc.Count = 1; // Don't use multi-sampling.
 56.1191 +        swapChainDesc.SampleDesc.Quality = 0;
 56.1192 +        swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
 56.1193 +        swapChainDesc.BufferCount = 2; // Use double-buffering to minimize latency.
 56.1194 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
 56.1195 +        swapChainDesc.Scaling = DXGI_SCALING_STRETCH; // On phone, only stretch and aspect-ratio stretch scaling are allowed.
 56.1196 +        swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; // On phone, no swap effects are supported.
 56.1197 +#else
 56.1198 +        if (usingXAML) {
 56.1199 +            swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
 56.1200 +        } else {
 56.1201 +            swapChainDesc.Scaling = DXGI_SCALING_NONE;
 56.1202 +        }
 56.1203 +        swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // All Windows Store apps must use this SwapEffect.
 56.1204 +#endif
 56.1205 +        swapChainDesc.Flags = 0;
 56.1206 +
 56.1207 +        ComPtr<IDXGIDevice1> dxgiDevice;
 56.1208 +        result = data->d3dDevice.As(&dxgiDevice);
 56.1209 +        if (FAILED(result)) {
 56.1210 +            WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1 to IDXGIDevice1", result);
 56.1211 +            return result;
 56.1212 +        }
 56.1213 +
 56.1214 +        ComPtr<IDXGIAdapter> dxgiAdapter;
 56.1215 +        result = dxgiDevice->GetAdapter(&dxgiAdapter);
 56.1216 +        if (FAILED(result)) {
 56.1217 +            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIDevice1::GetAdapter", result);
 56.1218 +            return result;
 56.1219 +        }
 56.1220 +
 56.1221 +        ComPtr<IDXGIFactory2> dxgiFactory;
 56.1222 +        result = dxgiAdapter->GetParent(
 56.1223 +            __uuidof(IDXGIFactory2), 
 56.1224 +            &dxgiFactory
 56.1225 +            );
 56.1226 +        if (FAILED(result)) {
 56.1227 +            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIAdapter::GetParent", result);
 56.1228 +            return result;
 56.1229 +        }
 56.1230 +
 56.1231 +        if (usingXAML) {
 56.1232 +            result = dxgiFactory->CreateSwapChainForComposition(
 56.1233 +                data->d3dDevice.Get(),
 56.1234 +                &swapChainDesc,
 56.1235 +                nullptr,
 56.1236 +                &data->swapChain);
 56.1237 +            if (FAILED(result)) {
 56.1238 +                WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory2::CreateSwapChainForComposition", result);
 56.1239 +                return result;
 56.1240 +            }
 56.1241 +
 56.1242 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
 56.1243 +            result = WINRT_GlobalSwapChainBackgroundPanelNative->SetSwapChain(data->swapChain.Get());
 56.1244 +            if (FAILED(result)) {
 56.1245 +                WIN_SetErrorFromHRESULT(__FUNCTION__ ", ISwapChainBackgroundPanelNative::SetSwapChain", result);
 56.1246 +                return result;
 56.1247 +            }
 56.1248 +#else
 56.1249 +            SDL_SetError(__FUNCTION__ ", XAML support is not yet available for Windows Phone");
 56.1250 +            return E_FAIL;
 56.1251 +#endif
 56.1252 +        } else {
 56.1253 +            IUnknown * coreWindowAsIUnknown = nullptr;
 56.1254 +            result = coreWindow->QueryInterface(&coreWindowAsIUnknown);
 56.1255 +            if (FAILED(result)) {
 56.1256 +                WIN_SetErrorFromHRESULT(__FUNCTION__ ", ICoreWindow to IUnknown", result);
 56.1257 +                return result;
 56.1258 +            }
 56.1259 +
 56.1260 +            result = dxgiFactory->CreateSwapChainForCoreWindow(
 56.1261 +                data->d3dDevice.Get(),
 56.1262 +                coreWindowAsIUnknown,
 56.1263 +                &swapChainDesc,
 56.1264 +                nullptr, // Allow on all displays.
 56.1265 +                &data->swapChain
 56.1266 +                );
 56.1267 +            if (FAILED(result)) {
 56.1268 +                WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory2::CreateSwapChainForCoreWindow", result);
 56.1269 +                return result;
 56.1270 +            }
 56.1271 +        }
 56.1272 +        
 56.1273 +        // Ensure that DXGI does not queue more than one frame at a time. This both reduces latency and
 56.1274 +        // ensures that the application will only render after each VSync, minimizing power consumption.
 56.1275 +        result = dxgiDevice->SetMaximumFrameLatency(1);
 56.1276 +        if (FAILED(result)) {
 56.1277 +            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIDevice1::SetMaximumFrameLatency", result);
 56.1278 +            return result;
 56.1279 +        }
 56.1280 +    }
 56.1281 +    
 56.1282 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
 56.1283 +    // Set the proper orientation for the swap chain, and generate the
 56.1284 +    // 3D matrix transformation for rendering to the rotated swap chain.
 56.1285 +    //
 56.1286 +    // To note, the call for this, IDXGISwapChain1::SetRotation, is not necessary
 56.1287 +    // on Windows Phone, nor is it supported there.  It's only needed in Windows 8/RT.
 56.1288 +    DXGI_MODE_ROTATION rotation = D3D11_GetRotationForOrientation(data->orientation);
 56.1289 +    result = data->swapChain->SetRotation(rotation);
 56.1290 +    if (FAILED(result)) {
 56.1291 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain1::SetRotation" , result);
 56.1292 +        return result;
 56.1293 +    }
 56.1294 +#endif
 56.1295 +
 56.1296 +    // Create a render target view of the swap chain back buffer.
 56.1297 +    ComPtr<ID3D11Texture2D> backBuffer;
 56.1298 +    result = data->swapChain->GetBuffer(
 56.1299 +        0,
 56.1300 +        __uuidof(ID3D11Texture2D),
 56.1301 +        &backBuffer
 56.1302 +        );
 56.1303 +    if (FAILED(result)) {
 56.1304 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain1::GetBuffer [back-buffer]", result);
 56.1305 +        return result;
 56.1306 +    }
 56.1307 +
 56.1308 +    result = data->d3dDevice->CreateRenderTargetView(
 56.1309 +        backBuffer.Get(),
 56.1310 +        nullptr,
 56.1311 +        &data->mainRenderTargetView
 56.1312 +        );
 56.1313 +    if (FAILED(result)) {
 56.1314 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRenderTargetView", result);
 56.1315 +        return result;
 56.1316 +    }
 56.1317 +
 56.1318 +    if (D3D11_UpdateViewport(renderer) != 0) {
 56.1319 +        // D3D11_UpdateViewport will set the SDL error if it fails.
 56.1320 +        return E_FAIL;
 56.1321 +    }
 56.1322 +
 56.1323 +    return S_OK;
 56.1324 +}
 56.1325 +
 56.1326 +// This method is called when the window's size changes.
 56.1327 +HRESULT
 56.1328 +D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer)
 56.1329 +{
 56.1330 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
 56.1331 +    HRESULT result = S_OK;
 56.1332 +    ABI::Windows::UI::Core::ICoreWindow * coreWindow = D3D11_GetCoreWindowFromSDLRenderer(renderer);
 56.1333 +    ABI::Windows::Foundation::Rect coreWindowBounds;
 56.1334 +
 56.1335 +    result = coreWindow->get_Bounds(&coreWindowBounds);
 56.1336 +    if (FAILED(result)) {
 56.1337 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ICoreWindow::get_Bounds [get window bounds]", result);
 56.1338 +        return result;
 56.1339 +    }
 56.1340 +
 56.1341 +    if (coreWindowBounds.Width  != data->windowSizeInDIPs.x ||
 56.1342 +        coreWindowBounds.Height != data->windowSizeInDIPs.y ||
 56.1343 +        data->orientation != DisplayProperties::CurrentOrientation)
 56.1344 +    {
 56.1345 +        ID3D11RenderTargetView* nullViews[] = {nullptr};
 56.1346 +        data->d3dContext->OMSetRenderTargets(ARRAYSIZE(nullViews), nullViews, nullptr);
 56.1347 +        data->mainRenderTargetView = nullptr;
 56.1348 +        data->d3dContext->Flush();
 56.1349 +        result = D3D11_CreateWindowSizeDependentResources(renderer);
 56.1350 +        if (FAILED(result)) {
 56.1351 +            /* D3D11_CreateWindowSizeDependentResources will set the SDL error */
 56.1352 +            return result;
 56.1353 +        }
 56.1354 +    }
 56.1355 +
 56.1356 +    return S_OK;
 56.1357 +}
 56.1358 +
 56.1359 +HRESULT
 56.1360 +D3D11_HandleDeviceLost(SDL_Renderer * renderer)
 56.1361 +{
 56.1362 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
 56.1363 +    HRESULT result = S_OK;
 56.1364 +
 56.1365 +    // Reset these member variables to ensure that D3D11_UpdateForWindowSizeChange recreates all resources.
 56.1366 +    data->windowSizeInDIPs.x = 0;
 56.1367 +    data->windowSizeInDIPs.y = 0;
 56.1368 +    data->swapChain = nullptr;
 56.1369 +
 56.1370 +    result = D3D11_CreateDeviceResources(renderer);
 56.1371 +    if (FAILED(result)) {
 56.1372 +        /* D3D11_CreateDeviceResources will set the SDL error */
 56.1373 +        return result;
 56.1374 +    }
 56.1375 +
 56.1376 +    result = D3D11_UpdateForWindowSizeChange(renderer);
 56.1377 +    if (FAILED(result)) {
 56.1378 +        /* D3D11_UpdateForWindowSizeChange will set the SDL error */
 56.1379 +        return result;
 56.1380 +    }
 56.1381 +
 56.1382 +    return S_OK;
 56.1383 +}
 56.1384 +
 56.1385 +static void
 56.1386 +D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
 56.1387 +{
 56.1388 +    //D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
 56.1389 +
 56.1390 +    if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
 56.1391 +        D3D11_UpdateForWindowSizeChange(renderer);
 56.1392 +    }
 56.1393 +}
 56.1394 +
 56.1395 +static D3D11_FILTER
 56.1396 +GetScaleQuality(void)
 56.1397 +{
 56.1398 +    const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
 56.1399 +    if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
 56.1400 +        return SDL_D3D11_NEAREST_PIXEL_FILTER;
 56.1401 +    } else /* if (*hint == '1' || SDL_strcasecmp(hint, "linear") == 0) */ {
 56.1402 +        return SDL_D3D11_LINEAR_FILTER;
 56.1403 +    }
 56.1404 +}
 56.1405 +
 56.1406 +static int
 56.1407 +D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
 56.1408 +{
 56.1409 +    D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
 56.1410 +    D3D11_TextureData *textureData;
 56.1411 +    HRESULT result;
 56.1412 +    DXGI_FORMAT textureFormat = SDLPixelFormatToDXGIFormat(texture->format);
 56.1413 +    if (textureFormat == SDL_PIXELFORMAT_UNKNOWN) {
 56.1414 +        return SDL_SetError("%s, An unsupported SDL pixel format (0x%x) was specified",
 56.1415 +            __FUNCTION__, texture->format);
 56.1416 +    }
 56.1417 +
 56.1418 +    textureData = new D3D11_TextureData;
 56.1419 +    if (!textureData) {
 56.1420 +        SDL_OutOfMemory();
 56.1421 +        return -1;
 56.1422 +    }
 56.1423 +    textureData->pixelFormat = SDL_AllocFormat(texture->format);
 56.1424 +    textureData->lockedTexturePosition = XMINT2(0, 0);
 56.1425 +    textureData->scaleMode = GetScaleQuality();
 56.1426 +
 56.1427 +    texture->driverdata = textureData;
 56.1428 +
 56.1429 +    D3D11_TEXTURE2D_DESC textureDesc = {0};
 56.1430 +    textureDesc.Width = texture->w;
 56.1431 +    textureDesc.Height = texture->h;
 56.1432 +    textureDesc.MipLevels = 1;
 56.1433 +    textureDesc.ArraySize = 1;
 56.1434 +    textureDesc.Format = textureFormat;
 56.1435 +    textureDesc.SampleDesc.Count = 1;
 56.1436 +    textureDesc.SampleDesc.Quality = 0;
 56.1437 +    textureDesc.MiscFlags = 0;
 56.1438 +
 56.1439 +    if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
 56.1440 +        textureDesc.Usage = D3D11_USAGE_DYNAMIC;
 56.1441 +        textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
 56.1442 +    } else {
 56.1443 +        textureDesc.Usage = D3D11_USAGE_DEFAULT;
 56.1444 +        textureDesc.CPUAccessFlags = 0;
 56.1445 +    }
 56.1446 +
 56.1447 +    if (texture->access == SDL_TEXTUREACCESS_TARGET) {
 56.1448 +        textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
 56.1449 +    } else {
 56.1450 +        textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
 56.1451 +    }
 56.1452 +
 56.1453 +#if 0
 56.1454 +    // Fill the texture with a non-black color, for debugging purposes:
 56.1455 +    const int numPixels = textureDesc.Width * textureDesc.Height;
 56.1456 +    const int pixelSizeInBytes = textureData->pixelFormat->BytesPerPixel;
 56.1457 +    std::vector<uint8> initialTexturePixels(numPixels * pixelSizeInBytes, 0x00);
 56.1458 +    for (int i = 0; i < (numPixels * pixelSizeInBytes); i += pixelSizeInBytes) {
 56.1459 +        initialTexturePixels[i+0] = 0xff;
 56.1460 +        initialTexturePixels[i+1] = 0xff;
 56.1461 +        initialTexturePixels[i+2] = 0x00;
 56.1462 +        initialTexturePixels[i+3] = 0xff;
 56.1463 +    }
 56.1464 +    D3D11_SUBRESOURCE_DATA initialTextureData = {0};
 56.1465 +    initialTextureData.pSysMem = (void *)&(initialTexturePixels[0]);
 56.1466 +    initialTextureData.SysMemPitch = textureDesc.Width * pixelSizeInBytes;
 56.1467 +    initialTextureData.SysMemSlicePitch = numPixels * pixelSizeInBytes;
 56.1468 +#endif
 56.1469 +
 56.1470 +    result = rendererData->d3dDevice->CreateTexture2D(
 56.1471 +        &textureDesc,
 56.1472 +        NULL,   // &initialTextureData,
 56.1473 +        &textureData->mainTexture
 56.1474 +        );
 56.1475 +    if (FAILED(result)) {
 56.1476 +        D3D11_DestroyTexture(renderer, texture);
 56.1477 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D", result);
 56.1478 +        return -1;
 56.1479 +    }
 56.1480 +
 56.1481 +    if (texture->access & SDL_TEXTUREACCESS_TARGET) {
 56.1482 +        D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc;
 56.1483 +        renderTargetViewDesc.Format = textureDesc.Format;
 56.1484 +        renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
 56.1485 +        renderTargetViewDesc.Texture2D.MipSlice = 0;
 56.1486 +
 56.1487 +        result = rendererData->d3dDevice->CreateRenderTargetView(
 56.1488 +            textureData->mainTexture.Get(),
 56.1489 +            &renderTargetViewDesc,
 56.1490 +            &textureData->mainTextureRenderTargetView);
 56.1491 +        if (FAILED(result)) {
 56.1492 +            D3D11_DestroyTexture(renderer, texture);
 56.1493 +            WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRenderTargetView", result);
 56.1494 +            return -1;
 56.1495 +        }
 56.1496 +    }
 56.1497 +
 56.1498 +    D3D11_SHADER_RESOURCE_VIEW_DESC resourceViewDesc;
 56.1499 +    resourceViewDesc.Format = textureDesc.Format;
 56.1500 +    resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
 56.1501 +    resourceViewDesc.Texture2D.MostDetailedMip = 0;
 56.1502 +    resourceViewDesc.Texture2D.MipLevels = textureDesc.MipLevels;
 56.1503 +    result = rendererData->d3dDevice->CreateShaderResourceView(
 56.1504 +        textureData->mainTexture.Get(),