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
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj	Sun Mar 09 11:36:47 2014 -0700
     2.3 @@ -0,0 +1,404 @@
     2.4 +<?xml version="1.0" encoding="utf-8"?>
     2.5 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     2.6 +  <ItemGroup Label="ProjectConfigurations">
     2.7 +    <ProjectConfiguration Include="Debug|Win32">
     2.8 +      <Configuration>Debug</Configuration>
     2.9 +      <Platform>Win32</Platform>
    2.10 +    </ProjectConfiguration>
    2.11 +    <ProjectConfiguration Include="Debug|ARM">
    2.12 +      <Configuration>Debug</Configuration>
    2.13 +      <Platform>ARM</Platform>
    2.14 +    </ProjectConfiguration>
    2.15 +    <ProjectConfiguration Include="Release|Win32">
    2.16 +      <Configuration>Release</Configuration>
    2.17 +      <Platform>Win32</Platform>
    2.18 +    </ProjectConfiguration>
    2.19 +    <ProjectConfiguration Include="Release|ARM">
    2.20 +      <Configuration>Release</Configuration>
    2.21 +      <Platform>ARM</Platform>
    2.22 +    </ProjectConfiguration>
    2.23 +  </ItemGroup>
    2.24 +  <PropertyGroup Label="Globals">
    2.25 +    <ProjectGuid>{33048af1-031a-4ce6-b61e-fad2db832e9e}</ProjectGuid>
    2.26 +    <RootNamespace>SDL</RootNamespace>
    2.27 +    <DefaultLanguage>en-US</DefaultLanguage>
    2.28 +    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
    2.29 +    <ProjectName>SDL-WinPhone</ProjectName>
    2.30 +  </PropertyGroup>
    2.31 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
    2.32 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    2.33 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
    2.34 +    <UseDebugLibraries>true</UseDebugLibraries>
    2.35 +    <PlatformToolset>v110_wp80</PlatformToolset>
    2.36 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
    2.37 +  </PropertyGroup>
    2.38 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
    2.39 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
    2.40 +    <UseDebugLibraries>true</UseDebugLibraries>
    2.41 +    <PlatformToolset>v110_wp80</PlatformToolset>
    2.42 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
    2.43 +  </PropertyGroup>
    2.44 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    2.45 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
    2.46 +    <UseDebugLibraries>false</UseDebugLibraries>
    2.47 +    <WholeProgramOptimization>true</WholeProgramOptimization>
    2.48 +    <PlatformToolset>v110_wp80</PlatformToolset>
    2.49 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
    2.50 +  </PropertyGroup>
    2.51 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
    2.52 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
    2.53 +    <UseDebugLibraries>false</UseDebugLibraries>
    2.54 +    <WholeProgramOptimization>true</WholeProgramOptimization>
    2.55 +    <PlatformToolset>v110_wp80</PlatformToolset>
    2.56 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
    2.57 +  </PropertyGroup>
    2.58 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
    2.59 +  <ImportGroup Label="PropertySheets">
    2.60 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    2.61 +  </ImportGroup>
    2.62 +  <PropertyGroup Label="UserMacros" />
    2.63 +  <PropertyGroup>
    2.64 +    <GenerateManifest>false</GenerateManifest>
    2.65 +  </PropertyGroup>
    2.66 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    2.67 +    <ClCompile>
    2.68 +      <PreprocessorDefinitions>_USRDLL;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    2.69 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
    2.70 +      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
    2.71 +      <CompileAsWinRT>false</CompileAsWinRT>
    2.72 +      <AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
    2.73 +      <AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
    2.74 +      <MinimalRebuild>false</MinimalRebuild>
    2.75 +    </ClCompile>
    2.76 +    <Link>
    2.77 +      <SubSystem>Console</SubSystem>
    2.78 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
    2.79 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
    2.80 +      <GenerateDebugInformation>true</GenerateDebugInformation>
    2.81 +      <AdditionalDependencies>d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
    2.82 +    </Link>
    2.83 +  </ItemDefinitionGroup>
    2.84 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    2.85 +    <ClCompile>
    2.86 +      <PreprocessorDefinitions>_USRDLL;UNICODE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    2.87 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
    2.88 +      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
    2.89 +      <CompileAsWinRT>false</CompileAsWinRT>
    2.90 +      <AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
    2.91 +      <AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
    2.92 +    </ClCompile>
    2.93 +    <Link>
    2.94 +      <SubSystem>Console</SubSystem>
    2.95 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
    2.96 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
    2.97 +      <GenerateDebugInformation>true</GenerateDebugInformation>
    2.98 +      <AdditionalDependencies>d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
    2.99 +    </Link>
   2.100 +  </ItemDefinitionGroup>
   2.101 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
   2.102 +    <ClCompile>
   2.103 +      <PreprocessorDefinitions>_USRDLL;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   2.104 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   2.105 +      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
   2.106 +      <CompileAsWinRT>false</CompileAsWinRT>
   2.107 +      <AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
   2.108 +      <AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
   2.109 +      <MinimalRebuild>false</MinimalRebuild>
   2.110 +    </ClCompile>
   2.111 +    <Link>
   2.112 +      <SubSystem>Console</SubSystem>
   2.113 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   2.114 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   2.115 +      <GenerateDebugInformation>true</GenerateDebugInformation>
   2.116 +      <AdditionalDependencies>d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
   2.117 +    </Link>
   2.118 +  </ItemDefinitionGroup>
   2.119 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
   2.120 +    <ClCompile>
   2.121 +      <PreprocessorDefinitions>_USRDLL;UNICODE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   2.122 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   2.123 +      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
   2.124 +      <CompileAsWinRT>false</CompileAsWinRT>
   2.125 +      <AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
   2.126 +      <AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
   2.127 +    </ClCompile>
   2.128 +    <Link>
   2.129 +      <SubSystem>Console</SubSystem>
   2.130 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   2.131 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   2.132 +      <GenerateDebugInformation>true</GenerateDebugInformation>
   2.133 +      <AdditionalDependencies>d3d11.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies)</AdditionalDependencies>
   2.134 +    </Link>
   2.135 +  </ItemDefinitionGroup>
   2.136 +  <ItemGroup>
   2.137 +    <Reference Include="Windows">
   2.138 +      <IsWinMDFile>true</IsWinMDFile>
   2.139 +    </Reference>
   2.140 +    <Reference Include="platform.winmd">
   2.141 +      <IsWinMDFile>true</IsWinMDFile>
   2.142 +      <Private>false</Private>
   2.143 +    </Reference>
   2.144 +  </ItemGroup>
   2.145 +  <ItemGroup>
   2.146 +    <ClInclude Include="..\..\include\begin_code.h" />
   2.147 +    <ClInclude Include="..\..\include\close_code.h" />
   2.148 +    <ClInclude Include="..\..\include\SDL.h" />
   2.149 +    <ClInclude Include="..\..\include\SDL_assert.h" />
   2.150 +    <ClInclude Include="..\..\include\SDL_atomic.h" />
   2.151 +    <ClInclude Include="..\..\include\SDL_audio.h" />
   2.152 +    <ClInclude Include="..\..\include\SDL_blendmode.h" />
   2.153 +    <ClInclude Include="..\..\include\SDL_clipboard.h" />
   2.154 +    <ClInclude Include="..\..\include\SDL_config.h" />
   2.155 +    <ClInclude Include="..\..\include\SDL_config_minimal.h" />
   2.156 +    <ClInclude Include="..\..\include\SDL_config_winrt.h" />
   2.157 +    <ClInclude Include="..\..\include\SDL_copying.h" />
   2.158 +    <ClInclude Include="..\..\include\SDL_cpuinfo.h" />
   2.159 +    <ClInclude Include="..\..\include\SDL_endian.h" />
   2.160 +    <ClInclude Include="..\..\include\SDL_error.h" />
   2.161 +    <ClInclude Include="..\..\include\SDL_events.h" />
   2.162 +    <ClInclude Include="..\..\include\SDL_filesystem.h" />
   2.163 +    <ClInclude Include="..\..\include\SDL_haptic.h" />
   2.164 +    <ClInclude Include="..\..\include\SDL_hints.h" />
   2.165 +    <ClInclude Include="..\..\include\SDL_input.h" />
   2.166 +    <ClInclude Include="..\..\include\SDL_joystick.h" />
   2.167 +    <ClInclude Include="..\..\include\SDL_keyboard.h" />
   2.168 +    <ClInclude Include="..\..\include\SDL_keycode.h" />
   2.169 +    <ClInclude Include="..\..\include\SDL_loadso.h" />
   2.170 +    <ClInclude Include="..\..\include\SDL_log.h" />
   2.171 +    <ClInclude Include="..\..\include\SDL_main.h" />
   2.172 +    <ClInclude Include="..\..\include\SDL_mouse.h" />
   2.173 +    <ClInclude Include="..\..\include\SDL_mutex.h" />
   2.174 +    <ClInclude Include="..\..\include\SDL_name.h" />
   2.175 +    <ClInclude Include="..\..\include\SDL_pixels.h" />
   2.176 +    <ClInclude Include="..\..\include\SDL_platform.h" />
   2.177 +    <ClInclude Include="..\..\include\SDL_power.h" />
   2.178 +    <ClInclude Include="..\..\include\SDL_quit.h" />
   2.179 +    <ClInclude Include="..\..\include\SDL_rect.h" />
   2.180 +    <ClInclude Include="..\..\include\SDL_render.h" />
   2.181 +    <ClInclude Include="..\..\include\SDL_revision.h" />
   2.182 +    <ClInclude Include="..\..\include\SDL_rwops.h" />
   2.183 +    <ClInclude Include="..\..\include\SDL_scancode.h" />
   2.184 +    <ClInclude Include="..\..\include\SDL_shape.h" />
   2.185 +    <ClInclude Include="..\..\include\SDL_stdinc.h" />
   2.186 +    <ClInclude Include="..\..\include\SDL_surface.h" />
   2.187 +    <ClInclude Include="..\..\include\SDL_system.h" />
   2.188 +    <ClInclude Include="..\..\include\SDL_syswm.h" />
   2.189 +    <ClInclude Include="..\..\include\SDL_thread.h" />
   2.190 +    <ClInclude Include="..\..\include\SDL_timer.h" />
   2.191 +    <ClInclude Include="..\..\include\SDL_touch.h" />
   2.192 +    <ClInclude Include="..\..\include\SDL_types.h" />
   2.193 +    <ClInclude Include="..\..\include\SDL_version.h" />
   2.194 +    <ClInclude Include="..\..\include\SDL_video.h" />
   2.195 +    <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h" />
   2.196 +    <ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h" />
   2.197 +    <ClInclude Include="..\..\src\audio\SDL_audiodev_c.h" />
   2.198 +    <ClInclude Include="..\..\src\audio\SDL_audiomem.h" />
   2.199 +    <ClInclude Include="..\..\src\audio\SDL_audio_c.h" />
   2.200 +    <ClInclude Include="..\..\src\audio\SDL_sysaudio.h" />
   2.201 +    <ClInclude Include="..\..\src\audio\SDL_wave.h" />
   2.202 +    <ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.h" />
   2.203 +    <ClInclude Include="..\..\src\core\windows\SDL_windows.h" />
   2.204 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_common.h" />
   2.205 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.h" />
   2.206 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_xaml.h" />
   2.207 +    <ClInclude Include="..\..\src\events\blank_cursor.h" />
   2.208 +    <ClInclude Include="..\..\src\events\default_cursor.h" />
   2.209 +    <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h" />
   2.210 +    <ClInclude Include="..\..\src\events\SDL_dropevents_c.h" />
   2.211 +    <ClInclude Include="..\..\src\events\SDL_events_c.h" />
   2.212 +    <ClInclude Include="..\..\src\events\SDL_keyboard_c.h" />
   2.213 +    <ClInclude Include="..\..\src\events\SDL_mouse_c.h" />
   2.214 +    <ClInclude Include="..\..\src\events\SDL_sysevents.h" />
   2.215 +    <ClInclude Include="..\..\src\events\SDL_touch_c.h" />
   2.216 +    <ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
   2.217 +    <ClInclude Include="..\..\src\haptic\SDL_haptic_c.h" />
   2.218 +    <ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
   2.219 +    <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
   2.220 +    <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
   2.221 +    <ClInclude Include="..\..\src\render\mmx.h" />
   2.222 +    <ClInclude Include="..\..\src\render\SDL_sysrender.h" />
   2.223 +    <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h" />
   2.224 +    <ClInclude Include="..\..\src\render\software\SDL_blendfillrect.h" />
   2.225 +    <ClInclude Include="..\..\src\render\software\SDL_blendline.h" />
   2.226 +    <ClInclude Include="..\..\src\render\software\SDL_blendpoint.h" />
   2.227 +    <ClInclude Include="..\..\src\render\software\SDL_draw.h" />
   2.228 +    <ClInclude Include="..\..\src\render\software\SDL_drawline.h" />
   2.229 +    <ClInclude Include="..\..\src\render\software\SDL_drawpoint.h" />
   2.230 +    <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
   2.231 +    <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
   2.232 +    <ClInclude Include="..\..\src\SDL_assert_c.h" />
   2.233 +    <ClInclude Include="..\..\src\SDL_error_c.h" />
   2.234 +    <ClInclude Include="..\..\src\SDL_fatal.h" />
   2.235 +    <ClInclude Include="..\..\src\SDL_hints_c.h" />
   2.236 +    <ClInclude Include="..\..\src\thread\SDL_systhread.h" />
   2.237 +    <ClInclude Include="..\..\src\thread\SDL_thread_c.h" />
   2.238 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h" />
   2.239 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h" />
   2.240 +    <ClInclude Include="..\..\src\timer\SDL_timer_c.h" />
   2.241 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h" />
   2.242 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullframebuffer_c.h" />
   2.243 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullvideo.h" />
   2.244 +    <ClInclude Include="..\..\src\video\SDL_blit.h" />
   2.245 +    <ClInclude Include="..\..\src\video\SDL_blit_auto.h" />
   2.246 +    <ClInclude Include="..\..\src\video\SDL_blit_copy.h" />
   2.247 +    <ClInclude Include="..\..\src\video\SDL_blit_slow.h" />
   2.248 +    <ClInclude Include="..\..\src\video\SDL_pixels_c.h" />
   2.249 +    <ClInclude Include="..\..\src\video\SDL_rect_c.h" />
   2.250 +    <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
   2.251 +    <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
   2.252 +    <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
   2.253 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
   2.254 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
   2.255 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
   2.256 +  </ItemGroup>
   2.257 +  <ItemGroup>
   2.258 +    <ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
   2.259 +    <ClCompile Include="..\..\src\atomic\SDL_spinlock.c" />
   2.260 +    <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c" />
   2.261 +    <ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c" />
   2.262 +    <ClCompile Include="..\..\src\audio\SDL_audio.c" />
   2.263 +    <ClCompile Include="..\..\src\audio\SDL_audiocvt.c" />
   2.264 +    <ClCompile Include="..\..\src\audio\SDL_audiodev.c" />
   2.265 +    <ClCompile Include="..\..\src\audio\SDL_audiotypecvt.c" />
   2.266 +    <ClCompile Include="..\..\src\audio\SDL_mixer.c" />
   2.267 +    <ClCompile Include="..\..\src\audio\SDL_wave.c" />
   2.268 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c" />
   2.269 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.cpp">
   2.270 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   2.271 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   2.272 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   2.273 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   2.274 +    </ClCompile>
   2.275 +    <ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
   2.276 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_common.cpp">
   2.277 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   2.278 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   2.279 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   2.280 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   2.281 +    </ClCompile>
   2.282 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.cpp">
   2.283 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   2.284 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   2.285 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   2.286 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   2.287 +    </ClCompile>
   2.288 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_xaml.cpp">
   2.289 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   2.290 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   2.291 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   2.292 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   2.293 +    </ClCompile>
   2.294 +    <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
   2.295 +    <ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
   2.296 +    <ClCompile Include="..\..\src\events\SDL_dropevents.c" />
   2.297 +    <ClCompile Include="..\..\src\events\SDL_events.c" />
   2.298 +    <ClCompile Include="..\..\src\events\SDL_gesture.c" />
   2.299 +    <ClCompile Include="..\..\src\events\SDL_keyboard.c" />
   2.300 +    <ClCompile Include="..\..\src\events\SDL_mouse.c" />
   2.301 +    <ClCompile Include="..\..\src\events\SDL_quit.c" />
   2.302 +    <ClCompile Include="..\..\src\events\SDL_touch.c" />
   2.303 +    <ClCompile Include="..\..\src\events\SDL_windowevents.c" />
   2.304 +    <ClCompile Include="..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp">
   2.305 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   2.306 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   2.307 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   2.308 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   2.309 +    </ClCompile>
   2.310 +    <ClCompile Include="..\..\src\file\SDL_rwops.c" />
   2.311 +    <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c" />
   2.312 +    <ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
   2.313 +    <ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c" />
   2.314 +    <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
   2.315 +    <ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
   2.316 +    <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
   2.317 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.cpp">
   2.318 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   2.319 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   2.320 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   2.321 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   2.322 +    </ClCompile>
   2.323 +    <ClCompile Include="..\..\src\render\SDL_render.c" />
   2.324 +    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
   2.325 +    <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
   2.326 +    <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
   2.327 +    <ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
   2.328 +    <ClCompile Include="..\..\src\render\software\SDL_blendpoint.c" />
   2.329 +    <ClCompile Include="..\..\src\render\software\SDL_drawline.c" />
   2.330 +    <ClCompile Include="..\..\src\render\software\SDL_drawpoint.c" />
   2.331 +    <ClCompile Include="..\..\src\render\software\SDL_render_sw.c" />
   2.332 +    <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
   2.333 +    <ClCompile Include="..\..\src\SDL.c" />
   2.334 +    <ClCompile Include="..\..\src\SDL_assert.c" />
   2.335 +    <ClCompile Include="..\..\src\SDL_error.c" />
   2.336 +    <ClCompile Include="..\..\src\SDL_hints.c" />
   2.337 +    <ClCompile Include="..\..\src\SDL_log.c" />
   2.338 +    <ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
   2.339 +    <ClCompile Include="..\..\src\stdlib\SDL_iconv.c" />
   2.340 +    <ClCompile Include="..\..\src\stdlib\SDL_malloc.c" />
   2.341 +    <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
   2.342 +    <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
   2.343 +    <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
   2.344 +    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c" />
   2.345 +    <ClCompile Include="..\..\src\thread\SDL_thread.c" />
   2.346 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp" />
   2.347 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp" />
   2.348 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp" />
   2.349 +    <ClCompile Include="..\..\src\timer\SDL_timer.c" />
   2.350 +    <ClCompile Include="..\..\src\timer\windows\SDL_systimer.c" />
   2.351 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c" />
   2.352 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullframebuffer.c" />
   2.353 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullvideo.c" />
   2.354 +    <ClCompile Include="..\..\src\video\SDL_blit.c" />
   2.355 +    <ClCompile Include="..\..\src\video\SDL_blit_0.c" />
   2.356 +    <ClCompile Include="..\..\src\video\SDL_blit_1.c" />
   2.357 +    <ClCompile Include="..\..\src\video\SDL_blit_A.c" />
   2.358 +    <ClCompile Include="..\..\src\video\SDL_blit_auto.c" />
   2.359 +    <ClCompile Include="..\..\src\video\SDL_blit_copy.c" />
   2.360 +    <ClCompile Include="..\..\src\video\SDL_blit_N.c" />
   2.361 +    <ClCompile Include="..\..\src\video\SDL_blit_slow.c" />
   2.362 +    <ClCompile Include="..\..\src\video\SDL_bmp.c" />
   2.363 +    <ClCompile Include="..\..\src\video\SDL_clipboard.c" />
   2.364 +    <ClCompile Include="..\..\src\video\SDL_fillrect.c" />
   2.365 +    <ClCompile Include="..\..\src\video\SDL_pixels.c" />
   2.366 +    <ClCompile Include="..\..\src\video\SDL_rect.c" />
   2.367 +    <ClCompile Include="..\..\src\video\SDL_RLEaccel.c" />
   2.368 +    <ClCompile Include="..\..\src\video\SDL_shape.c" />
   2.369 +    <ClCompile Include="..\..\src\video\SDL_stretch.c" />
   2.370 +    <ClCompile Include="..\..\src\video\SDL_surface.c" />
   2.371 +    <ClCompile Include="..\..\src\video\SDL_video.c" />
   2.372 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
   2.373 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   2.374 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   2.375 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   2.376 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   2.377 +    </ClCompile>
   2.378 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtkeyboard.cpp">
   2.379 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   2.380 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   2.381 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   2.382 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   2.383 +    </ClCompile>
   2.384 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtmouse.cpp">
   2.385 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   2.386 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   2.387 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   2.388 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   2.389 +    </ClCompile>
   2.390 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
   2.391 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   2.392 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   2.393 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   2.394 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   2.395 +    </ClCompile>
   2.396 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtvideo.cpp">
   2.397 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   2.398 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   2.399 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   2.400 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   2.401 +    </ClCompile>
   2.402 +  </ItemGroup>
   2.403 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   2.404 +  <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsPhone\v$(TargetPlatformVersion)\Microsoft.Cpp.WindowsPhone.$(TargetPlatformVersion).targets" />
   2.405 +  <ImportGroup Label="ExtensionTargets">
   2.406 +  </ImportGroup>
   2.407 +</Project>
   2.408 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/VisualC-WinPhone/SDL/SDL-WinPhone_VS2012.vcxproj.filters	Sun Mar 09 11:36:47 2014 -0700
     3.3 @@ -0,0 +1,612 @@
     3.4 +<?xml version="1.0" encoding="utf-8"?>
     3.5 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     3.6 +  <ItemGroup>
     3.7 +    <Filter Include="Header Files">
     3.8 +      <UniqueIdentifier>{02b21b9a-45a7-41ee-a8a6-e45d14aa28da}</UniqueIdentifier>
     3.9 +    </Filter>
    3.10 +    <Filter Include="Source Files">
    3.11 +      <UniqueIdentifier>{abc3a7e6-f955-4cb5-8340-fae0f653e9c1}</UniqueIdentifier>
    3.12 +    </Filter>
    3.13 +  </ItemGroup>
    3.14 +  <ItemGroup>
    3.15 +    <ClInclude Include="..\..\include\begin_code.h">
    3.16 +      <Filter>Header Files</Filter>
    3.17 +    </ClInclude>
    3.18 +    <ClInclude Include="..\..\include\close_code.h">
    3.19 +      <Filter>Header Files</Filter>
    3.20 +    </ClInclude>
    3.21 +    <ClInclude Include="..\..\include\SDL.h">
    3.22 +      <Filter>Header Files</Filter>
    3.23 +    </ClInclude>
    3.24 +    <ClInclude Include="..\..\include\SDL_assert.h">
    3.25 +      <Filter>Header Files</Filter>
    3.26 +    </ClInclude>
    3.27 +    <ClInclude Include="..\..\include\SDL_atomic.h">
    3.28 +      <Filter>Header Files</Filter>
    3.29 +    </ClInclude>
    3.30 +    <ClInclude Include="..\..\include\SDL_audio.h">
    3.31 +      <Filter>Header Files</Filter>
    3.32 +    </ClInclude>
    3.33 +    <ClInclude Include="..\..\include\SDL_blendmode.h">
    3.34 +      <Filter>Header Files</Filter>
    3.35 +    </ClInclude>
    3.36 +    <ClInclude Include="..\..\include\SDL_clipboard.h">
    3.37 +      <Filter>Header Files</Filter>
    3.38 +    </ClInclude>
    3.39 +    <ClInclude Include="..\..\include\SDL_config.h">
    3.40 +      <Filter>Header Files</Filter>
    3.41 +    </ClInclude>
    3.42 +    <ClInclude Include="..\..\include\SDL_config_minimal.h">
    3.43 +      <Filter>Header Files</Filter>
    3.44 +    </ClInclude>
    3.45 +    <ClInclude Include="..\..\include\SDL_copying.h">
    3.46 +      <Filter>Header Files</Filter>
    3.47 +    </ClInclude>
    3.48 +    <ClInclude Include="..\..\include\SDL_cpuinfo.h">
    3.49 +      <Filter>Header Files</Filter>
    3.50 +    </ClInclude>
    3.51 +    <ClInclude Include="..\..\include\SDL_endian.h">
    3.52 +      <Filter>Header Files</Filter>
    3.53 +    </ClInclude>
    3.54 +    <ClInclude Include="..\..\include\SDL_error.h">
    3.55 +      <Filter>Header Files</Filter>
    3.56 +    </ClInclude>
    3.57 +    <ClInclude Include="..\..\include\SDL_events.h">
    3.58 +      <Filter>Header Files</Filter>
    3.59 +    </ClInclude>
    3.60 +    <ClInclude Include="..\..\include\SDL_haptic.h">
    3.61 +      <Filter>Header Files</Filter>
    3.62 +    </ClInclude>
    3.63 +    <ClInclude Include="..\..\include\SDL_hints.h">
    3.64 +      <Filter>Header Files</Filter>
    3.65 +    </ClInclude>
    3.66 +    <ClInclude Include="..\..\include\SDL_input.h">
    3.67 +      <Filter>Header Files</Filter>
    3.68 +    </ClInclude>
    3.69 +    <ClInclude Include="..\..\include\SDL_joystick.h">
    3.70 +      <Filter>Header Files</Filter>
    3.71 +    </ClInclude>
    3.72 +    <ClInclude Include="..\..\include\SDL_keyboard.h">
    3.73 +      <Filter>Header Files</Filter>
    3.74 +    </ClInclude>
    3.75 +    <ClInclude Include="..\..\include\SDL_keycode.h">
    3.76 +      <Filter>Header Files</Filter>
    3.77 +    </ClInclude>
    3.78 +    <ClInclude Include="..\..\include\SDL_loadso.h">
    3.79 +      <Filter>Header Files</Filter>
    3.80 +    </ClInclude>
    3.81 +    <ClInclude Include="..\..\include\SDL_log.h">
    3.82 +      <Filter>Header Files</Filter>
    3.83 +    </ClInclude>
    3.84 +    <ClInclude Include="..\..\include\SDL_main.h">
    3.85 +      <Filter>Header Files</Filter>
    3.86 +    </ClInclude>
    3.87 +    <ClInclude Include="..\..\include\SDL_mouse.h">
    3.88 +      <Filter>Header Files</Filter>
    3.89 +    </ClInclude>
    3.90 +    <ClInclude Include="..\..\include\SDL_mutex.h">
    3.91 +      <Filter>Header Files</Filter>
    3.92 +    </ClInclude>
    3.93 +    <ClInclude Include="..\..\include\SDL_name.h">
    3.94 +      <Filter>Header Files</Filter>
    3.95 +    </ClInclude>
    3.96 +    <ClInclude Include="..\..\include\SDL_pixels.h">
    3.97 +      <Filter>Header Files</Filter>
    3.98 +    </ClInclude>
    3.99 +    <ClInclude Include="..\..\include\SDL_platform.h">
   3.100 +      <Filter>Header Files</Filter>
   3.101 +    </ClInclude>
   3.102 +    <ClInclude Include="..\..\include\SDL_power.h">
   3.103 +      <Filter>Header Files</Filter>
   3.104 +    </ClInclude>
   3.105 +    <ClInclude Include="..\..\include\SDL_quit.h">
   3.106 +      <Filter>Header Files</Filter>
   3.107 +    </ClInclude>
   3.108 +    <ClInclude Include="..\..\include\SDL_rect.h">
   3.109 +      <Filter>Header Files</Filter>
   3.110 +    </ClInclude>
   3.111 +    <ClInclude Include="..\..\include\SDL_render.h">
   3.112 +      <Filter>Header Files</Filter>
   3.113 +    </ClInclude>
   3.114 +    <ClInclude Include="..\..\include\SDL_revision.h">
   3.115 +      <Filter>Header Files</Filter>
   3.116 +    </ClInclude>
   3.117 +    <ClInclude Include="..\..\include\SDL_rwops.h">
   3.118 +      <Filter>Header Files</Filter>
   3.119 +    </ClInclude>
   3.120 +    <ClInclude Include="..\..\include\SDL_scancode.h">
   3.121 +      <Filter>Header Files</Filter>
   3.122 +    </ClInclude>
   3.123 +    <ClInclude Include="..\..\include\SDL_shape.h">
   3.124 +      <Filter>Header Files</Filter>
   3.125 +    </ClInclude>
   3.126 +    <ClInclude Include="..\..\include\SDL_stdinc.h">
   3.127 +      <Filter>Header Files</Filter>
   3.128 +    </ClInclude>
   3.129 +    <ClInclude Include="..\..\include\SDL_surface.h">
   3.130 +      <Filter>Header Files</Filter>
   3.131 +    </ClInclude>
   3.132 +    <ClInclude Include="..\..\include\SDL_system.h">
   3.133 +      <Filter>Header Files</Filter>
   3.134 +    </ClInclude>
   3.135 +    <ClInclude Include="..\..\include\SDL_syswm.h">
   3.136 +      <Filter>Header Files</Filter>
   3.137 +    </ClInclude>
   3.138 +    <ClInclude Include="..\..\include\SDL_thread.h">
   3.139 +      <Filter>Header Files</Filter>
   3.140 +    </ClInclude>
   3.141 +    <ClInclude Include="..\..\include\SDL_timer.h">
   3.142 +      <Filter>Header Files</Filter>
   3.143 +    </ClInclude>
   3.144 +    <ClInclude Include="..\..\include\SDL_touch.h">
   3.145 +      <Filter>Header Files</Filter>
   3.146 +    </ClInclude>
   3.147 +    <ClInclude Include="..\..\include\SDL_types.h">
   3.148 +      <Filter>Header Files</Filter>
   3.149 +    </ClInclude>
   3.150 +    <ClInclude Include="..\..\include\SDL_version.h">
   3.151 +      <Filter>Header Files</Filter>
   3.152 +    </ClInclude>
   3.153 +    <ClInclude Include="..\..\include\SDL_video.h">
   3.154 +      <Filter>Header Files</Filter>
   3.155 +    </ClInclude>
   3.156 +    <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h">
   3.157 +      <Filter>Source Files</Filter>
   3.158 +    </ClInclude>
   3.159 +    <ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h">
   3.160 +      <Filter>Source Files</Filter>
   3.161 +    </ClInclude>
   3.162 +    <ClInclude Include="..\..\src\audio\SDL_audiodev_c.h">
   3.163 +      <Filter>Source Files</Filter>
   3.164 +    </ClInclude>
   3.165 +    <ClInclude Include="..\..\src\audio\SDL_audiomem.h">
   3.166 +      <Filter>Source Files</Filter>
   3.167 +    </ClInclude>
   3.168 +    <ClInclude Include="..\..\src\audio\SDL_audio_c.h">
   3.169 +      <Filter>Source Files</Filter>
   3.170 +    </ClInclude>
   3.171 +    <ClInclude Include="..\..\src\audio\SDL_sysaudio.h">
   3.172 +      <Filter>Source Files</Filter>
   3.173 +    </ClInclude>
   3.174 +    <ClInclude Include="..\..\src\audio\SDL_wave.h">
   3.175 +      <Filter>Source Files</Filter>
   3.176 +    </ClInclude>
   3.177 +    <ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.h">
   3.178 +      <Filter>Source Files</Filter>
   3.179 +    </ClInclude>
   3.180 +    <ClInclude Include="..\..\src\core\windows\SDL_windows.h">
   3.181 +      <Filter>Source Files</Filter>
   3.182 +    </ClInclude>
   3.183 +    <ClInclude Include="..\..\src\events\blank_cursor.h">
   3.184 +      <Filter>Source Files</Filter>
   3.185 +    </ClInclude>
   3.186 +    <ClInclude Include="..\..\src\events\default_cursor.h">
   3.187 +      <Filter>Source Files</Filter>
   3.188 +    </ClInclude>
   3.189 +    <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h">
   3.190 +      <Filter>Source Files</Filter>
   3.191 +    </ClInclude>
   3.192 +    <ClInclude Include="..\..\src\events\SDL_dropevents_c.h">
   3.193 +      <Filter>Source Files</Filter>
   3.194 +    </ClInclude>
   3.195 +    <ClInclude Include="..\..\src\events\SDL_events_c.h">
   3.196 +      <Filter>Source Files</Filter>
   3.197 +    </ClInclude>
   3.198 +    <ClInclude Include="..\..\src\events\SDL_keyboard_c.h">
   3.199 +      <Filter>Source Files</Filter>
   3.200 +    </ClInclude>
   3.201 +    <ClInclude Include="..\..\src\events\SDL_mouse_c.h">
   3.202 +      <Filter>Source Files</Filter>
   3.203 +    </ClInclude>
   3.204 +    <ClInclude Include="..\..\src\events\SDL_sysevents.h">
   3.205 +      <Filter>Source Files</Filter>
   3.206 +    </ClInclude>
   3.207 +    <ClInclude Include="..\..\src\events\SDL_touch_c.h">
   3.208 +      <Filter>Source Files</Filter>
   3.209 +    </ClInclude>
   3.210 +    <ClInclude Include="..\..\src\events\SDL_windowevents_c.h">
   3.211 +      <Filter>Source Files</Filter>
   3.212 +    </ClInclude>
   3.213 +    <ClInclude Include="..\..\src\haptic\SDL_haptic_c.h">
   3.214 +      <Filter>Source Files</Filter>
   3.215 +    </ClInclude>
   3.216 +    <ClInclude Include="..\..\src\haptic\SDL_syshaptic.h">
   3.217 +      <Filter>Source Files</Filter>
   3.218 +    </ClInclude>
   3.219 +    <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h">
   3.220 +      <Filter>Source Files</Filter>
   3.221 +    </ClInclude>
   3.222 +    <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h">
   3.223 +      <Filter>Source Files</Filter>
   3.224 +    </ClInclude>
   3.225 +    <ClInclude Include="..\..\src\render\mmx.h">
   3.226 +      <Filter>Source Files</Filter>
   3.227 +    </ClInclude>
   3.228 +    <ClInclude Include="..\..\src\render\SDL_sysrender.h">
   3.229 +      <Filter>Source Files</Filter>
   3.230 +    </ClInclude>
   3.231 +    <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h">
   3.232 +      <Filter>Source Files</Filter>
   3.233 +    </ClInclude>
   3.234 +    <ClInclude Include="..\..\src\render\software\SDL_blendfillrect.h">
   3.235 +      <Filter>Source Files</Filter>
   3.236 +    </ClInclude>
   3.237 +    <ClInclude Include="..\..\src\render\software\SDL_blendline.h">
   3.238 +      <Filter>Source Files</Filter>
   3.239 +    </ClInclude>
   3.240 +    <ClInclude Include="..\..\src\render\software\SDL_blendpoint.h">
   3.241 +      <Filter>Source Files</Filter>
   3.242 +    </ClInclude>
   3.243 +    <ClInclude Include="..\..\src\render\software\SDL_draw.h">
   3.244 +      <Filter>Source Files</Filter>
   3.245 +    </ClInclude>
   3.246 +    <ClInclude Include="..\..\src\render\software\SDL_drawline.h">
   3.247 +      <Filter>Source Files</Filter>
   3.248 +    </ClInclude>
   3.249 +    <ClInclude Include="..\..\src\render\software\SDL_drawpoint.h">
   3.250 +      <Filter>Source Files</Filter>
   3.251 +    </ClInclude>
   3.252 +    <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h">
   3.253 +      <Filter>Source Files</Filter>
   3.254 +    </ClInclude>
   3.255 +    <ClInclude Include="..\..\src\render\software\SDL_rotate.h">
   3.256 +      <Filter>Source Files</Filter>
   3.257 +    </ClInclude>
   3.258 +    <ClInclude Include="..\..\src\SDL_assert_c.h">
   3.259 +      <Filter>Source Files</Filter>
   3.260 +    </ClInclude>
   3.261 +    <ClInclude Include="..\..\src\SDL_error_c.h">
   3.262 +      <Filter>Source Files</Filter>
   3.263 +    </ClInclude>
   3.264 +    <ClInclude Include="..\..\src\SDL_fatal.h">
   3.265 +      <Filter>Source Files</Filter>
   3.266 +    </ClInclude>
   3.267 +    <ClInclude Include="..\..\src\SDL_hints_c.h">
   3.268 +      <Filter>Source Files</Filter>
   3.269 +    </ClInclude>
   3.270 +    <ClInclude Include="..\..\src\thread\SDL_systhread.h">
   3.271 +      <Filter>Source Files</Filter>
   3.272 +    </ClInclude>
   3.273 +    <ClInclude Include="..\..\src\thread\SDL_thread_c.h">
   3.274 +      <Filter>Source Files</Filter>
   3.275 +    </ClInclude>
   3.276 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h">
   3.277 +      <Filter>Source Files</Filter>
   3.278 +    </ClInclude>
   3.279 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h">
   3.280 +      <Filter>Source Files</Filter>
   3.281 +    </ClInclude>
   3.282 +    <ClInclude Include="..\..\src\timer\SDL_timer_c.h">
   3.283 +      <Filter>Source Files</Filter>
   3.284 +    </ClInclude>
   3.285 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h">
   3.286 +      <Filter>Source Files</Filter>
   3.287 +    </ClInclude>
   3.288 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullframebuffer_c.h">
   3.289 +      <Filter>Source Files</Filter>
   3.290 +    </ClInclude>
   3.291 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullvideo.h">
   3.292 +      <Filter>Source Files</Filter>
   3.293 +    </ClInclude>
   3.294 +    <ClInclude Include="..\..\src\video\SDL_blit.h">
   3.295 +      <Filter>Source Files</Filter>
   3.296 +    </ClInclude>
   3.297 +    <ClInclude Include="..\..\src\video\SDL_blit_auto.h">
   3.298 +      <Filter>Source Files</Filter>
   3.299 +    </ClInclude>
   3.300 +    <ClInclude Include="..\..\src\video\SDL_blit_copy.h">
   3.301 +      <Filter>Source Files</Filter>
   3.302 +    </ClInclude>
   3.303 +    <ClInclude Include="..\..\src\video\SDL_blit_slow.h">
   3.304 +      <Filter>Source Files</Filter>
   3.305 +    </ClInclude>
   3.306 +    <ClInclude Include="..\..\src\video\SDL_pixels_c.h">
   3.307 +      <Filter>Source Files</Filter>
   3.308 +    </ClInclude>
   3.309 +    <ClInclude Include="..\..\src\video\SDL_rect_c.h">
   3.310 +      <Filter>Source Files</Filter>
   3.311 +    </ClInclude>
   3.312 +    <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h">
   3.313 +      <Filter>Source Files</Filter>
   3.314 +    </ClInclude>
   3.315 +    <ClInclude Include="..\..\src\video\SDL_shape_internals.h">
   3.316 +      <Filter>Source Files</Filter>
   3.317 +    </ClInclude>
   3.318 +    <ClInclude Include="..\..\src\video\SDL_sysvideo.h">
   3.319 +      <Filter>Source Files</Filter>
   3.320 +    </ClInclude>
   3.321 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h">
   3.322 +      <Filter>Source Files</Filter>
   3.323 +    </ClInclude>
   3.324 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h">
   3.325 +      <Filter>Source Files</Filter>
   3.326 +    </ClInclude>
   3.327 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h">
   3.328 +      <Filter>Source Files</Filter>
   3.329 +    </ClInclude>
   3.330 +    <ClInclude Include="..\..\include\SDL_config_winrt.h">
   3.331 +      <Filter>Header Files</Filter>
   3.332 +    </ClInclude>
   3.333 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.h">
   3.334 +      <Filter>Source Files</Filter>
   3.335 +    </ClInclude>
   3.336 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_xaml.h">
   3.337 +      <Filter>Source Files</Filter>
   3.338 +    </ClInclude>
   3.339 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_common.h">
   3.340 +      <Filter>Source Files</Filter>
   3.341 +    </ClInclude>
   3.342 +    <ClInclude Include="..\..\include\SDL_filesystem.h">
   3.343 +      <Filter>Header Files</Filter>
   3.344 +    </ClInclude>
   3.345 +  </ItemGroup>
   3.346 +  <ItemGroup>
   3.347 +    <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
   3.348 +      <Filter>Source Files</Filter>
   3.349 +    </ClCompile>
   3.350 +    <ClCompile Include="..\..\src\atomic\SDL_spinlock.c">
   3.351 +      <Filter>Source Files</Filter>
   3.352 +    </ClCompile>
   3.353 +    <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c">
   3.354 +      <Filter>Source Files</Filter>
   3.355 +    </ClCompile>
   3.356 +    <ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c">
   3.357 +      <Filter>Source Files</Filter>
   3.358 +    </ClCompile>
   3.359 +    <ClCompile Include="..\..\src\audio\SDL_audio.c">
   3.360 +      <Filter>Source Files</Filter>
   3.361 +    </ClCompile>
   3.362 +    <ClCompile Include="..\..\src\audio\SDL_audiocvt.c">
   3.363 +      <Filter>Source Files</Filter>
   3.364 +    </ClCompile>
   3.365 +    <ClCompile Include="..\..\src\audio\SDL_audiodev.c">
   3.366 +      <Filter>Source Files</Filter>
   3.367 +    </ClCompile>
   3.368 +    <ClCompile Include="..\..\src\audio\SDL_audiotypecvt.c">
   3.369 +      <Filter>Source Files</Filter>
   3.370 +    </ClCompile>
   3.371 +    <ClCompile Include="..\..\src\audio\SDL_mixer.c">
   3.372 +      <Filter>Source Files</Filter>
   3.373 +    </ClCompile>
   3.374 +    <ClCompile Include="..\..\src\audio\SDL_wave.c">
   3.375 +      <Filter>Source Files</Filter>
   3.376 +    </ClCompile>
   3.377 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c">
   3.378 +      <Filter>Source Files</Filter>
   3.379 +    </ClCompile>
   3.380 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.cpp">
   3.381 +      <Filter>Source Files</Filter>
   3.382 +    </ClCompile>
   3.383 +    <ClCompile Include="..\..\src\core\windows\SDL_windows.c">
   3.384 +      <Filter>Source Files</Filter>
   3.385 +    </ClCompile>
   3.386 +    <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c">
   3.387 +      <Filter>Source Files</Filter>
   3.388 +    </ClCompile>
   3.389 +    <ClCompile Include="..\..\src\events\SDL_clipboardevents.c">
   3.390 +      <Filter>Source Files</Filter>
   3.391 +    </ClCompile>
   3.392 +    <ClCompile Include="..\..\src\events\SDL_dropevents.c">
   3.393 +      <Filter>Source Files</Filter>
   3.394 +    </ClCompile>
   3.395 +    <ClCompile Include="..\..\src\events\SDL_events.c">
   3.396 +      <Filter>Source Files</Filter>
   3.397 +    </ClCompile>
   3.398 +    <ClCompile Include="..\..\src\events\SDL_gesture.c">
   3.399 +      <Filter>Source Files</Filter>
   3.400 +    </ClCompile>
   3.401 +    <ClCompile Include="..\..\src\events\SDL_keyboard.c">
   3.402 +      <Filter>Source Files</Filter>
   3.403 +    </ClCompile>
   3.404 +    <ClCompile Include="..\..\src\events\SDL_mouse.c">
   3.405 +      <Filter>Source Files</Filter>
   3.406 +    </ClCompile>
   3.407 +    <ClCompile Include="..\..\src\events\SDL_quit.c">
   3.408 +      <Filter>Source Files</Filter>
   3.409 +    </ClCompile>
   3.410 +    <ClCompile Include="..\..\src\events\SDL_touch.c">
   3.411 +      <Filter>Source Files</Filter>
   3.412 +    </ClCompile>
   3.413 +    <ClCompile Include="..\..\src\events\SDL_windowevents.c">
   3.414 +      <Filter>Source Files</Filter>
   3.415 +    </ClCompile>
   3.416 +    <ClCompile Include="..\..\src\file\SDL_rwops.c">
   3.417 +      <Filter>Source Files</Filter>
   3.418 +    </ClCompile>
   3.419 +    <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c">
   3.420 +      <Filter>Source Files</Filter>
   3.421 +    </ClCompile>
   3.422 +    <ClCompile Include="..\..\src\haptic\SDL_haptic.c">
   3.423 +      <Filter>Source Files</Filter>
   3.424 +    </ClCompile>
   3.425 +    <ClCompile Include="..\..\src\joystick\dummy\SDL_sysjoystick.c">
   3.426 +      <Filter>Source Files</Filter>
   3.427 +    </ClCompile>
   3.428 +    <ClCompile Include="..\..\src\joystick\SDL_joystick.c">
   3.429 +      <Filter>Source Files</Filter>
   3.430 +    </ClCompile>
   3.431 +    <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c">
   3.432 +      <Filter>Source Files</Filter>
   3.433 +    </ClCompile>
   3.434 +    <ClCompile Include="..\..\src\render\SDL_render.c">
   3.435 +      <Filter>Source Files</Filter>
   3.436 +    </ClCompile>
   3.437 +    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
   3.438 +      <Filter>Source Files</Filter>
   3.439 +    </ClCompile>
   3.440 +    <ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
   3.441 +      <Filter>Source Files</Filter>
   3.442 +    </ClCompile>
   3.443 +    <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c">
   3.444 +      <Filter>Source Files</Filter>
   3.445 +    </ClCompile>
   3.446 +    <ClCompile Include="..\..\src\render\software\SDL_blendline.c">
   3.447 +      <Filter>Source Files</Filter>
   3.448 +    </ClCompile>
   3.449 +    <ClCompile Include="..\..\src\render\software\SDL_blendpoint.c">
   3.450 +      <Filter>Source Files</Filter>
   3.451 +    </ClCompile>
   3.452 +    <ClCompile Include="..\..\src\render\software\SDL_drawline.c">
   3.453 +      <Filter>Source Files</Filter>
   3.454 +    </ClCompile>
   3.455 +    <ClCompile Include="..\..\src\render\software\SDL_drawpoint.c">
   3.456 +      <Filter>Source Files</Filter>
   3.457 +    </ClCompile>
   3.458 +    <ClCompile Include="..\..\src\render\software\SDL_render_sw.c">
   3.459 +      <Filter>Source Files</Filter>
   3.460 +    </ClCompile>
   3.461 +    <ClCompile Include="..\..\src\render\software\SDL_rotate.c">
   3.462 +      <Filter>Source Files</Filter>
   3.463 +    </ClCompile>
   3.464 +    <ClCompile Include="..\..\src\SDL.c">
   3.465 +      <Filter>Source Files</Filter>
   3.466 +    </ClCompile>
   3.467 +    <ClCompile Include="..\..\src\SDL_assert.c">
   3.468 +      <Filter>Source Files</Filter>
   3.469 +    </ClCompile>
   3.470 +    <ClCompile Include="..\..\src\SDL_error.c">
   3.471 +      <Filter>Source Files</Filter>
   3.472 +    </ClCompile>
   3.473 +    <ClCompile Include="..\..\src\SDL_hints.c">
   3.474 +      <Filter>Source Files</Filter>
   3.475 +    </ClCompile>
   3.476 +    <ClCompile Include="..\..\src\SDL_log.c">
   3.477 +      <Filter>Source Files</Filter>
   3.478 +    </ClCompile>
   3.479 +    <ClCompile Include="..\..\src\stdlib\SDL_getenv.c">
   3.480 +      <Filter>Source Files</Filter>
   3.481 +    </ClCompile>
   3.482 +    <ClCompile Include="..\..\src\stdlib\SDL_iconv.c">
   3.483 +      <Filter>Source Files</Filter>
   3.484 +    </ClCompile>
   3.485 +    <ClCompile Include="..\..\src\stdlib\SDL_qsort.c">
   3.486 +      <Filter>Source Files</Filter>
   3.487 +    </ClCompile>
   3.488 +    <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c">
   3.489 +      <Filter>Source Files</Filter>
   3.490 +    </ClCompile>
   3.491 +    <ClCompile Include="..\..\src\stdlib\SDL_string.c">
   3.492 +      <Filter>Source Files</Filter>
   3.493 +    </ClCompile>
   3.494 +    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c">
   3.495 +      <Filter>Source Files</Filter>
   3.496 +    </ClCompile>
   3.497 +    <ClCompile Include="..\..\src\thread\SDL_thread.c">
   3.498 +      <Filter>Source Files</Filter>
   3.499 +    </ClCompile>
   3.500 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp">
   3.501 +      <Filter>Source Files</Filter>
   3.502 +    </ClCompile>
   3.503 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp">
   3.504 +      <Filter>Source Files</Filter>
   3.505 +    </ClCompile>
   3.506 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp">
   3.507 +      <Filter>Source Files</Filter>
   3.508 +    </ClCompile>
   3.509 +    <ClCompile Include="..\..\src\timer\SDL_timer.c">
   3.510 +      <Filter>Source Files</Filter>
   3.511 +    </ClCompile>
   3.512 +    <ClCompile Include="..\..\src\timer\windows\SDL_systimer.c">
   3.513 +      <Filter>Source Files</Filter>
   3.514 +    </ClCompile>
   3.515 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c">
   3.516 +      <Filter>Source Files</Filter>
   3.517 +    </ClCompile>
   3.518 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullframebuffer.c">
   3.519 +      <Filter>Source Files</Filter>
   3.520 +    </ClCompile>
   3.521 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullvideo.c">
   3.522 +      <Filter>Source Files</Filter>
   3.523 +    </ClCompile>
   3.524 +    <ClCompile Include="..\..\src\video\SDL_blit.c">
   3.525 +      <Filter>Source Files</Filter>
   3.526 +    </ClCompile>
   3.527 +    <ClCompile Include="..\..\src\video\SDL_blit_0.c">
   3.528 +      <Filter>Source Files</Filter>
   3.529 +    </ClCompile>
   3.530 +    <ClCompile Include="..\..\src\video\SDL_blit_1.c">
   3.531 +      <Filter>Source Files</Filter>
   3.532 +    </ClCompile>
   3.533 +    <ClCompile Include="..\..\src\video\SDL_blit_A.c">
   3.534 +      <Filter>Source Files</Filter>
   3.535 +    </ClCompile>
   3.536 +    <ClCompile Include="..\..\src\video\SDL_blit_auto.c">
   3.537 +      <Filter>Source Files</Filter>
   3.538 +    </ClCompile>
   3.539 +    <ClCompile Include="..\..\src\video\SDL_blit_copy.c">
   3.540 +      <Filter>Source Files</Filter>
   3.541 +    </ClCompile>
   3.542 +    <ClCompile Include="..\..\src\video\SDL_blit_N.c">
   3.543 +      <Filter>Source Files</Filter>
   3.544 +    </ClCompile>
   3.545 +    <ClCompile Include="..\..\src\video\SDL_blit_slow.c">
   3.546 +      <Filter>Source Files</Filter>
   3.547 +    </ClCompile>
   3.548 +    <ClCompile Include="..\..\src\video\SDL_bmp.c">
   3.549 +      <Filter>Source Files</Filter>
   3.550 +    </ClCompile>
   3.551 +    <ClCompile Include="..\..\src\video\SDL_clipboard.c">
   3.552 +      <Filter>Source Files</Filter>
   3.553 +    </ClCompile>
   3.554 +    <ClCompile Include="..\..\src\video\SDL_fillrect.c">
   3.555 +      <Filter>Source Files</Filter>
   3.556 +    </ClCompile>
   3.557 +    <ClCompile Include="..\..\src\video\SDL_pixels.c">
   3.558 +      <Filter>Source Files</Filter>
   3.559 +    </ClCompile>
   3.560 +    <ClCompile Include="..\..\src\video\SDL_rect.c">
   3.561 +      <Filter>Source Files</Filter>
   3.562 +    </ClCompile>
   3.563 +    <ClCompile Include="..\..\src\video\SDL_RLEaccel.c">
   3.564 +      <Filter>Source Files</Filter>
   3.565 +    </ClCompile>
   3.566 +    <ClCompile Include="..\..\src\video\SDL_shape.c">
   3.567 +      <Filter>Source Files</Filter>
   3.568 +    </ClCompile>
   3.569 +    <ClCompile Include="..\..\src\video\SDL_stretch.c">
   3.570 +      <Filter>Source Files</Filter>
   3.571 +    </ClCompile>
   3.572 +    <ClCompile Include="..\..\src\video\SDL_surface.c">
   3.573 +      <Filter>Source Files</Filter>
   3.574 +    </ClCompile>
   3.575 +    <ClCompile Include="..\..\src\video\SDL_video.c">
   3.576 +      <Filter>Source Files</Filter>
   3.577 +    </ClCompile>
   3.578 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.cpp">
   3.579 +      <Filter>Source Files</Filter>
   3.580 +    </ClCompile>
   3.581 +    <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c">
   3.582 +      <Filter>Source Files</Filter>
   3.583 +    </ClCompile>
   3.584 +    <ClCompile Include="..\..\src\stdlib\SDL_malloc.c">
   3.585 +      <Filter>Source Files</Filter>
   3.586 +    </ClCompile>
   3.587 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
   3.588 +      <Filter>Source Files</Filter>
   3.589 +    </ClCompile>
   3.590 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtmouse.cpp">
   3.591 +      <Filter>Source Files</Filter>
   3.592 +    </ClCompile>
   3.593 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtvideo.cpp">
   3.594 +      <Filter>Source Files</Filter>
   3.595 +    </ClCompile>
   3.596 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtkeyboard.cpp">
   3.597 +      <Filter>Source Files</Filter>
   3.598 +    </ClCompile>
   3.599 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
   3.600 +      <Filter>Source Files</Filter>
   3.601 +    </ClCompile>
   3.602 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.cpp">
   3.603 +      <Filter>Source Files</Filter>
   3.604 +    </ClCompile>
   3.605 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_xaml.cpp">
   3.606 +      <Filter>Source Files</Filter>
   3.607 +    </ClCompile>
   3.608 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_common.cpp">
   3.609 +      <Filter>Source Files</Filter>
   3.610 +    </ClCompile>
   3.611 +    <ClCompile Include="..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp">
   3.612 +      <Filter>Source Files</Filter>
   3.613 +    </ClCompile>
   3.614 +  </ItemGroup>
   3.615 +</Project>
   3.616 \ No newline at end of file
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/VisualC-WinRT/SDL-WinRT_VS2012.sln	Sun Mar 09 11:36:47 2014 -0700
     4.3 @@ -0,0 +1,32 @@
     4.4 +
     4.5 +Microsoft Visual Studio Solution File, Format Version 12.00
     4.6 +# Visual Studio 2012
     4.7 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL-WinRT", "SDL\SDL-WinRT_VS2012.vcxproj", "{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}"
     4.8 +EndProject
     4.9 +Global
    4.10 +	GlobalSection(SolutionConfigurationPlatforms) = preSolution
    4.11 +		Debug|ARM = Debug|ARM
    4.12 +		Debug|Win32 = Debug|Win32
    4.13 +		Debug|x64 = Debug|x64
    4.14 +		Release|ARM = Release|ARM
    4.15 +		Release|Win32 = Release|Win32
    4.16 +		Release|x64 = Release|x64
    4.17 +	EndGlobalSection
    4.18 +	GlobalSection(ProjectConfigurationPlatforms) = postSolution
    4.19 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|ARM.ActiveCfg = Debug|ARM
    4.20 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|ARM.Build.0 = Debug|ARM
    4.21 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|Win32.ActiveCfg = Debug|Win32
    4.22 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|Win32.Build.0 = Debug|Win32
    4.23 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|x64.ActiveCfg = Debug|x64
    4.24 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Debug|x64.Build.0 = Debug|x64
    4.25 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|ARM.ActiveCfg = Release|ARM
    4.26 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|ARM.Build.0 = Release|ARM
    4.27 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|Win32.ActiveCfg = Release|Win32
    4.28 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|Win32.Build.0 = Release|Win32
    4.29 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|x64.ActiveCfg = Release|x64
    4.30 +		{AEAEA3A2-D4E6-45B1-8EC6-53D84287FC14}.Release|x64.Build.0 = Release|x64
    4.31 +	EndGlobalSection
    4.32 +	GlobalSection(SolutionProperties) = preSolution
    4.33 +		HideSolutionNode = FALSE
    4.34 +	EndGlobalSection
    4.35 +EndGlobal
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj	Sun Mar 09 11:36:47 2014 -0700
     5.3 @@ -0,0 +1,508 @@
     5.4 +<?xml version="1.0" encoding="utf-8"?>
     5.5 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     5.6 +  <ItemGroup Label="ProjectConfigurations">
     5.7 +    <ProjectConfiguration Include="Debug|ARM">
     5.8 +      <Configuration>Debug</Configuration>
     5.9 +      <Platform>ARM</Platform>
    5.10 +    </ProjectConfiguration>
    5.11 +    <ProjectConfiguration Include="Debug|Win32">
    5.12 +      <Configuration>Debug</Configuration>
    5.13 +      <Platform>Win32</Platform>
    5.14 +    </ProjectConfiguration>
    5.15 +    <ProjectConfiguration Include="Debug|x64">
    5.16 +      <Configuration>Debug</Configuration>
    5.17 +      <Platform>x64</Platform>
    5.18 +    </ProjectConfiguration>
    5.19 +    <ProjectConfiguration Include="Release|ARM">
    5.20 +      <Configuration>Release</Configuration>
    5.21 +      <Platform>ARM</Platform>
    5.22 +    </ProjectConfiguration>
    5.23 +    <ProjectConfiguration Include="Release|Win32">
    5.24 +      <Configuration>Release</Configuration>
    5.25 +      <Platform>Win32</Platform>
    5.26 +    </ProjectConfiguration>
    5.27 +    <ProjectConfiguration Include="Release|x64">
    5.28 +      <Configuration>Release</Configuration>
    5.29 +      <Platform>x64</Platform>
    5.30 +    </ProjectConfiguration>
    5.31 +  </ItemGroup>
    5.32 +  <ItemGroup>
    5.33 +    <ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
    5.34 +    <ClCompile Include="..\..\src\atomic\SDL_spinlock.c" />
    5.35 +    <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c" />
    5.36 +    <ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c" />
    5.37 +    <ClCompile Include="..\..\src\audio\SDL_audio.c" />
    5.38 +    <ClCompile Include="..\..\src\audio\SDL_audiocvt.c" />
    5.39 +    <ClCompile Include="..\..\src\audio\SDL_audiodev.c" />
    5.40 +    <ClCompile Include="..\..\src\audio\SDL_audiotypecvt.c" />
    5.41 +    <ClCompile Include="..\..\src\audio\SDL_mixer.c" />
    5.42 +    <ClCompile Include="..\..\src\audio\SDL_wave.c" />
    5.43 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c" />
    5.44 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.cpp">
    5.45 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    5.46 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    5.47 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    5.48 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    5.49 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
    5.50 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    5.51 +    </ClCompile>
    5.52 +    <ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
    5.53 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_common.cpp">
    5.54 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    5.55 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    5.56 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    5.57 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    5.58 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
    5.59 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    5.60 +    </ClCompile>
    5.61 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.cpp">
    5.62 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    5.63 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    5.64 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    5.65 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    5.66 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
    5.67 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    5.68 +    </ClCompile>
    5.69 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_xaml.cpp">
    5.70 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    5.71 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    5.72 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    5.73 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    5.74 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
    5.75 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    5.76 +    </ClCompile>
    5.77 +    <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c" />
    5.78 +    <ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
    5.79 +    <ClCompile Include="..\..\src\events\SDL_dropevents.c" />
    5.80 +    <ClCompile Include="..\..\src\events\SDL_events.c" />
    5.81 +    <ClCompile Include="..\..\src\events\SDL_gesture.c" />
    5.82 +    <ClCompile Include="..\..\src\events\SDL_keyboard.c" />
    5.83 +    <ClCompile Include="..\..\src\events\SDL_mouse.c" />
    5.84 +    <ClCompile Include="..\..\src\events\SDL_quit.c" />
    5.85 +    <ClCompile Include="..\..\src\events\SDL_touch.c" />
    5.86 +    <ClCompile Include="..\..\src\events\SDL_windowevents.c" />
    5.87 +    <ClCompile Include="..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp">
    5.88 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    5.89 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    5.90 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    5.91 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    5.92 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
    5.93 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    5.94 +    </ClCompile>
    5.95 +    <ClCompile Include="..\..\src\file\SDL_rwops.c" />
    5.96 +    <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c" />
    5.97 +    <ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
    5.98 +    <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
    5.99 +    <ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
   5.100 +    <ClCompile Include="..\..\src\joystick\winrt\SDL_xinputjoystick.c" />
   5.101 +    <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
   5.102 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.cpp">
   5.103 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   5.104 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   5.105 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   5.106 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   5.107 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   5.108 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   5.109 +    </ClCompile>
   5.110 +    <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
   5.111 +    <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
   5.112 +    <ClCompile Include="..\..\src\render\SDL_render.c" />
   5.113 +    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
   5.114 +    <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
   5.115 +    <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
   5.116 +    <ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
   5.117 +    <ClCompile Include="..\..\src\render\software\SDL_blendpoint.c" />
   5.118 +    <ClCompile Include="..\..\src\render\software\SDL_drawline.c" />
   5.119 +    <ClCompile Include="..\..\src\render\software\SDL_drawpoint.c" />
   5.120 +    <ClCompile Include="..\..\src\render\software\SDL_render_sw.c" />
   5.121 +    <ClCompile Include="..\..\src\render\software\SDL_rotate.c" />
   5.122 +    <ClCompile Include="..\..\src\SDL.c" />
   5.123 +    <ClCompile Include="..\..\src\SDL_assert.c" />
   5.124 +    <ClCompile Include="..\..\src\SDL_error.c" />
   5.125 +    <ClCompile Include="..\..\src\SDL_hints.c" />
   5.126 +    <ClCompile Include="..\..\src\SDL_log.c" />
   5.127 +    <ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
   5.128 +    <ClCompile Include="..\..\src\stdlib\SDL_iconv.c" />
   5.129 +    <ClCompile Include="..\..\src\stdlib\SDL_malloc.c" />
   5.130 +    <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
   5.131 +    <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
   5.132 +    <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
   5.133 +    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c" />
   5.134 +    <ClCompile Include="..\..\src\thread\SDL_thread.c" />
   5.135 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp" />
   5.136 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp" />
   5.137 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp" />
   5.138 +    <ClCompile Include="..\..\src\timer\SDL_timer.c" />
   5.139 +    <ClCompile Include="..\..\src\timer\windows\SDL_systimer.c" />
   5.140 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c" />
   5.141 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullframebuffer.c" />
   5.142 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullvideo.c" />
   5.143 +    <ClCompile Include="..\..\src\video\SDL_blit.c" />
   5.144 +    <ClCompile Include="..\..\src\video\SDL_blit_0.c" />
   5.145 +    <ClCompile Include="..\..\src\video\SDL_blit_1.c" />
   5.146 +    <ClCompile Include="..\..\src\video\SDL_blit_A.c" />
   5.147 +    <ClCompile Include="..\..\src\video\SDL_blit_auto.c" />
   5.148 +    <ClCompile Include="..\..\src\video\SDL_blit_copy.c" />
   5.149 +    <ClCompile Include="..\..\src\video\SDL_blit_N.c" />
   5.150 +    <ClCompile Include="..\..\src\video\SDL_blit_slow.c" />
   5.151 +    <ClCompile Include="..\..\src\video\SDL_bmp.c" />
   5.152 +    <ClCompile Include="..\..\src\video\SDL_clipboard.c" />
   5.153 +    <ClCompile Include="..\..\src\video\SDL_egl.c" />
   5.154 +    <ClCompile Include="..\..\src\video\SDL_fillrect.c" />
   5.155 +    <ClCompile Include="..\..\src\video\SDL_pixels.c" />
   5.156 +    <ClCompile Include="..\..\src\video\SDL_rect.c" />
   5.157 +    <ClCompile Include="..\..\src\video\SDL_RLEaccel.c" />
   5.158 +    <ClCompile Include="..\..\src\video\SDL_shape.c" />
   5.159 +    <ClCompile Include="..\..\src\video\SDL_stretch.c" />
   5.160 +    <ClCompile Include="..\..\src\video\SDL_surface.c" />
   5.161 +    <ClCompile Include="..\..\src\video\SDL_video.c" />
   5.162 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
   5.163 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   5.164 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   5.165 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   5.166 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   5.167 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   5.168 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   5.169 +    </ClCompile>
   5.170 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtkeyboard.cpp">
   5.171 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   5.172 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   5.173 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   5.174 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   5.175 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   5.176 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   5.177 +    </ClCompile>
   5.178 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtmouse.cpp">
   5.179 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   5.180 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   5.181 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   5.182 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   5.183 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   5.184 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   5.185 +    </ClCompile>
   5.186 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtopengles.cpp">
   5.187 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   5.188 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   5.189 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   5.190 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   5.191 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   5.192 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   5.193 +    </ClCompile>
   5.194 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
   5.195 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   5.196 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   5.197 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   5.198 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   5.199 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   5.200 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   5.201 +    </ClCompile>
   5.202 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtvideo.cpp">
   5.203 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   5.204 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   5.205 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   5.206 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
   5.207 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   5.208 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   5.209 +    </ClCompile>
   5.210 +  </ItemGroup>
   5.211 +  <ItemGroup>
   5.212 +    <ClInclude Include="..\..\include\begin_code.h" />
   5.213 +    <ClInclude Include="..\..\include\close_code.h" />
   5.214 +    <ClInclude Include="..\..\include\SDL.h" />
   5.215 +    <ClInclude Include="..\..\include\SDL_assert.h" />
   5.216 +    <ClInclude Include="..\..\include\SDL_atomic.h" />
   5.217 +    <ClInclude Include="..\..\include\SDL_audio.h" />
   5.218 +    <ClInclude Include="..\..\include\SDL_blendmode.h" />
   5.219 +    <ClInclude Include="..\..\include\SDL_clipboard.h" />
   5.220 +    <ClInclude Include="..\..\include\SDL_config.h" />
   5.221 +    <ClInclude Include="..\..\include\SDL_config_minimal.h" />
   5.222 +    <ClInclude Include="..\..\include\SDL_config_winrt.h" />
   5.223 +    <ClInclude Include="..\..\include\SDL_copying.h" />
   5.224 +    <ClInclude Include="..\..\include\SDL_cpuinfo.h" />
   5.225 +    <ClInclude Include="..\..\include\SDL_egl.h" />
   5.226 +    <ClInclude Include="..\..\include\SDL_endian.h" />
   5.227 +    <ClInclude Include="..\..\include\SDL_error.h" />
   5.228 +    <ClInclude Include="..\..\include\SDL_events.h" />
   5.229 +    <ClInclude Include="..\..\include\SDL_filesystem.h" />
   5.230 +    <ClInclude Include="..\..\include\SDL_haptic.h" />
   5.231 +    <ClInclude Include="..\..\include\SDL_hints.h" />
   5.232 +    <ClInclude Include="..\..\include\SDL_input.h" />
   5.233 +    <ClInclude Include="..\..\include\SDL_joystick.h" />
   5.234 +    <ClInclude Include="..\..\include\SDL_keyboard.h" />
   5.235 +    <ClInclude Include="..\..\include\SDL_keycode.h" />
   5.236 +    <ClInclude Include="..\..\include\SDL_loadso.h" />
   5.237 +    <ClInclude Include="..\..\include\SDL_log.h" />
   5.238 +    <ClInclude Include="..\..\include\SDL_main.h" />
   5.239 +    <ClInclude Include="..\..\include\SDL_mouse.h" />
   5.240 +    <ClInclude Include="..\..\include\SDL_mutex.h" />
   5.241 +    <ClInclude Include="..\..\include\SDL_name.h" />
   5.242 +    <ClInclude Include="..\..\include\SDL_opengles2.h" />
   5.243 +    <ClInclude Include="..\..\include\SDL_pixels.h" />
   5.244 +    <ClInclude Include="..\..\include\SDL_platform.h" />
   5.245 +    <ClInclude Include="..\..\include\SDL_power.h" />
   5.246 +    <ClInclude Include="..\..\include\SDL_quit.h" />
   5.247 +    <ClInclude Include="..\..\include\SDL_rect.h" />
   5.248 +    <ClInclude Include="..\..\include\SDL_render.h" />
   5.249 +    <ClInclude Include="..\..\include\SDL_revision.h" />
   5.250 +    <ClInclude Include="..\..\include\SDL_rwops.h" />
   5.251 +    <ClInclude Include="..\..\include\SDL_scancode.h" />
   5.252 +    <ClInclude Include="..\..\include\SDL_shape.h" />
   5.253 +    <ClInclude Include="..\..\include\SDL_stdinc.h" />
   5.254 +    <ClInclude Include="..\..\include\SDL_surface.h" />
   5.255 +    <ClInclude Include="..\..\include\SDL_system.h" />
   5.256 +    <ClInclude Include="..\..\include\SDL_syswm.h" />
   5.257 +    <ClInclude Include="..\..\include\SDL_thread.h" />
   5.258 +    <ClInclude Include="..\..\include\SDL_timer.h" />
   5.259 +    <ClInclude Include="..\..\include\SDL_touch.h" />
   5.260 +    <ClInclude Include="..\..\include\SDL_types.h" />
   5.261 +    <ClInclude Include="..\..\include\SDL_version.h" />
   5.262 +    <ClInclude Include="..\..\include\SDL_video.h" />
   5.263 +    <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h" />
   5.264 +    <ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h" />
   5.265 +    <ClInclude Include="..\..\src\audio\SDL_audiodev_c.h" />
   5.266 +    <ClInclude Include="..\..\src\audio\SDL_audiomem.h" />
   5.267 +    <ClInclude Include="..\..\src\audio\SDL_audio_c.h" />
   5.268 +    <ClInclude Include="..\..\src\audio\SDL_sysaudio.h" />
   5.269 +    <ClInclude Include="..\..\src\audio\SDL_wave.h" />
   5.270 +    <ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.h" />
   5.271 +    <ClInclude Include="..\..\src\core\windows\SDL_windows.h" />
   5.272 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_common.h" />
   5.273 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.h" />
   5.274 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_xaml.h" />
   5.275 +    <ClInclude Include="..\..\src\events\blank_cursor.h" />
   5.276 +    <ClInclude Include="..\..\src\events\default_cursor.h" />
   5.277 +    <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h" />
   5.278 +    <ClInclude Include="..\..\src\events\SDL_dropevents_c.h" />
   5.279 +    <ClInclude Include="..\..\src\events\SDL_events_c.h" />
   5.280 +    <ClInclude Include="..\..\src\events\SDL_keyboard_c.h" />
   5.281 +    <ClInclude Include="..\..\src\events\SDL_mouse_c.h" />
   5.282 +    <ClInclude Include="..\..\src\events\SDL_sysevents.h" />
   5.283 +    <ClInclude Include="..\..\src\events\SDL_touch_c.h" />
   5.284 +    <ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
   5.285 +    <ClInclude Include="..\..\src\haptic\SDL_haptic_c.h" />
   5.286 +    <ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
   5.287 +    <ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h" />
   5.288 +    <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
   5.289 +    <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
   5.290 +    <ClInclude Include="..\..\src\render\mmx.h" />
   5.291 +    <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
   5.292 +    <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
   5.293 +    <ClInclude Include="..\..\src\render\SDL_sysrender.h" />
   5.294 +    <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h" />
   5.295 +    <ClInclude Include="..\..\src\render\software\SDL_blendfillrect.h" />
   5.296 +    <ClInclude Include="..\..\src\render\software\SDL_blendline.h" />
   5.297 +    <ClInclude Include="..\..\src\render\software\SDL_blendpoint.h" />
   5.298 +    <ClInclude Include="..\..\src\render\software\SDL_draw.h" />
   5.299 +    <ClInclude Include="..\..\src\render\software\SDL_drawline.h" />
   5.300 +    <ClInclude Include="..\..\src\render\software\SDL_drawpoint.h" />
   5.301 +    <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
   5.302 +    <ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
   5.303 +    <ClInclude Include="..\..\src\SDL_assert_c.h" />
   5.304 +    <ClInclude Include="..\..\src\SDL_error_c.h" />
   5.305 +    <ClInclude Include="..\..\src\SDL_fatal.h" />
   5.306 +    <ClInclude Include="..\..\src\SDL_hints_c.h" />
   5.307 +    <ClInclude Include="..\..\src\thread\SDL_systhread.h" />
   5.308 +    <ClInclude Include="..\..\src\thread\SDL_thread_c.h" />
   5.309 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h" />
   5.310 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h" />
   5.311 +    <ClInclude Include="..\..\src\timer\SDL_timer_c.h" />
   5.312 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h" />
   5.313 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullframebuffer_c.h" />
   5.314 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullvideo.h" />
   5.315 +    <ClInclude Include="..\..\src\video\SDL_blit.h" />
   5.316 +    <ClInclude Include="..\..\src\video\SDL_blit_auto.h" />
   5.317 +    <ClInclude Include="..\..\src\video\SDL_blit_copy.h" />
   5.318 +    <ClInclude Include="..\..\src\video\SDL_blit_slow.h" />
   5.319 +    <ClInclude Include="..\..\src\video\SDL_egl.h" />
   5.320 +    <ClInclude Include="..\..\src\video\SDL_pixels_c.h" />
   5.321 +    <ClInclude Include="..\..\src\video\SDL_rect_c.h" />
   5.322 +    <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
   5.323 +    <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
   5.324 +    <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
   5.325 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
   5.326 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
   5.327 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
   5.328 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
   5.329 +  </ItemGroup>
   5.330 +  <PropertyGroup Label="Globals">
   5.331 +    <ProjectGuid>{aeaea3a2-d4e6-45b1-8ec6-53d84287fc14}</ProjectGuid>
   5.332 +    <Keyword>Win32Proj</Keyword>
   5.333 +    <ProjectName>SDL-WinRT</ProjectName>
   5.334 +    <RootNamespace>SDL_VS2012_WinRT</RootNamespace>
   5.335 +    <DefaultLanguage>en-US</DefaultLanguage>
   5.336 +    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
   5.337 +    <AppContainerApplication>true</AppContainerApplication>
   5.338 +  </PropertyGroup>
   5.339 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   5.340 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
   5.341 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
   5.342 +    <UseDebugLibraries>true</UseDebugLibraries>
   5.343 +    <PlatformToolset>v110</PlatformToolset>
   5.344 +  </PropertyGroup>
   5.345 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
   5.346 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
   5.347 +    <UseDebugLibraries>true</UseDebugLibraries>
   5.348 +    <PlatformToolset>v110</PlatformToolset>
   5.349 +  </PropertyGroup>
   5.350 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
   5.351 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
   5.352 +    <UseDebugLibraries>true</UseDebugLibraries>
   5.353 +    <PlatformToolset>v110</PlatformToolset>
   5.354 +  </PropertyGroup>
   5.355 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
   5.356 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
   5.357 +    <UseDebugLibraries>false</UseDebugLibraries>
   5.358 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   5.359 +    <PlatformToolset>v110</PlatformToolset>
   5.360 +  </PropertyGroup>
   5.361 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
   5.362 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
   5.363 +    <UseDebugLibraries>false</UseDebugLibraries>
   5.364 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   5.365 +    <PlatformToolset>v110</PlatformToolset>
   5.366 +  </PropertyGroup>
   5.367 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
   5.368 +    <ConfigurationType>DynamicLibrary</ConfigurationType>
   5.369 +    <UseDebugLibraries>false</UseDebugLibraries>
   5.370 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   5.371 +    <PlatformToolset>v110</PlatformToolset>
   5.372 +  </PropertyGroup>
   5.373 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   5.374 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   5.375 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   5.376 +  </ImportGroup>
   5.377 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   5.378 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   5.379 +  </ImportGroup>
   5.380 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
   5.381 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   5.382 +  </ImportGroup>
   5.383 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
   5.384 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   5.385 +  </ImportGroup>
   5.386 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
   5.387 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   5.388 +  </ImportGroup>
   5.389 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   5.390 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   5.391 +  </ImportGroup>
   5.392 +  <PropertyGroup Label="UserMacros" />
   5.393 +  <PropertyGroup />
   5.394 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   5.395 +    <GenerateManifest>false</GenerateManifest>
   5.396 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
   5.397 +    <TargetName>SDL</TargetName>
   5.398 +  </PropertyGroup>
   5.399 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   5.400 +    <GenerateManifest>false</GenerateManifest>
   5.401 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
   5.402 +    <TargetName>SDL</TargetName>
   5.403 +  </PropertyGroup>
   5.404 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
   5.405 +    <GenerateManifest>false</GenerateManifest>
   5.406 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
   5.407 +    <TargetName>SDL</TargetName>
   5.408 +  </PropertyGroup>
   5.409 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
   5.410 +    <GenerateManifest>false</GenerateManifest>
   5.411 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
   5.412 +    <TargetName>SDL</TargetName>
   5.413 +  </PropertyGroup>
   5.414 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
   5.415 +    <GenerateManifest>false</GenerateManifest>
   5.416 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
   5.417 +    <TargetName>SDL</TargetName>
   5.418 +  </PropertyGroup>
   5.419 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   5.420 +    <GenerateManifest>false</GenerateManifest>
   5.421 +    <IgnoreImportLibrary>false</IgnoreImportLibrary>
   5.422 +    <TargetName>SDL</TargetName>
   5.423 +  </PropertyGroup>
   5.424 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   5.425 +    <ClCompile>
   5.426 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   5.427 +      <CompileAsWinRT>false</CompileAsWinRT>
   5.428 +      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   5.429 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   5.430 +    </ClCompile>
   5.431 +    <Link>
   5.432 +      <SubSystem>Console</SubSystem>
   5.433 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   5.434 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   5.435 +      <AdditionalDependencies>xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
   5.436 +    </Link>
   5.437 +  </ItemDefinitionGroup>
   5.438 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   5.439 +    <ClCompile>
   5.440 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   5.441 +      <CompileAsWinRT>false</CompileAsWinRT>
   5.442 +      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   5.443 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   5.444 +    </ClCompile>
   5.445 +    <Link>
   5.446 +      <SubSystem>Console</SubSystem>
   5.447 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   5.448 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   5.449 +      <AdditionalDependencies>xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
   5.450 +    </Link>
   5.451 +  </ItemDefinitionGroup>
   5.452 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm'">
   5.453 +    <ClCompile>
   5.454 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   5.455 +      <CompileAsWinRT>false</CompileAsWinRT>
   5.456 +      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   5.457 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   5.458 +    </ClCompile>
   5.459 +    <Link>
   5.460 +      <SubSystem>Console</SubSystem>
   5.461 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   5.462 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   5.463 +      <AdditionalDependencies>xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
   5.464 +    </Link>
   5.465 +  </ItemDefinitionGroup>
   5.466 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm'">
   5.467 +    <ClCompile>
   5.468 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   5.469 +      <CompileAsWinRT>false</CompileAsWinRT>
   5.470 +      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   5.471 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   5.472 +    </ClCompile>
   5.473 +    <Link>
   5.474 +      <SubSystem>Console</SubSystem>
   5.475 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   5.476 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   5.477 +      <AdditionalDependencies>xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
   5.478 +    </Link>
   5.479 +  </ItemDefinitionGroup>
   5.480 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
   5.481 +    <ClCompile>
   5.482 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   5.483 +      <CompileAsWinRT>false</CompileAsWinRT>
   5.484 +      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   5.485 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   5.486 +    </ClCompile>
   5.487 +    <Link>
   5.488 +      <SubSystem>Console</SubSystem>
   5.489 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   5.490 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   5.491 +      <AdditionalDependencies>xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
   5.492 +    </Link>
   5.493 +  </ItemDefinitionGroup>
   5.494 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   5.495 +    <ClCompile>
   5.496 +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
   5.497 +      <CompileAsWinRT>false</CompileAsWinRT>
   5.498 +      <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   5.499 +      <PreprocessorDefinitions>_WINDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   5.500 +    </ClCompile>
   5.501 +    <Link>
   5.502 +      <SubSystem>Console</SubSystem>
   5.503 +      <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
   5.504 +      <GenerateWindowsMetadata>false</GenerateWindowsMetadata>
   5.505 +      <AdditionalDependencies>xinput.lib;xaudio2.lib;d2d1.lib;d3d11.lib;dxgi.lib;ole32.lib;windowscodecs.lib;dwrite.lib;kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
   5.506 +    </Link>
   5.507 +  </ItemDefinitionGroup>
   5.508 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   5.509 +  <ImportGroup Label="ExtensionTargets">
   5.510 +  </ImportGroup>
   5.511 +</Project>
   5.512 \ No newline at end of file
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/VisualC-WinRT/SDL/SDL-WinRT_VS2012.vcxproj.filters	Sun Mar 09 11:36:47 2014 -0700
     6.3 @@ -0,0 +1,645 @@
     6.4 +<?xml version="1.0" encoding="utf-8"?>
     6.5 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     6.6 +  <ItemGroup>
     6.7 +    <ClCompile Include="..\..\src\SDL.c">
     6.8 +      <Filter>Source Files</Filter>
     6.9 +    </ClCompile>
    6.10 +    <ClCompile Include="..\..\src\SDL_assert.c">
    6.11 +      <Filter>Source Files</Filter>
    6.12 +    </ClCompile>
    6.13 +    <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
    6.14 +      <Filter>Source Files</Filter>
    6.15 +    </ClCompile>
    6.16 +    <ClCompile Include="..\..\src\audio\SDL_audio.c">
    6.17 +      <Filter>Source Files</Filter>
    6.18 +    </ClCompile>
    6.19 +    <ClCompile Include="..\..\src\audio\SDL_audiocvt.c">
    6.20 +      <Filter>Source Files</Filter>
    6.21 +    </ClCompile>
    6.22 +    <ClCompile Include="..\..\src\audio\SDL_audiodev.c">
    6.23 +      <Filter>Source Files</Filter>
    6.24 +    </ClCompile>
    6.25 +    <ClCompile Include="..\..\src\audio\SDL_audiotypecvt.c">
    6.26 +      <Filter>Source Files</Filter>
    6.27 +    </ClCompile>
    6.28 +    <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c">
    6.29 +      <Filter>Source Files</Filter>
    6.30 +    </ClCompile>
    6.31 +    <ClCompile Include="..\..\src\render\software\SDL_blendline.c">
    6.32 +      <Filter>Source Files</Filter>
    6.33 +    </ClCompile>
    6.34 +    <ClCompile Include="..\..\src\render\software\SDL_blendpoint.c">
    6.35 +      <Filter>Source Files</Filter>
    6.36 +    </ClCompile>
    6.37 +    <ClCompile Include="..\..\src\video\SDL_blit.c">
    6.38 +      <Filter>Source Files</Filter>
    6.39 +    </ClCompile>
    6.40 +    <ClCompile Include="..\..\src\video\SDL_blit_0.c">
    6.41 +      <Filter>Source Files</Filter>
    6.42 +    </ClCompile>
    6.43 +    <ClCompile Include="..\..\src\video\SDL_blit_1.c">
    6.44 +      <Filter>Source Files</Filter>
    6.45 +    </ClCompile>
    6.46 +    <ClCompile Include="..\..\src\video\SDL_blit_A.c">
    6.47 +      <Filter>Source Files</Filter>
    6.48 +    </ClCompile>
    6.49 +    <ClCompile Include="..\..\src\video\SDL_blit_auto.c">
    6.50 +      <Filter>Source Files</Filter>
    6.51 +    </ClCompile>
    6.52 +    <ClCompile Include="..\..\src\video\SDL_blit_copy.c">
    6.53 +      <Filter>Source Files</Filter>
    6.54 +    </ClCompile>
    6.55 +    <ClCompile Include="..\..\src\video\SDL_blit_N.c">
    6.56 +      <Filter>Source Files</Filter>
    6.57 +    </ClCompile>
    6.58 +    <ClCompile Include="..\..\src\video\SDL_blit_slow.c">
    6.59 +      <Filter>Source Files</Filter>
    6.60 +    </ClCompile>
    6.61 +    <ClCompile Include="..\..\src\video\SDL_bmp.c">
    6.62 +      <Filter>Source Files</Filter>
    6.63 +    </ClCompile>
    6.64 +    <ClCompile Include="..\..\src\video\SDL_clipboard.c">
    6.65 +      <Filter>Source Files</Filter>
    6.66 +    </ClCompile>
    6.67 +    <ClCompile Include="..\..\src\events\SDL_clipboardevents.c">
    6.68 +      <Filter>Source Files</Filter>
    6.69 +    </ClCompile>
    6.70 +    <ClCompile Include="..\..\src\audio\disk\SDL_diskaudio.c">
    6.71 +      <Filter>Source Files</Filter>
    6.72 +    </ClCompile>
    6.73 +    <ClCompile Include="..\..\src\render\software\SDL_drawline.c">
    6.74 +      <Filter>Source Files</Filter>
    6.75 +    </ClCompile>
    6.76 +    <ClCompile Include="..\..\src\render\software\SDL_drawpoint.c">
    6.77 +      <Filter>Source Files</Filter>
    6.78 +    </ClCompile>
    6.79 +    <ClCompile Include="..\..\src\events\SDL_dropevents.c">
    6.80 +      <Filter>Source Files</Filter>
    6.81 +    </ClCompile>
    6.82 +    <ClCompile Include="..\..\src\audio\dummy\SDL_dummyaudio.c">
    6.83 +      <Filter>Source Files</Filter>
    6.84 +    </ClCompile>
    6.85 +    <ClCompile Include="..\..\src\SDL_error.c">
    6.86 +      <Filter>Source Files</Filter>
    6.87 +    </ClCompile>
    6.88 +    <ClCompile Include="..\..\src\events\SDL_events.c">
    6.89 +      <Filter>Source Files</Filter>
    6.90 +    </ClCompile>
    6.91 +    <ClCompile Include="..\..\src\video\SDL_fillrect.c">
    6.92 +      <Filter>Source Files</Filter>
    6.93 +    </ClCompile>
    6.94 +    <ClCompile Include="..\..\src\events\SDL_gesture.c">
    6.95 +      <Filter>Source Files</Filter>
    6.96 +    </ClCompile>
    6.97 +    <ClCompile Include="..\..\src\stdlib\SDL_getenv.c">
    6.98 +      <Filter>Source Files</Filter>
    6.99 +    </ClCompile>
   6.100 +    <ClCompile Include="..\..\src\haptic\SDL_haptic.c">
   6.101 +      <Filter>Source Files</Filter>
   6.102 +    </ClCompile>
   6.103 +    <ClCompile Include="..\..\src\SDL_hints.c">
   6.104 +      <Filter>Source Files</Filter>
   6.105 +    </ClCompile>
   6.106 +    <ClCompile Include="..\..\src\stdlib\SDL_iconv.c">
   6.107 +      <Filter>Source Files</Filter>
   6.108 +    </ClCompile>
   6.109 +    <ClCompile Include="..\..\src\joystick\SDL_joystick.c">
   6.110 +      <Filter>Source Files</Filter>
   6.111 +    </ClCompile>
   6.112 +    <ClCompile Include="..\..\src\events\SDL_keyboard.c">
   6.113 +      <Filter>Source Files</Filter>
   6.114 +    </ClCompile>
   6.115 +    <ClCompile Include="..\..\src\SDL_log.c">
   6.116 +      <Filter>Source Files</Filter>
   6.117 +    </ClCompile>
   6.118 +    <ClCompile Include="..\..\src\audio\SDL_mixer.c">
   6.119 +      <Filter>Source Files</Filter>
   6.120 +    </ClCompile>
   6.121 +    <ClCompile Include="..\..\src\events\SDL_mouse.c">
   6.122 +      <Filter>Source Files</Filter>
   6.123 +    </ClCompile>
   6.124 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullevents.c">
   6.125 +      <Filter>Source Files</Filter>
   6.126 +    </ClCompile>
   6.127 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullframebuffer.c">
   6.128 +      <Filter>Source Files</Filter>
   6.129 +    </ClCompile>
   6.130 +    <ClCompile Include="..\..\src\video\dummy\SDL_nullvideo.c">
   6.131 +      <Filter>Source Files</Filter>
   6.132 +    </ClCompile>
   6.133 +    <ClCompile Include="..\..\src\video\SDL_pixels.c">
   6.134 +      <Filter>Source Files</Filter>
   6.135 +    </ClCompile>
   6.136 +    <ClCompile Include="..\..\src\stdlib\SDL_qsort.c">
   6.137 +      <Filter>Source Files</Filter>
   6.138 +    </ClCompile>
   6.139 +    <ClCompile Include="..\..\src\events\SDL_quit.c">
   6.140 +      <Filter>Source Files</Filter>
   6.141 +    </ClCompile>
   6.142 +    <ClCompile Include="..\..\src\video\SDL_rect.c">
   6.143 +      <Filter>Source Files</Filter>
   6.144 +    </ClCompile>
   6.145 +    <ClCompile Include="..\..\src\render\SDL_render.c">
   6.146 +      <Filter>Source Files</Filter>
   6.147 +    </ClCompile>
   6.148 +    <ClCompile Include="..\..\src\render\software\SDL_render_sw.c">
   6.149 +      <Filter>Source Files</Filter>
   6.150 +    </ClCompile>
   6.151 +    <ClCompile Include="..\..\src\video\SDL_RLEaccel.c">
   6.152 +      <Filter>Source Files</Filter>
   6.153 +    </ClCompile>
   6.154 +    <ClCompile Include="..\..\src\render\software\SDL_rotate.c">
   6.155 +      <Filter>Source Files</Filter>
   6.156 +    </ClCompile>
   6.157 +    <ClCompile Include="..\..\src\file\SDL_rwops.c">
   6.158 +      <Filter>Source Files</Filter>
   6.159 +    </ClCompile>
   6.160 +    <ClCompile Include="..\..\src\video\SDL_shape.c">
   6.161 +      <Filter>Source Files</Filter>
   6.162 +    </ClCompile>
   6.163 +    <ClCompile Include="..\..\src\atomic\SDL_spinlock.c">
   6.164 +      <Filter>Source Files</Filter>
   6.165 +    </ClCompile>
   6.166 +    <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c">
   6.167 +      <Filter>Source Files</Filter>
   6.168 +    </ClCompile>
   6.169 +    <ClCompile Include="..\..\src\video\SDL_stretch.c">
   6.170 +      <Filter>Source Files</Filter>
   6.171 +    </ClCompile>
   6.172 +    <ClCompile Include="..\..\src\stdlib\SDL_string.c">
   6.173 +      <Filter>Source Files</Filter>
   6.174 +    </ClCompile>
   6.175 +    <ClCompile Include="..\..\src\video\SDL_surface.c">
   6.176 +      <Filter>Source Files</Filter>
   6.177 +    </ClCompile>
   6.178 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp">
   6.179 +      <Filter>Source Files</Filter>
   6.180 +    </ClCompile>
   6.181 +    <ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c">
   6.182 +      <Filter>Source Files</Filter>
   6.183 +    </ClCompile>
   6.184 +    <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c">
   6.185 +      <Filter>Source Files</Filter>
   6.186 +    </ClCompile>
   6.187 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_sysmutex.cpp">
   6.188 +      <Filter>Source Files</Filter>
   6.189 +    </ClCompile>
   6.190 +    <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c">
   6.191 +      <Filter>Source Files</Filter>
   6.192 +    </ClCompile>
   6.193 +    <ClCompile Include="..\..\src\thread\stdcpp\SDL_systhread.cpp">
   6.194 +      <Filter>Source Files</Filter>
   6.195 +    </ClCompile>
   6.196 +    <ClCompile Include="..\..\src\timer\windows\SDL_systimer.c">
   6.197 +      <Filter>Source Files</Filter>
   6.198 +    </ClCompile>
   6.199 +    <ClCompile Include="..\..\src\thread\SDL_thread.c">
   6.200 +      <Filter>Source Files</Filter>
   6.201 +    </ClCompile>
   6.202 +    <ClCompile Include="..\..\src\timer\SDL_timer.c">
   6.203 +      <Filter>Source Files</Filter>
   6.204 +    </ClCompile>
   6.205 +    <ClCompile Include="..\..\src\events\SDL_touch.c">
   6.206 +      <Filter>Source Files</Filter>
   6.207 +    </ClCompile>
   6.208 +    <ClCompile Include="..\..\src\video\SDL_video.c">
   6.209 +      <Filter>Source Files</Filter>
   6.210 +    </ClCompile>
   6.211 +    <ClCompile Include="..\..\src\audio\SDL_wave.c">
   6.212 +      <Filter>Source Files</Filter>
   6.213 +    </ClCompile>
   6.214 +    <ClCompile Include="..\..\src\events\SDL_windowevents.c">
   6.215 +      <Filter>Source Files</Filter>
   6.216 +    </ClCompile>
   6.217 +    <ClCompile Include="..\..\src\core\windows\SDL_windows.c">
   6.218 +      <Filter>Source Files</Filter>
   6.219 +    </ClCompile>
   6.220 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2.c">
   6.221 +      <Filter>Source Files</Filter>
   6.222 +    </ClCompile>
   6.223 +    <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.cpp">
   6.224 +      <Filter>Source Files</Filter>
   6.225 +    </ClCompile>
   6.226 +    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
   6.227 +      <Filter>Source Files</Filter>
   6.228 +    </ClCompile>
   6.229 +    <ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
   6.230 +      <Filter>Source Files</Filter>
   6.231 +    </ClCompile>
   6.232 +    <ClCompile Include="..\..\src\cpuinfo\SDL_cpuinfo.c">
   6.233 +      <Filter>Source Files</Filter>
   6.234 +    </ClCompile>
   6.235 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.cpp">
   6.236 +      <Filter>Source Files</Filter>
   6.237 +    </ClCompile>
   6.238 +    <ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c">
   6.239 +      <Filter>Source Files</Filter>
   6.240 +    </ClCompile>
   6.241 +    <ClCompile Include="..\..\src\stdlib\SDL_malloc.c">
   6.242 +      <Filter>Source Files</Filter>
   6.243 +    </ClCompile>
   6.244 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
   6.245 +      <Filter>Source Files</Filter>
   6.246 +    </ClCompile>
   6.247 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtmouse.cpp">
   6.248 +      <Filter>Source Files</Filter>
   6.249 +    </ClCompile>
   6.250 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtvideo.cpp">
   6.251 +      <Filter>Source Files</Filter>
   6.252 +    </ClCompile>
   6.253 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtkeyboard.cpp">
   6.254 +      <Filter>Source Files</Filter>
   6.255 +    </ClCompile>
   6.256 +    <ClCompile Include="..\..\src\joystick\winrt\SDL_xinputjoystick.c">
   6.257 +      <Filter>Source Files</Filter>
   6.258 +    </ClCompile>
   6.259 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtpointerinput.cpp">
   6.260 +      <Filter>Source Files</Filter>
   6.261 +    </ClCompile>
   6.262 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.cpp">
   6.263 +      <Filter>Source Files</Filter>
   6.264 +    </ClCompile>
   6.265 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_xaml.cpp">
   6.266 +      <Filter>Source Files</Filter>
   6.267 +    </ClCompile>
   6.268 +    <ClCompile Include="..\..\src\core\winrt\SDL_winrtapp_common.cpp">
   6.269 +      <Filter>Source Files</Filter>
   6.270 +    </ClCompile>
   6.271 +    <ClCompile Include="..\..\src\filesystem\winrt\SDL_sysfilesystem.cpp">
   6.272 +      <Filter>Source Files</Filter>
   6.273 +    </ClCompile>
   6.274 +    <ClCompile Include="..\..\src\video\SDL_egl.c">
   6.275 +      <Filter>Source Files</Filter>
   6.276 +    </ClCompile>
   6.277 +    <ClCompile Include="..\..\src\video\winrt\SDL_winrtopengles.cpp">
   6.278 +      <Filter>Source Files</Filter>
   6.279 +    </ClCompile>
   6.280 +    <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c">
   6.281 +      <Filter>Source Files</Filter>
   6.282 +    </ClCompile>
   6.283 +    <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c">
   6.284 +      <Filter>Source Files</Filter>
   6.285 +    </ClCompile>
   6.286 +  </ItemGroup>
   6.287 +  <ItemGroup>
   6.288 +    <ClInclude Include="..\..\include\begin_code.h">
   6.289 +      <Filter>Header Files</Filter>
   6.290 +    </ClInclude>
   6.291 +    <ClInclude Include="..\..\include\close_code.h">
   6.292 +      <Filter>Header Files</Filter>
   6.293 +    </ClInclude>
   6.294 +    <ClInclude Include="..\..\include\SDL_assert.h">
   6.295 +      <Filter>Header Files</Filter>
   6.296 +    </ClInclude>
   6.297 +    <ClInclude Include="..\..\include\SDL.h">
   6.298 +      <Filter>Header Files</Filter>
   6.299 +    </ClInclude>
   6.300 +    <ClInclude Include="..\..\src\SDL_error_c.h">
   6.301 +      <Filter>Source Files</Filter>
   6.302 +    </ClInclude>
   6.303 +    <ClInclude Include="..\..\src\events\SDL_events_c.h">
   6.304 +      <Filter>Source Files</Filter>
   6.305 +    </ClInclude>
   6.306 +    <ClInclude Include="..\..\src\haptic\SDL_haptic_c.h">
   6.307 +      <Filter>Source Files</Filter>
   6.308 +    </ClInclude>
   6.309 +    <ClInclude Include="..\..\src\SDL_hints_c.h">
   6.310 +      <Filter>Source Files</Filter>
   6.311 +    </ClInclude>
   6.312 +    <ClInclude Include="..\..\src\events\SDL_mouse_c.h">
   6.313 +      <Filter>Source Files</Filter>
   6.314 +    </ClInclude>
   6.315 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_sysmutex_c.h">
   6.316 +      <Filter>Source Files</Filter>
   6.317 +    </ClInclude>
   6.318 +    <ClInclude Include="..\..\include\SDL_types.h">
   6.319 +      <Filter>Header Files</Filter>
   6.320 +    </ClInclude>
   6.321 +    <ClInclude Include="..\..\src\SDL_assert_c.h">
   6.322 +      <Filter>Source Files</Filter>
   6.323 +    </ClInclude>
   6.324 +    <ClInclude Include="..\..\src\audio\SDL_audio_c.h">
   6.325 +      <Filter>Source Files</Filter>
   6.326 +    </ClInclude>
   6.327 +    <ClInclude Include="..\..\src\audio\SDL_audiodev_c.h">
   6.328 +      <Filter>Source Files</Filter>
   6.329 +    </ClInclude>
   6.330 +    <ClInclude Include="..\..\src\events\SDL_clipboardevents_c.h">
   6.331 +      <Filter>Source Files</Filter>
   6.332 +    </ClInclude>
   6.333 +    <ClInclude Include="..\..\src\events\SDL_dropevents_c.h">
   6.334 +      <Filter>Source Files</Filter>
   6.335 +    </ClInclude>
   6.336 +    <ClInclude Include="..\..\src\joystick\SDL_joystick_c.h">
   6.337 +      <Filter>Source Files</Filter>
   6.338 +    </ClInclude>
   6.339 +    <ClInclude Include="..\..\src\events\SDL_keyboard_c.h">
   6.340 +      <Filter>Source Files</Filter>
   6.341 +    </ClInclude>
   6.342 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullevents_c.h">
   6.343 +      <Filter>Source Files</Filter>
   6.344 +    </ClInclude>
   6.345 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullframebuffer_c.h">
   6.346 +      <Filter>Source Files</Filter>
   6.347 +    </ClInclude>
   6.348 +    <ClInclude Include="..\..\src\video\SDL_pixels_c.h">
   6.349 +      <Filter>Source Files</Filter>
   6.350 +    </ClInclude>
   6.351 +    <ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h">
   6.352 +      <Filter>Source Files</Filter>
   6.353 +    </ClInclude>
   6.354 +    <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h">
   6.355 +      <Filter>Source Files</Filter>
   6.356 +    </ClInclude>
   6.357 +    <ClInclude Include="..\..\src\thread\stdcpp\SDL_systhread_c.h">
   6.358 +      <Filter>Source Files</Filter>
   6.359 +    </ClInclude>
   6.360 +    <ClInclude Include="..\..\src\thread\SDL_thread_c.h">
   6.361 +      <Filter>Source Files</Filter>
   6.362 +    </ClInclude>
   6.363 +    <ClInclude Include="..\..\src\timer\SDL_timer_c.h">
   6.364 +      <Filter>Source Files</Filter>
   6.365 +    </ClInclude>
   6.366 +    <ClInclude Include="..\..\src\events\SDL_touch_c.h">
   6.367 +      <Filter>Source Files</Filter>
   6.368 +    </ClInclude>
   6.369 +    <ClInclude Include="..\..\src\events\SDL_windowevents_c.h">
   6.370 +      <Filter>Source Files</Filter>
   6.371 +    </ClInclude>
   6.372 +    <ClInclude Include="..\..\src\render\SDL_yuv_sw_c.h">
   6.373 +      <Filter>Source Files</Filter>
   6.374 +    </ClInclude>
   6.375 +    <ClInclude Include="..\..\include\SDL_audio.h">
   6.376 +      <Filter>Header Files</Filter>
   6.377 +    </ClInclude>
   6.378 +    <ClInclude Include="..\..\include\SDL_atomic.h">
   6.379 +      <Filter>Header Files</Filter>
   6.380 +    </ClInclude>
   6.381 +    <ClInclude Include="..\..\include\SDL_blendmode.h">
   6.382 +      <Filter>Header Files</Filter>
   6.383 +    </ClInclude>
   6.384 +    <ClInclude Include="..\..\include\SDL_clipboard.h">
   6.385 +      <Filter>Header Files</Filter>
   6.386 +    </ClInclude>
   6.387 +    <ClInclude Include="..\..\src\audio\SDL_audiomem.h">
   6.388 +      <Filter>Source Files</Filter>
   6.389 +    </ClInclude>
   6.390 +    <ClInclude Include="..\..\src\render\software\SDL_blendfillrect.h">
   6.391 +      <Filter>Source Files</Filter>
   6.392 +    </ClInclude>
   6.393 +    <ClInclude Include="..\..\src\render\software\SDL_blendline.h">
   6.394 +      <Filter>Source Files</Filter>
   6.395 +    </ClInclude>
   6.396 +    <ClInclude Include="..\..\src\render\software\SDL_blendpoint.h">
   6.397 +      <Filter>Source Files</Filter>
   6.398 +    </ClInclude>
   6.399 +    <ClInclude Include="..\..\src\video\SDL_blit.h">
   6.400 +      <Filter>Source Files</Filter>
   6.401 +    </ClInclude>
   6.402 +    <ClInclude Include="..\..\src\video\SDL_blit_auto.h">
   6.403 +      <Filter>Source Files</Filter>
   6.404 +    </ClInclude>
   6.405 +    <ClInclude Include="..\..\src\video\SDL_blit_copy.h">
   6.406 +      <Filter>Source Files</Filter>
   6.407 +    </ClInclude>
   6.408 +    <ClInclude Include="..\..\src\video\SDL_blit_slow.h">
   6.409 +      <Filter>Source Files</Filter>
   6.410 +    </ClInclude>
   6.411 +    <ClInclude Include="..\..\src\render\mmx.h">
   6.412 +      <Filter>Source Files</Filter>
   6.413 +    </ClInclude>
   6.414 +    <ClInclude Include="..\..\include\SDL_config.h">
   6.415 +      <Filter>Header Files</Filter>
   6.416 +    </ClInclude>
   6.417 +    <ClInclude Include="..\..\include\SDL_config_minimal.h">
   6.418 +      <Filter>Header Files</Filter>
   6.419 +    </ClInclude>
   6.420 +    <ClInclude Include="..\..\include\SDL_copying.h">
   6.421 +      <Filter>Header Files</Filter>
   6.422 +    </ClInclude>
   6.423 +    <ClInclude Include="..\..\include\SDL_cpuinfo.h">
   6.424 +      <Filter>Header Files</Filter>
   6.425 +    </ClInclude>
   6.426 +    <ClInclude Include="..\..\src\audio\disk\SDL_diskaudio.h">
   6.427 +      <Filter>Source Files</Filter>
   6.428 +    </ClInclude>
   6.429 +    <ClInclude Include="..\..\src\render\software\SDL_draw.h">
   6.430 +      <Filter>Source Files</Filter>
   6.431 +    </ClInclude>
   6.432 +    <ClInclude Include="..\..\src\render\software\SDL_drawline.h">
   6.433 +      <Filter>Source Files</Filter>
   6.434 +    </ClInclude>
   6.435 +    <ClInclude Include="..\..\src\render\software\SDL_drawpoint.h">
   6.436 +      <Filter>Source Files</Filter>
   6.437 +    </ClInclude>
   6.438 +    <ClInclude Include="..\..\src\audio\dummy\SDL_dummyaudio.h">
   6.439 +      <Filter>Source Files</Filter>
   6.440 +    </ClInclude>
   6.441 +    <ClInclude Include="..\..\include\SDL_endian.h">
   6.442 +      <Filter>Header Files</Filter>
   6.443 +    </ClInclude>
   6.444 +    <ClInclude Include="..\..\include\SDL_error.h">
   6.445 +      <Filter>Header Files</Filter>
   6.446 +    </ClInclude>
   6.447 +    <ClInclude Include="..\..\include\SDL_events.h">
   6.448 +      <Filter>Header Files</Filter>
   6.449 +    </ClInclude>
   6.450 +    <ClInclude Include="..\..\src\SDL_fatal.h">
   6.451 +      <Filter>Source Files</Filter>
   6.452 +    </ClInclude>
   6.453 +    <ClInclude Include="..\..\include\SDL_main.h">
   6.454 +      <Filter>Header Files</Filter>
   6.455 +    </ClInclude>
   6.456 +    <ClInclude Include="..\..\include\SDL_haptic.h">
   6.457 +      <Filter>Header Files</Filter>
   6.458 +    </ClInclude>
   6.459 +    <ClInclude Include="..\..\include\SDL_hints.h">
   6.460 +      <Filter>Header Files</Filter>
   6.461 +    </ClInclude>
   6.462 +    <ClInclude Include="..\..\include\SDL_input.h">
   6.463 +      <Filter>Header Files</Filter>
   6.464 +    </ClInclude>
   6.465 +    <ClInclude Include="..\..\include\SDL_joystick.h">
   6.466 +      <Filter>Header Files</Filter>
   6.467 +    </ClInclude>
   6.468 +    <ClInclude Include="..\..\include\SDL_keyboard.h">
   6.469 +      <Filter>Header Files</Filter>
   6.470 +    </ClInclude>
   6.471 +    <ClInclude Include="..\..\include\SDL_keycode.h">
   6.472 +      <Filter>Header Files</Filter>
   6.473 +    </ClInclude>
   6.474 +    <ClInclude Include="..\..\include\SDL_loadso.h">
   6.475 +      <Filter>Header Files</Filter>
   6.476 +    </ClInclude>
   6.477 +    <ClInclude Include="..\..\include\SDL_log.h">
   6.478 +      <Filter>Header Files</Filter>
   6.479 +    </ClInclude>
   6.480 +    <ClInclude Include="..\..\include\SDL_name.h">
   6.481 +      <Filter>Header Files</Filter>
   6.482 +    </ClInclude>
   6.483 +    <ClInclude Include="..\..\include\SDL_mouse.h">
   6.484 +      <Filter>Header Files</Filter>
   6.485 +    </ClInclude>
   6.486 +    <ClInclude Include="..\..\include\SDL_mutex.h">
   6.487 +      <Filter>Header Files</Filter>
   6.488 +    </ClInclude>
   6.489 +    <ClInclude Include="..\..\src\video\dummy\SDL_nullvideo.h">
   6.490 +      <Filter>Source Files</Filter>
   6.491 +    </ClInclude>
   6.492 +    <ClInclude Include="..\..\include\SDL_quit.h">
   6.493 +      <Filter>Header Files</Filter>
   6.494 +    </ClInclude>
   6.495 +    <ClInclude Include="..\..\include\SDL_pixels.h">
   6.496 +      <Filter>Header Files</Filter>
   6.497 +    </ClInclude>
   6.498 +    <ClInclude Include="..\..\include\SDL_platform.h">
   6.499 +      <Filter>Header Files</Filter>
   6.500 +    </ClInclude>
   6.501 +    <ClInclude Include="..\..\include\SDL_power.h">
   6.502 +      <Filter>Header Files</Filter>
   6.503 +    </ClInclude>
   6.504 +    <ClInclude Include="..\..\src\video\SDL_rect_c.h">
   6.505 +      <Filter>Source Files</Filter>
   6.506 +    </ClInclude>
   6.507 +    <ClInclude Include="..\..\include\SDL_rect.h">
   6.508 +      <Filter>Header Files</Filter>
   6.509 +    </ClInclude>
   6.510 +    <ClInclude Include="..\..\src\render\software\SDL_rotate.h">
   6.511 +      <Filter>Source Files</Filter>
   6.512 +    </ClInclude>
   6.513 +    <ClInclude Include="..\..\include\SDL_shape.h">
   6.514 +      <Filter>Header Files</Filter>
   6.515 +    </ClInclude>
   6.516 +    <ClInclude Include="..\..\include\SDL_render.h">
   6.517 +      <Filter>Header Files</Filter>
   6.518 +    </ClInclude>
   6.519 +    <ClInclude Include="..\..\include\SDL_revision.h">
   6.520 +      <Filter>Header Files</Filter>
   6.521 +    </ClInclude>
   6.522 +    <ClInclude Include="..\..\include\SDL_rwops.h">
   6.523 +      <Filter>Header Files</Filter>
   6.524 +    </ClInclude>
   6.525 +    <ClInclude Include="..\..\include\SDL_scancode.h">
   6.526 +      <Filter>Header Files</Filter>
   6.527 +    </ClInclude>
   6.528 +    <ClInclude Include="..\..\include\SDL_surface.h">
   6.529 +      <Filter>Header Files</Filter>
   6.530 +    </ClInclude>
   6.531 +    <ClInclude Include="..\..\include\SDL_stdinc.h">
   6.532 +      <Filter>Header Files</Filter>
   6.533 +    </ClInclude>
   6.534 +    <ClInclude Include="..\..\include\SDL_video.h">
   6.535 +      <Filter>Header Files</Filter>
   6.536 +    </ClInclude>
   6.537 +    <ClInclude Include="..\..\include\SDL_syswm.h">
   6.538 +      <Filter>Header Files</Filter>
   6.539 +    </ClInclude>
   6.540 +    <ClInclude Include="..\..\include\SDL_thread.h">
   6.541 +      <Filter>Header Files</Filter>
   6.542 +    </ClInclude>
   6.543 +    <ClInclude Include="..\..\include\SDL_timer.h">
   6.544 +      <Filter>Header Files</Filter>
   6.545 +    </ClInclude>
   6.546 +    <ClInclude Include="..\..\include\SDL_touch.h">
   6.547 +      <Filter>Header Files</Filter>
   6.548 +    </ClInclude>
   6.549 +    <ClInclude Include="..\..\include\SDL_version.h">
   6.550 +      <Filter>Header Files</Filter>
   6.551 +    </ClInclude>
   6.552 +    <ClInclude Include="..\..\src\video\SDL_shape_internals.h">
   6.553 +      <Filter>Source Files</Filter>
   6.554 +    </ClInclude>
   6.555 +    <ClInclude Include="..\..\src\audio\SDL_sysaudio.h">
   6.556 +      <Filter>Source Files</Filter>
   6.557 +    </ClInclude>
   6.558 +    <ClInclude Include="..\..\src\events\SDL_sysevents.h">
   6.559 +      <Filter>Source Files</Filter>
   6.560 +    </ClInclude>
   6.561 +    <ClInclude Include="..\..\src\haptic\SDL_syshaptic.h">
   6.562 +      <Filter>Source Files</Filter>
   6.563 +    </ClInclude>
   6.564 +    <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h">
   6.565 +      <Filter>Source Files</Filter>
   6.566 +    </ClInclude>
   6.567 +    <ClInclude Include="..\..\src\render\SDL_sysrender.h">
   6.568 +      <Filter>Source Files</Filter>
   6.569 +    </ClInclude>
   6.570 +    <ClInclude Include="..\..\src\thread\SDL_systhread.h">
   6.571 +      <Filter>Source Files</Filter>
   6.572 +    </ClInclude>
   6.573 +    <ClInclude Include="..\..\src\video\SDL_sysvideo.h">
   6.574 +      <Filter>Source Files</Filter>
   6.575 +    </ClInclude>
   6.576 +    <ClInclude Include="..\..\src\audio\SDL_wave.h">
   6.577 +      <Filter>Source Files</Filter>
   6.578 +    </ClInclude>
   6.579 +    <ClInclude Include="..\..\src\core\windows\SDL_windows.h">
   6.580 +      <Filter>Source Files</Filter>
   6.581 +    </ClInclude>
   6.582 +    <ClInclude Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.h">
   6.583 +      <Filter>Source Files</Filter>
   6.584 +    </ClInclude>
   6.585 +    <ClInclude Include="..\..\src\events\blank_cursor.h">
   6.586 +      <Filter>Source Files</Filter>
   6.587 +    </ClInclude>
   6.588 +    <ClInclude Include="..\..\src\events\default_cursor.h">
   6.589 +      <Filter>Source Files</Filter>
   6.590 +    </ClInclude>
   6.591 +    <ClInclude Include="..\..\include\SDL_system.h">
   6.592 +      <Filter>Header Files</Filter>
   6.593 +    </ClInclude>
   6.594 +    <ClInclude Include="..\..\src\joystick\SDL_gamecontrollerdb.h">
   6.595 +      <Filter>Header Files</Filter>
   6.596 +    </ClInclude>
   6.597 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h">
   6.598 +      <Filter>Source Files</Filter>
   6.599 +    </ClInclude>
   6.600 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h">
   6.601 +      <Filter>Source Files</Filter>
   6.602 +    </ClInclude>
   6.603 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h">
   6.604 +      <Filter>Source Files</Filter>
   6.605 +    </ClInclude>
   6.606 +    <ClInclude Include="..\..\include\SDL_config_winrt.h">
   6.607 +      <Filter>Header Files</Filter>
   6.608 +    </ClInclude>
   6.609 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_direct3d.h">
   6.610 +      <Filter>Source Files</Filter>
   6.611 +    </ClInclude>
   6.612 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_xaml.h">
   6.613 +      <Filter>Source Files</Filter>
   6.614 +    </ClInclude>
   6.615 +    <ClInclude Include="..\..\src\core\winrt\SDL_winrtapp_common.h">
   6.616 +      <Filter>Source Files</Filter>
   6.617 +    </ClInclude>
   6.618 +    <ClInclude Include="..\..\include\SDL_filesystem.h">
   6.619 +      <Filter>Header Files</Filter>
   6.620 +    </ClInclude>
   6.621 +    <ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h">
   6.622 +      <Filter>Source Files</Filter>
   6.623 +    </ClInclude>
   6.624 +    <ClInclude Include="..\..\src\video\SDL_egl.h">
   6.625 +      <Filter>Source Files</Filter>
   6.626 +    </ClInclude>
   6.627 +    <ClInclude Include="..\..\include\SDL_opengles2.h">
   6.628 +      <Filter>Header Files</Filter>
   6.629 +    </ClInclude>
   6.630 +    <ClInclude Include="..\..\include\SDL_egl.h">
   6.631 +      <Filter>Header Files</Filter>
   6.632 +    </ClInclude>
   6.633 +    <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h">
   6.634 +      <Filter>Source Files</Filter>
   6.635 +    </ClInclude>
   6.636 +    <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h">
   6.637 +      <Filter>Source Files</Filter>
   6.638 +    </ClInclude>
   6.639 +  </ItemGroup>
   6.640 +  <ItemGroup>
   6.641 +    <Filter Include="Header Files">
   6.642 +      <UniqueIdentifier>{20773b57-7034-4c24-af5a-334844585f1b}</UniqueIdentifier>
   6.643 +    </Filter>
   6.644 +    <Filter Include="Source Files">
   6.645 +      <UniqueIdentifier>{ddf04d85-6a87-4c5a-bc52-869b38f45a61}</UniqueIdentifier>
   6.646 +    </Filter>
   6.647 +  </ItemGroup>
   6.648 +</Project>
   6.649 \ No newline at end of file
     7.1 Binary file VisualC-WinRT/tests/loopwave/Assets/Logo.png has changed
     8.1 Binary file VisualC-WinRT/tests/loopwave/Assets/SmallLogo.png has changed
     9.1 Binary file VisualC-WinRT/tests/loopwave/Assets/SplashScreen.png has changed
    10.1 Binary file VisualC-WinRT/tests/loopwave/Assets/StoreLogo.png has changed
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/VisualC-WinRT/tests/loopwave/Package.appxmanifest	Sun Mar 09 11:36:47 2014 -0700
    11.3 @@ -0,0 +1,42 @@
    11.4 +<?xml version="1.0" encoding="utf-8"?>
    11.5 +<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
    11.6 +
    11.7 +  <Identity Name="1702c480-cf09-431e-a5e4-b21b283ec818"
    11.8 +            Publisher="CN=David"
    11.9 +            Version="1.0.0.0" />
   11.10 +
   11.11 +  <Properties>
   11.12 +    <DisplayName>loopwave_VS2012_WinRT</DisplayName>
   11.13 +    <PublisherDisplayName>David</PublisherDisplayName>
   11.14 +    <Logo>Assets\StoreLogo.png</Logo>
   11.15 +  </Properties>
   11.16 +
   11.17 +  <Prerequisites>
   11.18 +    <OSMinVersion>6.2.1</OSMinVersion>
   11.19 +    <OSMaxVersionTested>6.2.1</OSMaxVersionTested>
   11.20 +  </Prerequisites>
   11.21 +
   11.22 +  <Resources>
   11.23 +    <Resource Language="x-generate"/>
   11.24 +  </Resources>
   11.25 +
   11.26 +  <Applications>
   11.27 +    <Application Id="App"
   11.28 +        Executable="$targetnametoken$.exe"
   11.29 +        EntryPoint="loopwave_VS2012_WinRT.App">
   11.30 +        <VisualElements
   11.31 +            DisplayName="loopwave_VS2012_WinRT"
   11.32 +            Logo="Assets\Logo.png"
   11.33 +            SmallLogo="Assets\SmallLogo.png"
   11.34 +            Description="loopwave_VS2012_WinRT"
   11.35 +            ForegroundText="light"
   11.36 +            BackgroundColor="#464646">
   11.37 +            <DefaultTile ShowName="allLogos" />
   11.38 +            <SplashScreen Image="Assets\SplashScreen.png" />
   11.39 +        </VisualElements>
   11.40 +    </Application>
   11.41 +  </Applications>
   11.42 +  <Capabilities>
   11.43 +    <Capability Name="internetClient" />
   11.44 +  </Capabilities>
   11.45 +</Package>
   11.46 \ No newline at end of file
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj	Sun Mar 09 11:36:47 2014 -0700
    12.3 @@ -0,0 +1,170 @@
    12.4 +<?xml version="1.0" encoding="utf-8"?>
    12.5 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    12.6 +  <ItemGroup Label="ProjectConfigurations">
    12.7 +    <ProjectConfiguration Include="Debug|Win32">
    12.8 +      <Configuration>Debug</Configuration>
    12.9 +      <Platform>Win32</Platform>
   12.10 +    </ProjectConfiguration>
   12.11 +    <ProjectConfiguration Include="Release|Win32">
   12.12 +      <Configuration>Release</Configuration>
   12.13 +      <Platform>Win32</Platform>
   12.14 +    </ProjectConfiguration>
   12.15 +    <ProjectConfiguration Include="Debug|x64">
   12.16 +      <Configuration>Debug</Configuration>
   12.17 +      <Platform>x64</Platform>
   12.18 +    </ProjectConfiguration>
   12.19 +    <ProjectConfiguration Include="Release|x64">
   12.20 +      <Configuration>Release</Configuration>
   12.21 +      <Platform>x64</Platform>
   12.22 +    </ProjectConfiguration>
   12.23 +    <ProjectConfiguration Include="Debug|ARM">
   12.24 +      <Configuration>Debug</Configuration>
   12.25 +      <Platform>ARM</Platform>
   12.26 +    </ProjectConfiguration>
   12.27 +    <ProjectConfiguration Include="Release|ARM">
   12.28 +      <Configuration>Release</Configuration>
   12.29 +      <Platform>ARM</Platform>
   12.30 +    </ProjectConfiguration>
   12.31 +  </ItemGroup>
   12.32 +  <PropertyGroup Label="Globals">
   12.33 +    <ProjectGuid>{03fcc293-9406-49c2-acf6-6e7d460c3239}</ProjectGuid>
   12.34 +    <RootNamespace>loopwave_VS2012</RootNamespace>
   12.35 +    <DefaultLanguage>en-US</DefaultLanguage>
   12.36 +    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
   12.37 +    <AppContainerApplication>true</AppContainerApplication>
   12.38 +    <ProjectName>loopwave</ProjectName>
   12.39 +  </PropertyGroup>
   12.40 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   12.41 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
   12.42 +    <ConfigurationType>Application</ConfigurationType>
   12.43 +    <UseDebugLibraries>true</UseDebugLibraries>
   12.44 +    <PlatformToolset>v110</PlatformToolset>
   12.45 +  </PropertyGroup>
   12.46 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
   12.47 +    <ConfigurationType>Application</ConfigurationType>
   12.48 +    <UseDebugLibraries>true</UseDebugLibraries>
   12.49 +    <PlatformToolset>v110</PlatformToolset>
   12.50 +  </PropertyGroup>
   12.51 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
   12.52 +    <ConfigurationType>Application</ConfigurationType>
   12.53 +    <UseDebugLibraries>true</UseDebugLibraries>
   12.54 +    <PlatformToolset>v110</PlatformToolset>
   12.55 +  </PropertyGroup>
   12.56 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
   12.57 +    <ConfigurationType>Application</ConfigurationType>
   12.58 +    <UseDebugLibraries>false</UseDebugLibraries>
   12.59 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   12.60 +    <PlatformToolset>v110</PlatformToolset>
   12.61 +  </PropertyGroup>
   12.62 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
   12.63 +    <ConfigurationType>Application</ConfigurationType>
   12.64 +    <UseDebugLibraries>false</UseDebugLibraries>
   12.65 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   12.66 +    <PlatformToolset>v110</PlatformToolset>
   12.67 +  </PropertyGroup>
   12.68 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
   12.69 +    <ConfigurationType>Application</ConfigurationType>
   12.70 +    <UseDebugLibraries>false</UseDebugLibraries>
   12.71 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   12.72 +    <PlatformToolset>v110</PlatformToolset>
   12.73 +  </PropertyGroup>
   12.74 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   12.75 +  <ImportGroup Label="ExtensionSettings">
   12.76 +  </ImportGroup>
   12.77 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   12.78 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   12.79 +  </ImportGroup>
   12.80 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   12.81 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   12.82 +  </ImportGroup>
   12.83 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
   12.84 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   12.85 +  </ImportGroup>
   12.86 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
   12.87 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   12.88 +  </ImportGroup>
   12.89 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
   12.90 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   12.91 +  </ImportGroup>
   12.92 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   12.93 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   12.94 +  </ImportGroup>
   12.95 +  <PropertyGroup Label="UserMacros" />
   12.96 +  <PropertyGroup>
   12.97 +    <PackageCertificateKeyFile>loopwave_VS2012_TemporaryKey.pfx</PackageCertificateKeyFile>
   12.98 +  </PropertyGroup>
   12.99 +  <ItemDefinitionGroup>
  12.100 +    <Link>
  12.101 +      <AdditionalDependencies>d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
  12.102 +    </Link>
  12.103 +    <ClCompile>
  12.104 +      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
  12.105 +      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
  12.106 +      <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);$(ProjectDir)..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  12.107 +      <DisableSpecificWarnings>4453</DisableSpecificWarnings>
  12.108 +    </ClCompile>
  12.109 +  </ItemDefinitionGroup>
  12.110 +  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
  12.111 +    <ClCompile>
  12.112 +      <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  12.113 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader>
  12.114 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
  12.115 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
  12.116 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
  12.117 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
  12.118 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
  12.119 +    </ClCompile>
  12.120 +  </ItemDefinitionGroup>
  12.121 +  <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
  12.122 +    <ClCompile>
  12.123 +      <PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  12.124 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader>
  12.125 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
  12.126 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
  12.127 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
  12.128 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
  12.129 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
  12.130 +    </ClCompile>
  12.131 +  </ItemDefinitionGroup>
  12.132 +  <ItemGroup>
  12.133 +    <Image Include="Assets\Logo.png" />
  12.134 +    <Image Include="Assets\SmallLogo.png" />
  12.135 +    <Image Include="Assets\StoreLogo.png" />
  12.136 +    <Image Include="Assets\SplashScreen.png" />
  12.137 +  </ItemGroup>
  12.138 +  <ItemGroup>
  12.139 +    <AppxManifest Include="Package.appxmanifest">
  12.140 +      <SubType>Designer</SubType>
  12.141 +    </AppxManifest>
  12.142 +    <None Include="loopwave_VS2012_TemporaryKey.pfx" />
  12.143 +  </ItemGroup>
  12.144 +  <ItemGroup>
  12.145 +    <ClCompile Include="..\..\..\src\main\winrt\SDL_winrt_main_NonXAML.cpp">
  12.146 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
  12.147 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
  12.148 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
  12.149 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
  12.150 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
  12.151 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
  12.152 +    </ClCompile>
  12.153 +    <ClCompile Include="..\..\..\test\loopwave.c">
  12.154 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
  12.155 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
  12.156 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
  12.157 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
  12.158 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
  12.159 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
  12.160 +    </ClCompile>
  12.161 +  </ItemGroup>
  12.162 +  <ItemGroup>
  12.163 +    <Media Include="..\..\..\test\sample.wav" />
  12.164 +  </ItemGroup>
  12.165 +  <ItemGroup>
  12.166 +    <ProjectReference Include="..\..\SDL\SDL-WinRT_VS2012.vcxproj">
  12.167 +      <Project>{aeaea3a2-d4e6-45b1-8ec6-53d84287fc14}</Project>
  12.168 +    </ProjectReference>
  12.169 +  </ItemGroup>
  12.170 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  12.171 +  <ImportGroup Label="ExtensionTargets">
  12.172 +  </ImportGroup>
  12.173 +</Project>
  12.174 \ No newline at end of file
    13.1 Binary file VisualC-WinRT/tests/loopwave/loopwave_VS2012_TemporaryKey.pfx has changed
    14.1 Binary file VisualC-WinRT/tests/testthread/Assets/Logo.png has changed
    15.1 Binary file VisualC-WinRT/tests/testthread/Assets/SmallLogo.png has changed
    16.1 Binary file VisualC-WinRT/tests/testthread/Assets/SplashScreen.png has changed
    17.1 Binary file VisualC-WinRT/tests/testthread/Assets/StoreLogo.png has changed
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/VisualC-WinRT/tests/testthread/Package.appxmanifest	Sun Mar 09 11:36:47 2014 -0700
    18.3 @@ -0,0 +1,42 @@
    18.4 +<?xml version="1.0" encoding="utf-8"?>
    18.5 +<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
    18.6 +
    18.7 +  <Identity Name="ca3178f1-b2b2-43bf-97dd-28ee1b7d32c5"
    18.8 +            Publisher="CN=David"
    18.9 +            Version="1.0.0.0" />
   18.10 +
   18.11 +  <Properties>
   18.12 +    <DisplayName>testthread_VS2012_WinRT</DisplayName>
   18.13 +    <PublisherDisplayName>David</PublisherDisplayName>
   18.14 +    <Logo>Assets\StoreLogo.png</Logo>
   18.15 +  </Properties>
   18.16 +
   18.17 +  <Prerequisites>
   18.18 +    <OSMinVersion>6.2.1</OSMinVersion>
   18.19 +    <OSMaxVersionTested>6.2.1</OSMaxVersionTested>
   18.20 +  </Prerequisites>
   18.21 +
   18.22 +  <Resources>
   18.23 +    <Resource Language="x-generate"/>
   18.24 +  </Resources>
   18.25 +
   18.26 +  <Applications>
   18.27 +    <Application Id="App"
   18.28 +        Executable="$targetnametoken$.exe"
   18.29 +        EntryPoint="testthread_VS2012_WinRT.App">
   18.30 +        <VisualElements
   18.31 +            DisplayName="testthread_VS2012_WinRT"
   18.32 +            Logo="Assets\Logo.png"
   18.33 +            SmallLogo="Assets\SmallLogo.png"
   18.34 +            Description="testthread_VS2012_WinRT"
   18.35 +            ForegroundText="light"
   18.36 +            BackgroundColor="#464646">
   18.37 +            <DefaultTile ShowName="allLogos" />
   18.38 +            <SplashScreen Image="Assets\SplashScreen.png" />
   18.39 +        </VisualElements>
   18.40 +    </Application>
   18.41 +  </Applications>
   18.42 +  <Capabilities>
   18.43 +    <Capability Name="internetClient" />
   18.44 +  </Capabilities>
   18.45 +</Package>
   18.46 \ No newline at end of file
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj	Sun Mar 09 11:36:47 2014 -0700
    19.3 @@ -0,0 +1,160 @@
    19.4 +<?xml version="1.0" encoding="utf-8"?>
    19.5 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    19.6 +  <ItemGroup Label="ProjectConfigurations">
    19.7 +    <ProjectConfiguration Include="Debug|Win32">
    19.8 +      <Configuration>Debug</Configuration>
    19.9 +      <Platform>Win32</Platform>
   19.10 +    </ProjectConfiguration>
   19.11 +    <ProjectConfiguration Include="Release|Win32">
   19.12 +      <Configuration>Release</Configuration>
   19.13 +      <Platform>Win32</Platform>
   19.14 +    </ProjectConfiguration>
   19.15 +    <ProjectConfiguration Include="Debug|x64">
   19.16 +      <Configuration>Debug</Configuration>
   19.17 +      <Platform>x64</Platform>
   19.18 +    </ProjectConfiguration>
   19.19 +    <ProjectConfiguration Include="Release|x64">
   19.20 +      <Configuration>Release</Configuration>
   19.21 +      <Platform>x64</Platform>
   19.22 +    </ProjectConfiguration>
   19.23 +    <ProjectConfiguration Include="Debug|ARM">
   19.24 +      <Configuration>Debug</Configuration>
   19.25 +      <Platform>ARM</Platform>
   19.26 +    </ProjectConfiguration>
   19.27 +    <ProjectConfiguration Include="Release|ARM">
   19.28 +      <Configuration>Release</Configuration>
   19.29 +      <Platform>ARM</Platform>
   19.30 +    </ProjectConfiguration>
   19.31 +  </ItemGroup>
   19.32 +  <PropertyGroup Label="Globals">
   19.33 +    <ProjectGuid>{a8705bee-d01d-46a4-b2ab-feedfb5fdd11}</ProjectGuid>
   19.34 +    <RootNamespace>testthread_VS2012</RootNamespace>
   19.35 +    <DefaultLanguage>en-US</DefaultLanguage>
   19.36 +    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
   19.37 +    <AppContainerApplication>true</AppContainerApplication>
   19.38 +    <ProjectName>testthread</ProjectName>
   19.39 +  </PropertyGroup>
   19.40 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   19.41 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
   19.42 +    <ConfigurationType>Application</ConfigurationType>
   19.43 +    <UseDebugLibraries>true</UseDebugLibraries>
   19.44 +    <PlatformToolset>v110</PlatformToolset>
   19.45 +  </PropertyGroup>
   19.46 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
   19.47 +    <ConfigurationType>Application</ConfigurationType>
   19.48 +    <UseDebugLibraries>true</UseDebugLibraries>
   19.49 +    <PlatformToolset>v110</PlatformToolset>
   19.50 +  </PropertyGroup>
   19.51 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
   19.52 +    <ConfigurationType>Application</ConfigurationType>
   19.53 +    <UseDebugLibraries>true</UseDebugLibraries>
   19.54 +    <PlatformToolset>v110</PlatformToolset>
   19.55 +  </PropertyGroup>
   19.56 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
   19.57 +    <ConfigurationType>Application</ConfigurationType>
   19.58 +    <UseDebugLibraries>false</UseDebugLibraries>
   19.59 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   19.60 +    <PlatformToolset>v110</PlatformToolset>
   19.61 +  </PropertyGroup>
   19.62 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
   19.63 +    <ConfigurationType>Application</ConfigurationType>
   19.64 +    <UseDebugLibraries>false</UseDebugLibraries>
   19.65 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   19.66 +    <PlatformToolset>v110</PlatformToolset>
   19.67 +  </PropertyGroup>
   19.68 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
   19.69 +    <ConfigurationType>Application</ConfigurationType>
   19.70 +    <UseDebugLibraries>false</UseDebugLibraries>
   19.71 +    <WholeProgramOptimization>true</WholeProgramOptimization>
   19.72 +    <PlatformToolset>v110</PlatformToolset>
   19.73 +  </PropertyGroup>
   19.74 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   19.75 +  <ImportGroup Label="ExtensionSettings">
   19.76 +  </ImportGroup>
   19.77 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   19.78 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   19.79 +  </ImportGroup>
   19.80 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   19.81 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   19.82 +  </ImportGroup>
   19.83 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
   19.84 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   19.85 +  </ImportGroup>
   19.86 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
   19.87 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   19.88 +  </ImportGroup>
   19.89 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
   19.90 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   19.91 +  </ImportGroup>
   19.92 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   19.93 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   19.94 +  </ImportGroup>
   19.95 +  <PropertyGroup Label="UserMacros" />
   19.96 +  <PropertyGroup>
   19.97 +    <PackageCertificateKeyFile>testthread_VS2012_TemporaryKey.pfx</PackageCertificateKeyFile>
   19.98 +  </PropertyGroup>
   19.99 +  <ItemDefinitionGroup>
  19.100 +    <Link>
  19.101 +      <AdditionalDependencies>d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies)</AdditionalDependencies>
  19.102 +    </Link>
  19.103 +    <ClCompile>
  19.104 +      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
  19.105 +      <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
  19.106 +      <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);$(ProjectDir)..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  19.107 +      <DisableSpecificWarnings>4453</DisableSpecificWarnings>
  19.108 +    </ClCompile>
  19.109 +  </ItemDefinitionGroup>
  19.110 +  <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
  19.111 +    <ClCompile>
  19.112 +      <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  19.113 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader>
  19.114 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
  19.115 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
  19.116 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</CompileAsWinRT>
  19.117 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsWinRT>
  19.118 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsWinRT>
  19.119 +    </ClCompile>
  19.120 +  </ItemDefinitionGroup>
  19.121 +  <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
  19.122 +    <ClCompile>
  19.123 +      <PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  19.124 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader>
  19.125 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
  19.126 +      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
  19.127 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</CompileAsWinRT>
  19.128 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsWinRT>
  19.129 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsWinRT>
  19.130 +    </ClCompile>
  19.131 +  </ItemDefinitionGroup>
  19.132 +  <ItemGroup>
  19.133 +    <Image Include="Assets\Logo.png" />
  19.134 +    <Image Include="Assets\SmallLogo.png" />
  19.135 +    <Image Include="Assets\StoreLogo.png" />
  19.136 +    <Image Include="Assets\SplashScreen.png" />
  19.137 +  </ItemGroup>
  19.138 +  <ItemGroup>
  19.139 +    <AppxManifest Include="Package.appxmanifest">
  19.140 +      <SubType>Designer</SubType>
  19.141 +    </AppxManifest>
  19.142 +    <None Include="testthread_VS2012_TemporaryKey.pfx" />
  19.143 +  </ItemGroup>
  19.144 +  <ItemGroup>
  19.145 +    <ClCompile Include="..\..\..\src\main\winrt\SDL_winrt_main_NonXAML.cpp">
  19.146 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
  19.147 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
  19.148 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
  19.149 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
  19.150 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
  19.151 +      <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
  19.152 +    </ClCompile>
  19.153 +    <ClCompile Include="..\..\..\test\testthread.c" />
  19.154 +  </ItemGroup>
  19.155 +  <ItemGroup>
  19.156 +    <ProjectReference Include="..\..\SDL\SDL-WinRT_VS2012.vcxproj">
  19.157 +      <Project>{aeaea3a2-d4e6-45b1-8ec6-53d84287fc14}</Project>
  19.158 +    </ProjectReference>
  19.159 +  </ItemGroup>
  19.160 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  19.161 +  <ImportGroup Label="ExtensionTargets">
  19.162 +  </ImportGroup>
  19.163 +</Project>
  19.164 \ No newline at end of file
    20.1 Binary file VisualC-WinRT/tests/testthread/testthread_VS2012_TemporaryKey.pfx has changed
    23.1 --- a/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Sun Mar 09 10:38:30 2014 -0700
    23.2 +++ b/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Sun Mar 09 11:36:47 2014 -0700
    23.3 @@ -561,6 +561,7 @@
    23.4  			);
    23.5  			name = CustomTemplate;
    23.6  			sourceTree = "<group>";
    23.7 +			usesTabs = 0;
    23.8  		};
    23.9  		56A6702F18565E4F0007D20F /* dynapi */ = {
   23.10  			isa = PBXGroup;
    24.1 --- a/include/SDL_config.h	Sun Mar 09 10:38:30 2014 -0700
    24.2 +++ b/include/SDL_config.h	Sun Mar 09 11:36:47 2014 -0700
    24.3 @@ -33,6 +33,8 @@
    24.4  #include "SDL_config_premake.h"
    24.5  #elif defined(__WIN32__)
    24.6  #include "SDL_config_windows.h"
    24.7 +#elif defined(__WINRT__)
    24.8 +#include "SDL_config_winrt.h"
    24.9  #elif defined(__MACOSX__)
   24.10  #include "SDL_config_macosx.h"
   24.11  #elif defined(__IPHONEOS__)
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/include/SDL_config_winrt.h	Sun Mar 09 11:36:47 2014 -0700
    25.3 @@ -0,0 +1,191 @@
    25.4 +/*
    25.5 +  Simple DirectMedia Layer
    25.6 +  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
    25.7 +
    25.8 +  This software is provided 'as-is', without any express or implied
    25.9 +  warranty.  In no event will the authors be held liable for any damages
   25.10 +  arising from the use of this software.
   25.11 +
   25.12 +  Permission is granted to anyone to use this software for any purpose,
   25.13 +  including commercial applications, and to alter it and redistribute it
   25.14 +  freely, subject to the following restrictions:
   25.15 +
   25.16 +  1. The origin of this software must not be misrepresented; you must not
   25.17 +     claim that you wrote the original software. If you use this software
   25.18 +     in a product, an acknowledgment in the product documentation would be
   25.19 +     appreciated but is not required.
   25.20 +  2. Altered source versions must be plainly marked as such, and must not be
   25.21 +     misrepresented as being the original software.
   25.22 +  3. This notice may not be removed or altered from any source distribution.
   25.23 +*/
   25.24 +
   25.25 +#ifndef _SDL_config_windows_h
   25.26 +#define _SDL_config_windows_h
   25.27 +
   25.28 +#include "SDL_platform.h"
   25.29 +
   25.30 +/* This is a set of defines to configure the SDL features */
   25.31 +
   25.32 +#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
   25.33 +#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
   25.34 +#define HAVE_STDINT_H	1
   25.35 +#elif defined(_MSC_VER)
   25.36 +typedef signed __int8 int8_t;
   25.37 +typedef unsigned __int8 uint8_t;
   25.38 +typedef signed __int16 int16_t;
   25.39 +typedef unsigned __int16 uint16_t;
   25.40 +typedef signed __int32 int32_t;
   25.41 +typedef unsigned __int32 uint32_t;
   25.42 +typedef signed __int64 int64_t;
   25.43 +typedef unsigned __int64 uint64_t;
   25.44 +#ifndef _UINTPTR_T_DEFINED
   25.45 +#ifdef  _WIN64
   25.46 +typedef unsigned __int64 uintptr_t;
   25.47 +#else
   25.48 +typedef unsigned int uintptr_t;
   25.49 +#endif
   25.50 +#define _UINTPTR_T_DEFINED
   25.51 +#endif
   25.52 +/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
   25.53 +#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
   25.54 +#define DWORD_PTR DWORD
   25.55 +#endif
   25.56 +#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
   25.57 +#define LONG_PTR LONG
   25.58 +#endif
   25.59 +#else /* !__GNUC__ && !_MSC_VER */
   25.60 +typedef signed char int8_t;
   25.61 +typedef unsigned char uint8_t;
   25.62 +typedef signed short int16_t;
   25.63 +typedef unsigned short uint16_t;
   25.64 +typedef signed int int32_t;
   25.65 +typedef unsigned int uint32_t;
   25.66 +typedef signed long long int64_t;
   25.67 +typedef unsigned long long uint64_t;
   25.68 +#ifndef _SIZE_T_DEFINED_
   25.69 +#define _SIZE_T_DEFINED_
   25.70 +typedef unsigned int size_t;
   25.71 +#endif
   25.72 +typedef unsigned int uintptr_t;
   25.73 +#endif /* __GNUC__ || _MSC_VER */
   25.74 +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
   25.75 +
   25.76 +#ifdef _WIN64
   25.77 +# define SIZEOF_VOIDP 8
   25.78 +#else
   25.79 +# define SIZEOF_VOIDP 4
   25.80 +#endif
   25.81 +
   25.82 +/* Useful headers */
   25.83 +#define HAVE_LIBC 1
   25.84 +#define HAVE_STDIO_H 1
   25.85 +#define STDC_HEADERS 1
   25.86 +#define HAVE_STRING_H 1
   25.87 +#define HAVE_CTYPE_H 1
   25.88 +#define HAVE_MATH_H 1
   25.89 +#define HAVE_FLOAT_H 1
   25.90 +#define HAVE_SIGNAL_H 1
   25.91 +
   25.92 +/* C library functions */
   25.93 +#define HAVE_MALLOC 1
   25.94 +#define HAVE_CALLOC 1
   25.95 +#define HAVE_REALLOC 1
   25.96 +#define HAVE_FREE 1
   25.97 +#define HAVE_ALLOCA 1
   25.98 +#define HAVE_QSORT 1
   25.99 +#define HAVE_ABS 1
  25.100 +#define HAVE_MEMSET 1
  25.101 +#define HAVE_MEMCPY 1
  25.102 +#define HAVE_MEMMOVE 1
  25.103 +#define HAVE_MEMCMP 1
  25.104 +#define HAVE_STRLEN 1
  25.105 +#define HAVE__STRREV 1
  25.106 +#define HAVE__STRUPR 1
  25.107 +//#define HAVE__STRLWR 1	// TODO, WinRT: consider using _strlwr_s instead
  25.108 +#define HAVE_STRCHR 1
  25.109 +#define HAVE_STRRCHR 1
  25.110 +#define HAVE_STRSTR 1
  25.111 +//#define HAVE_ITOA 1   // TODO, WinRT: consider using _itoa_s instead
  25.112 +//#define HAVE__LTOA 1	// TODO, WinRT: consider using _ltoa_s instead
  25.113 +//#define HAVE__ULTOA 1	// TODO, WinRT: consider using _ultoa_s instead
  25.114 +#define HAVE_STRTOL 1
  25.115 +#define HAVE_STRTOUL 1
  25.116 +//#define HAVE_STRTOLL 1
  25.117 +#define HAVE_STRTOD 1
  25.118 +#define HAVE_ATOI 1
  25.119 +#define HAVE_ATOF 1
  25.120 +#define HAVE_STRCMP 1
  25.121 +#define HAVE_STRNCMP 1
  25.122 +#define HAVE__STRICMP 1
  25.123 +#define HAVE__STRNICMP 1
  25.124 +#define HAVE_VSNPRINTF 1
  25.125 +//#define HAVE_SSCANF 1	// TODO, WinRT: consider using sscanf_s instead
  25.126 +#define HAVE_M_PI 1
  25.127 +#define HAVE_ATAN 1
  25.128 +#define HAVE_ATAN2 1
  25.129 +#define HAVE_CEIL 1
  25.130 +#define HAVE__COPYSIGN 1
  25.131 +#define HAVE_COS 1
  25.132 +#define HAVE_COSF 1
  25.133 +#define HAVE_FABS 1
  25.134 +#define HAVE_FLOOR 1
  25.135 +#define HAVE_LOG 1
  25.136 +#define HAVE_POW 1
  25.137 +//#define HAVE_SCALBN 1
  25.138 +#define HAVE__SCALB 1
  25.139 +#define HAVE_SIN 1
  25.140 +#define HAVE_SINF 1
  25.141 +#define HAVE_SQRT 1
  25.142 +#define HAVE__FSEEKI64 1
  25.143 +
  25.144 +/* Enable various audio drivers */
  25.145 +#define SDL_AUDIO_DRIVER_XAUDIO2	1
  25.146 +#define SDL_AUDIO_DRIVER_DISK	1
  25.147 +#define SDL_AUDIO_DRIVER_DUMMY	1
  25.148 +
  25.149 +/* Enable various input drivers */
  25.150 +// TODO, WinRT: Get haptic support working
  25.151 +#define SDL_HAPTIC_DISABLED	1
  25.152 +
  25.153 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  25.154 +#define SDL_JOYSTICK_DISABLED 1
  25.155 +#else
  25.156 +#define SDL_JOYSTICK_XINPUT 1
  25.157 +#endif
  25.158 +
  25.159 +/* Enable various shared object loading systems */
  25.160 +#define SDL_LOADSO_WINDOWS	1
  25.161 +
  25.162 +/* Enable various threading systems */
  25.163 +#define SDL_THREAD_STDCPP   1
  25.164 +
  25.165 +/* Enable various timer systems */
  25.166 +#define SDL_TIMER_WINDOWS	1
  25.167 +
  25.168 +/* Enable various video drivers */
  25.169 +#define SDL_VIDEO_DRIVER_WINRT	1
  25.170 +#define SDL_VIDEO_DRIVER_DUMMY  1
  25.171 +
  25.172 +/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */
  25.173 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP    /* TODO, WinRT: try adding OpenGL ES 2 support for Windows Phone 8 */
  25.174 +#define SDL_VIDEO_OPENGL_ES2 1
  25.175 +#define SDL_VIDEO_OPENGL_EGL 1
  25.176 +#endif
  25.177 +
  25.178 +/* Enable appropriate renderer(s) */
  25.179 +#define SDL_VIDEO_RENDER_D3D11  1
  25.180 +
  25.181 +#if SDL_VIDEO_OPENGL_ES2
  25.182 +#define SDL_VIDEO_RENDER_OGL_ES2 1
  25.183 +#endif
  25.184 +
  25.185 +/* Enable system power support */
  25.186 +// TODO, WinRT: investigate system power support.  The Win32-based APIs don't work on WinRT.
  25.187 +#define SDL_POWER_DISABLED  1
  25.188 +
  25.189 +/* Enable assembly routines (Win64 doesn't have inline asm) */
  25.190 +#ifndef _WIN64
  25.191 +#define SDL_ASSEMBLY_ROUTINES	1
  25.192 +#endif
  25.193 +
  25.194 +#endif /* _SDL_config_windows_h */
    26.1 --- a/include/SDL_cpuinfo.h	Sun Mar 09 10:38:30 2014 -0700
    26.2 +++ b/include/SDL_cpuinfo.h	Sun Mar 09 11:36:47 2014 -0700
    26.3 @@ -32,7 +32,7 @@
    26.4  
    26.5  /* Need to do this here because intrin.h has C++ code in it */
    26.6  /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
    26.7 -#if defined(_MSC_VER) && (_MSC_VER >= 1500)
    26.8 +#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
    26.9  #include <intrin.h>
   26.10  #ifndef _WIN64
   26.11  #define __MMX__
    27.1 --- a/include/SDL_egl.h	Sun Mar 09 10:38:30 2014 -0700
    27.2 +++ b/include/SDL_egl.h	Sun Mar 09 11:36:47 2014 -0700
    27.3 @@ -391,9 +391,16 @@
    27.4  #endif
    27.5  #include <windows.h>
    27.6  
    27.7 +#if __WINRT__
    27.8 +#include <Unknwn.h>
    27.9 +typedef IUnknown * EGLNativeWindowType;
   27.10 +typedef int EGLNativeDisplayType;
   27.11 +typedef HBITMAP EGLNativePixmapType;
   27.12 +#else
   27.13  typedef HDC     EGLNativeDisplayType;
   27.14  typedef HBITMAP EGLNativePixmapType;
   27.15  typedef HWND    EGLNativeWindowType;
   27.16 +#endif
   27.17  
   27.18  #elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
   27.19  
    28.1 --- a/include/SDL_hints.h	Sun Mar 09 10:38:30 2014 -0700
    28.2 +++ b/include/SDL_hints.h	Sun Mar 09 11:36:47 2014 -0700
    28.3 @@ -106,6 +106,19 @@
    28.4  #define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE"
    28.5  
    28.6  /**
    28.7 + *  \brief  A variable controlling whether to enable Direct3D 11+'s Debug Layer.
    28.8 + *
    28.9 + *  This variable does not have any effect on the Direct3D 9 based renderer.
   28.10 + *
   28.11 + *  This variable can be set to the following values:
   28.12 + *    "0"       - Disable Debug Layer use
   28.13 + *    "1"       - Enable Debug Layer use
   28.14 + *
   28.15 + *  By default, SDL does not use Direct3D Debug Layer.
   28.16 + */
   28.17 +#define SDL_HINT_RENDER_DIRECT3D11_DEBUG    "SDL_HINT_RENDER_DIRECT3D11_DEBUG"
   28.18 +
   28.19 +/**
   28.20   *  \brief  A variable controlling the scaling quality
   28.21   *
   28.22   *  This variable can be set to the following values:
   28.23 @@ -334,7 +347,7 @@
   28.24  *  If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has
   28.25  *  SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly 
   28.26  *  created SDL_Window:
   28.27 -
   28.28 +*
   28.29  *  1. Its pixel format will be set to the same pixel format as this SDL_Window.  This is
   28.30  *  needed for example when sharing an OpenGL context across multiple windows.
   28.31  *
   28.32 @@ -347,6 +360,62 @@
   28.33  */
   28.34  #define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT    "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"
   28.35  
   28.36 +/*
   28.37 + *  \brief A URL to a WinRT app's privacy policy
   28.38 + *
   28.39 + *  All network-enabled WinRT apps must make a privacy policy available to its
   28.40 + *  users.  On Windows 8, 8.1, and RT, Microsoft mandates that this policy be
   28.41 + *  be available in the Windows Settings charm, as accessed from within the app.
   28.42 + *  SDL provides code to add a URL-based link there, which can point to the app's
   28.43 + *  privacy policy.
   28.44 + *
   28.45 + *  To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL
   28.46 + *  before calling any SDL_Init functions.  The contents of the hint should
   28.47 + *  be a valid URL.  For example, "http://www.example.com".
   28.48 + *
   28.49 + *  The default value is "", which will prevent SDL from adding a privacy policy
   28.50 + *  link to the Settings charm.  This hint should only be set during app init.
   28.51 + *
   28.52 + *  The label text of an app's "Privacy Policy" link may be customized via another
   28.53 + *  hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
   28.54 + *
   28.55 + *  Please note that on Windows Phone, Microsoft does not provide standard UI
   28.56 + *  for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL
   28.57 + *  will not get used on that platform.  Network-enabled phone apps should display
   28.58 + *  their privacy policy through some other, in-app means.
   28.59 + */
   28.60 +#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_HINT_WINRT_PRIVACY_POLICY_URL"
   28.61 +
   28.62 +/** \brief Label text for a WinRT app's privacy policy link
   28.63 + *
   28.64 + *  Network-enabled WinRT apps must include a privacy policy.  On Windows 8, 8.1, and RT,
   28.65 + *  Microsoft mandates that this policy be available via the Windows Settings charm.
   28.66 + *  SDL provides code to add a link there, with it's label text being set via the
   28.67 + *  optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL.
   28.68 + *
   28.69 + *  Please note that a privacy policy's contents are not set via this hint.  A separate
   28.70 + *  hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the
   28.71 + *  policy.
   28.72 + *
   28.73 + *  The contents of this hint should be encoded as a UTF8 string.
   28.74 + *
   28.75 + *  The default value is "Privacy Policy".  This hint should only be set during app
   28.76 + *  initialization, preferably before any calls to SDL_Init.
   28.77 + *
   28.78 + *  For additional information on linking to a privacy policy, see the documentation for
   28.79 + *  SDL_HINT_WINRT_PRIVACY_POLICY_URL.
   28.80 + */
   28.81 +#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_HINT_WINRT_PRIVACY_POLICY_LABEL"
   28.82 +
   28.83 +/** \brief If set to 1, back button press events on Windows Phone 8+ will be marked as handled.
   28.84 + *
   28.85 + *  TODO, WinRT: document SDL_HINT_WINRT_HANDLE_BACK_BUTTON need and use
   28.86 + *  For now, more details on why this is needed can be found at the
   28.87 + *  beginning of the following web page:
   28.88 + *  http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx
   28.89 + */
   28.90 +#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_HINT_WINRT_HANDLE_BACK_BUTTON"
   28.91 +
   28.92  /**
   28.93   *  \brief  A variable that dictates policy for fullscreen Spaces on Mac OS X.
   28.94   *
    29.1 --- a/include/SDL_main.h	Sun Mar 09 10:38:30 2014 -0700
    29.2 +++ b/include/SDL_main.h	Sun Mar 09 11:36:47 2014 -0700
    29.3 @@ -39,6 +39,18 @@
    29.4   */
    29.5  #define SDL_MAIN_AVAILABLE
    29.6  
    29.7 +#elif defined(__WINRT__)
    29.8 +/* On WinRT, SDL provides a main function that initializes CoreApplication,
    29.9 +   creating an instance of IFrameworkView in the process.
   29.10 +
   29.11 +   Please note that #include'ing SDL_main.h is not enough to get a main()
   29.12 +   function working.  In non-XAML apps, the file,
   29.13 +   src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled
   29.14 +   into the app itself.  In XAML apps, the function, SDL_WinRTRunApp must be
   29.15 +   called, with a pointer to the Direct3D-hosted XAML control passed in.
   29.16 +*/
   29.17 +#define SDL_MAIN_NEEDED
   29.18 +
   29.19  #elif defined(__IPHONEOS__)
   29.20  /* On iOS SDL provides a main function that creates an application delegate
   29.21     and starts the iOS application run loop.
   29.22 @@ -115,6 +127,24 @@
   29.23  #endif /* __WIN32__ */
   29.24  
   29.25  
   29.26 +#ifdef __WINRT__
   29.27 +
   29.28 +/**
   29.29 + *  \brief Initializes and launches an SDL/WinRT application.
   29.30 + *
   29.31 + *  \param mainFunction The SDL app's C-style main().
   29.32 + *  \param xamlBackgroundPanel An optional, XAML-based, background panel.
   29.33 + *     For Non-XAML apps, this value must be set to NULL.  For XAML apps,
   29.34 + *     pass in a pointer to a SwapChainBackgroundPanel, casted to an
   29.35 + *     IInspectable (via reinterpret_cast).
   29.36 + *  \ret 0 on success, -1 on failure.  On failure, use SDL_GetError to retrieve more
   29.37 + *      information on the failure.
   29.38 + */
   29.39 +extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel);
   29.40 +
   29.41 +#endif /* __WINRT__ */
   29.42 +
   29.43 +
   29.44  #ifdef __cplusplus
   29.45  }
   29.46  #endif
    31.1 --- a/include/SDL_platform.h	Sun Mar 09 10:38:30 2014 -0700
    31.2 +++ b/include/SDL_platform.h	Sun Mar 09 11:36:47 2014 -0700
    31.3 @@ -113,10 +113,27 @@
    31.4  #undef __SOLARIS__
    31.5  #define __SOLARIS__ 1
    31.6  #endif
    31.7 +
    31.8  #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
    31.9 +/* Try to find out if we're compiling for WinRT or non-WinRT */
   31.10 +#if defined(_MSC_VER) && (_MSC_VER >= 1700)	/* _MSC_VER==1700 for MSVC 2012 */
   31.11 +#include <winapifamily.h>
   31.12 +#endif /* _MSC_VER >= 1700 */
   31.13 +/* Default to classic, Win32/Win64/Desktop compilation either if:
   31.14 +     1. the version of Windows is explicity set to a 'Desktop' (non-Metro) app
   31.15 +     2. the version of Windows cannot be determined via winapifamily.h
   31.16 +   If neither is true, then see if we're compiling for WinRT.
   31.17 + */
   31.18 +#if ! defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
   31.19  #undef __WINDOWS__
   31.20  #define __WINDOWS__   1
   31.21 -#endif
   31.22 +/* See if we're compiling for WinRT: */
   31.23 +#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
   31.24 +#undef __WINRT__
   31.25 +#define __WINRT__ 1
   31.26 +#endif /* ! defined(WINAPI_FAMILY_PARTITION) */
   31.27 +#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
   31.28 +
   31.29  #if defined(__WINDOWS__)
   31.30  #undef __WIN32__
   31.31  #define __WIN32__ 1
    32.1 --- a/include/SDL_stdinc.h	Sun Mar 09 10:38:30 2014 -0700
    32.2 +++ b/include/SDL_stdinc.h	Sun Mar 09 11:36:47 2014 -0700
    32.3 @@ -71,8 +71,18 @@
    32.4  # include <ctype.h>
    32.5  #endif
    32.6  #ifdef HAVE_MATH_H
    32.7 +# if defined(__WINRT__)
    32.8 +/* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on
    32.9 +   WinRT.  See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
   32.10 +   for more information.
   32.11 +*/
   32.12 +#  define _USE_MATH_DEFINES
   32.13 +# endif
   32.14  # include <math.h>
   32.15  #endif
   32.16 +#ifdef HAVE_FLOAT_H
   32.17 +# include <float.h>
   32.18 +#endif
   32.19  #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
   32.20  # include <iconv.h>
   32.21  #endif
    33.1 --- a/include/SDL_system.h	Sun Mar 09 10:38:30 2014 -0700
    33.2 +++ b/include/SDL_system.h	Sun Mar 09 11:36:47 2014 -0700
    33.3 @@ -116,6 +116,70 @@
    33.4  
    33.5  #endif /* __ANDROID__ */
    33.6  
    33.7 +/* Platform specific functions for WinRT */
    33.8 +#if defined(__WINRT__) && __WINRT__
    33.9 +
   33.10 +/**
   33.11 + *  \brief WinRT / Windows Phone path types
   33.12 + */
   33.13 +typedef enum
   33.14 +{
   33.15 +    /** \brief The installed app's root directory.
   33.16 +        Files here are likely to be read-only. */
   33.17 +    SDL_WINRT_PATH_INSTALLED_LOCATION,
   33.18 +
   33.19 +    /** \brief The app's local data store.  Files may be written here */
   33.20 +    SDL_WINRT_PATH_LOCAL_FOLDER,
   33.21 +
   33.22 +    /** \brief The app's roaming data store.  Unsupported on Windows Phone.
   33.23 +        Files written here may be copied to other machines via a network
   33.24 +        connection.
   33.25 +    */
   33.26 +    SDL_WINRT_PATH_ROAMING_FOLDER,
   33.27 +
   33.28 +    /** \brief The app's temporary data store.  Unsupported on Windows Phone.
   33.29 +        Files written here may be deleted at any time. */
   33.30 +    SDL_WINRT_PATH_TEMP_FOLDER
   33.31 +} SDL_WinRT_Path;
   33.32 +
   33.33 +
   33.34 +/**
   33.35 + *  \brief Retrieves a WinRT defined path on the local file system
   33.36 + *
   33.37 + *  \note Documentation on most app-specific path types on WinRT
   33.38 + *      can be found on MSDN, at the URL:
   33.39 + *      http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
   33.40 + *
   33.41 + *  \param pathType The type of path to retrieve.
   33.42 + *  \ret A UCS-2 string (16-bit, wide-char) containing the path, or NULL
   33.43 + *      if the path is not available for any reason.  Not all paths are
   33.44 + *      available on all versions of Windows.  This is especially true on
   33.45 + *      Windows Phone.  Check the documentation for the given
   33.46 + *      SDL_WinRT_Path for more information on which path types are
   33.47 + *      supported where.
   33.48 + */
   33.49 +extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
   33.50 +
   33.51 +/**
   33.52 + *  \brief Retrieves a WinRT defined path on the local file system
   33.53 + *
   33.54 + *  \note Documentation on most app-specific path types on WinRT
   33.55 + *      can be found on MSDN, at the URL:
   33.56 + *      http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
   33.57 + *
   33.58 + *  \param pathType The type of path to retrieve.
   33.59 + *  \ret A UTF-8 string (8-bit, multi-byte) containing the path, or NULL
   33.60 + *      if the path is not available for any reason.  Not all paths are
   33.61 + *      available on all versions of Windows.  This is especially true on
   33.62 + *      Windows Phone.  Check the documentation for the given
   33.63 + *      SDL_WinRT_Path for more information on which path types are
   33.64 + *      supported where.
   33.65 + */
   33.66 +extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
   33.67 +
   33.68 +#endif /* __WINRT__ */
   33.69 +
   33.70 +
   33.71  /* Ends C function definitions when using C++ */
   33.72  #ifdef __cplusplus
   33.73  }
    34.1 --- a/include/SDL_syswm.h	Sun Mar 09 10:38:30 2014 -0700
    34.2 +++ b/include/SDL_syswm.h	Sun Mar 09 11:36:47 2014 -0700
    34.3 @@ -56,6 +56,10 @@
    34.4  #include <windows.h>
    34.5  #endif
    34.6  
    34.7 +#if defined(SDL_VIDEO_DRIVER_WINRT)
    34.8 +#include <Inspectable.h>
    34.9 +#endif
   34.10 +
   34.11  /* This is the structure for custom window manager events */
   34.12  #if defined(SDL_VIDEO_DRIVER_X11)
   34.13  #if defined(__APPLE__) && defined(__MACH__)
   34.14 @@ -90,6 +94,7 @@
   34.15  #include <UIKit/UIKit.h>
   34.16  #else
   34.17  typedef struct _UIWindow UIWindow;
   34.18 +typedef struct _UIViewController UIViewController;
   34.19  #endif
   34.20  #endif
   34.21  
   34.22 @@ -105,6 +110,7 @@
   34.23  {
   34.24      SDL_SYSWM_UNKNOWN,
   34.25      SDL_SYSWM_WINDOWS,
   34.26 +    SDL_SYSWM_WINRT,
   34.27      SDL_SYSWM_X11,
   34.28      SDL_SYSWM_DIRECTFB,
   34.29      SDL_SYSWM_COCOA,
   34.30 @@ -175,6 +181,12 @@
   34.31              HWND window;                /**< The window handle */
   34.32          } win;
   34.33  #endif
   34.34 +#if defined(SDL_VIDEO_DRIVER_WINRT)
   34.35 +        struct
   34.36 +        {
   34.37 +            IInspectable * window;      /**< The WinRT CoreWindow */
   34.38 +        } winrt;
   34.39 +#endif
   34.40  #if defined(SDL_VIDEO_DRIVER_X11)
   34.41          struct
   34.42          {
    36.1 --- a/include/begin_code.h	Sun Mar 09 10:38:30 2014 -0700
    36.2 +++ b/include/begin_code.h	Sun Mar 09 11:36:47 2014 -0700
    36.3 @@ -43,7 +43,7 @@
    36.4  
    36.5  /* Some compilers use a special export keyword */
    36.6  #ifndef DECLSPEC
    36.7 -# if defined(__WIN32__)
    36.8 +# if defined(__WIN32__) || defined(__WINRT__)
    36.9  #  ifdef __BORLANDC__
   36.10  #   ifdef BUILD_SDL
   36.11  #    define DECLSPEC
   36.12 @@ -66,7 +66,7 @@
   36.13  
   36.14  /* By default SDL uses the C calling convention */
   36.15  #ifndef SDLCALL
   36.16 -#if defined(__WIN32__) && !defined(__GNUC__)
   36.17 +#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
   36.18  #define SDLCALL __cdecl
   36.19  #else
   36.20  #define SDLCALL
    38.1 --- a/src/SDL_assert.c	Sun Mar 09 10:38:30 2014 -0700
    38.2 +++ b/src/SDL_assert.c	Sun Mar 09 11:36:47 2014 -0700
    38.3 @@ -39,8 +39,10 @@
    38.4  #else  /* fprintf, _exit(), etc. */
    38.5  #include <stdio.h>
    38.6  #include <stdlib.h>
    38.7 +#if ! defined(__WINRT__)
    38.8  #include <unistd.h>
    38.9  #endif
   38.10 +#endif
   38.11  
   38.12  static SDL_assert_state
   38.13  SDL_PromptAssertion(const SDL_assert_data *data, void *userdata);
    39.1 --- a/src/SDL_log.c	Sun Mar 09 10:38:30 2014 -0700
    39.2 +++ b/src/SDL_log.c	Sun Mar 09 11:36:47 2014 -0700
    39.3 @@ -20,7 +20,7 @@
    39.4  */
    39.5  #include "./SDL_internal.h"
    39.6  
    39.7 -#if defined(__WIN32__)
    39.8 +#if defined(__WIN32__) || defined(__WINRT__)
    39.9  #include "core/windows/SDL_windows.h"
   39.10  #endif
   39.11  
   39.12 @@ -318,13 +318,15 @@
   39.13  SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
   39.14                const char *message)
   39.15  {
   39.16 -#if defined(__WIN32__)
   39.17 +#if defined(__WIN32__) || defined(__WINRT__)
   39.18      /* Way too many allocations here, urgh */
   39.19      /* Note: One can't call SDL_SetError here, since that function itself logs. */
   39.20      {
   39.21          char *output;
   39.22          size_t length;
   39.23          LPTSTR tstr;
   39.24 +
   39.25 +#ifndef __WINRT__
   39.26          BOOL attachResult;
   39.27          DWORD attachError;
   39.28          unsigned long charsWritten; 
   39.29 @@ -356,6 +358,7 @@
   39.30                          stderrHandle = GetStdHandle(STD_ERROR_HANDLE);
   39.31                  }
   39.32          }
   39.33 +#endif /* ifndef __WINRT__ */
   39.34  
   39.35          length = SDL_strlen(SDL_priority_prefixes[priority]) + 2 + SDL_strlen(message) + 1 + 1 + 1;
   39.36          output = SDL_stack_alloc(char, length);
   39.37 @@ -365,6 +368,7 @@
   39.38          /* Output to debugger */
   39.39          OutputDebugString(tstr);
   39.40         
   39.41 +#ifndef __WINRT__
   39.42          /* Screen output to stderr, if console was attached. */
   39.43          if (consoleAttached == 1) {
   39.44                  if (!WriteConsole(stderrHandle, tstr, lstrlen(tstr), &charsWritten, NULL)) {
   39.45 @@ -374,6 +378,7 @@
   39.46                      OutputDebugString(TEXT("Insufficient heap memory to write message\r\n"));
   39.47                  }
   39.48          }
   39.49 +#endif /* ifndef __WINRT__ */
   39.50  
   39.51          SDL_free(tstr);
   39.52          SDL_stack_free(output);
    40.1 --- a/src/atomic/SDL_spinlock.c	Sun Mar 09 10:38:30 2014 -0700
    40.2 +++ b/src/atomic/SDL_spinlock.c	Sun Mar 09 11:36:47 2014 -0700
    40.3 @@ -20,7 +20,7 @@
    40.4  */
    40.5  #include "../SDL_internal.h"
    40.6  
    40.7 -#ifdef __WIN32__
    40.8 +#if defined(__WIN32__) || defined(__WINRT__)
    40.9  #include "../core/windows/SDL_windows.h"
   40.10  #endif
   40.11  
    41.1 --- a/src/audio/xaudio2/SDL_xaudio2.c	Sun Mar 09 10:38:30 2014 -0700
    41.2 +++ b/src/audio/xaudio2/SDL_xaudio2.c	Sun Mar 09 11:36:47 2014 -0700
    41.3 @@ -18,6 +18,32 @@
    41.4       misrepresented as being the original software.
    41.5    3. This notice may not be removed or altered from any source distribution.
    41.6  */
    41.7 +
    41.8 +/* WinRT NOTICE:
    41.9 +
   41.10 +   A few changes to SDL's XAudio2 backend were warranted by API
   41.11 +   changes to Windows.  Many, but not all of these are documented by Microsoft
   41.12 +   at:
   41.13 +   http://blogs.msdn.com/b/chuckw/archive/2012/04/02/xaudio2-and-windows-8-consumer-preview.aspx
   41.14 +
   41.15 +   1. Windows' thread synchronization function, CreateSemaphore, was removed
   41.16 +      from WinRT.  SDL's semaphore API was substituted instead.
   41.17 +   2. The method calls, IXAudio2::GetDeviceCount and IXAudio2::GetDeviceDetails
   41.18 +      were removed from the XAudio2 API.  Microsoft is telling developers to
   41.19 +      use APIs in Windows::Foundation instead.
   41.20 +      For SDL, the missing methods were reimplemented using the APIs Microsoft
   41.21 +      said to use.
   41.22 +   3. CoInitialize and CoUninitialize are not available in WinRT.
   41.23 +      These calls were removed, as COM will have been initialized earlier,
   41.24 +      at least by the call to the WinRT app's main function
   41.25 +      (aka 'int main(Platform::Array<Platform::String^>^)).  (DLudwig:
   41.26 +      This was my understanding of how WinRT: the 'main' function uses
   41.27 +      a tag of [MTAThread], which should initialize COM.  My understanding
   41.28 +      of COM is somewhat limited, and I may be incorrect here.)
   41.29 +   4. IXAudio2::CreateMasteringVoice changed its integer-based 'DeviceIndex'
   41.30 +      argument to a string-based one, 'szDeviceId'.  In WinRT, the
   41.31 +      string-based argument will be used.
   41.32 +*/
   41.33  #include "../../SDL_internal.h"
   41.34  
   41.35  #if SDL_AUDIO_DRIVER_XAUDIO2
   41.36 @@ -31,6 +57,9 @@
   41.37  #ifdef __GNUC__
   41.38  /* The configure script already did any necessary checking */
   41.39  #  define SDL_XAUDIO2_HAS_SDK 1
   41.40 +#elif defined(__WINRT__)
   41.41 +/* WinRT always has access to the .the XAudio 2 SDK */
   41.42 +#  define SDL_XAUDIO2_HAS_SDK
   41.43  #else
   41.44  /* XAudio2 exists as of the March 2008 DirectX SDK 
   41.45     The XAudio2 implementation available in the Windows 8 SDK targets Windows 8 and newer.
   41.46 @@ -42,16 +71,36 @@
   41.47  #else
   41.48  #  define SDL_XAUDIO2_HAS_SDK 1
   41.49  #endif
   41.50 -#endif /* __GNUC__ */
   41.51 +#endif
   41.52  
   41.53  #ifdef SDL_XAUDIO2_HAS_SDK
   41.54  
   41.55 +/* Check to see if we're compiling for XAudio 2.8, or higher. */
   41.56 +#ifdef WINVER
   41.57 +#if WINVER >= 0x0602  /* Windows 8 SDK or higher? */
   41.58 +#define SDL_XAUDIO2_WIN8 1
   41.59 +#endif
   41.60 +#endif
   41.61 +
   41.62 +/* The XAudio header file, when #include'd on WinRT, will only compile in C++
   41.63 +   files, but not C.  A few preprocessor-based hacks are defined below in order
   41.64 +   to get xaudio2.h to compile in the C/non-C++ file, SDL_xaudio2.c.
   41.65 + */
   41.66 +#ifdef __WINRT__
   41.67 +#define uuid(x)
   41.68 +#define DX_BUILD
   41.69 +#endif
   41.70 +
   41.71  #define INITGUID 1
   41.72  #include <xaudio2.h>
   41.73  
   41.74  /* Hidden "this" pointer for the audio functions */
   41.75  #define _THIS   SDL_AudioDevice *this
   41.76  
   41.77 +#ifdef __WINRT__
   41.78 +#include "SDL_xaudio2_winrthelpers.h"
   41.79 +#endif
   41.80 +
   41.81  /* Fixes bug 1210 where some versions of gcc need named parameters */
   41.82  #ifdef __GNUC__
   41.83  #ifdef THIS
   41.84 @@ -69,7 +118,7 @@
   41.85      IXAudio2 *ixa2;
   41.86      IXAudio2SourceVoice *source;
   41.87      IXAudio2MasteringVoice *mastering;
   41.88 -    HANDLE semaphore;
   41.89 +    SDL_sem * semaphore;
   41.90      Uint8 *mixbuf;
   41.91      int mixlen;
   41.92      Uint8 *nextbuf;
   41.93 @@ -114,7 +163,7 @@
   41.94  {
   41.95      /* Just signal the SDL audio thread and get out of XAudio2's way. */
   41.96      SDL_AudioDevice *this = (SDL_AudioDevice *) data;
   41.97 -    ReleaseSemaphore(this->hidden->semaphore, 1, NULL);
   41.98 +    SDL_SemPost(this->hidden->semaphore);
   41.99  }
  41.100  
  41.101  static void STDMETHODCALLTYPE
  41.102 @@ -180,7 +229,7 @@
  41.103  XAUDIO2_WaitDevice(_THIS)
  41.104  {
  41.105      if (this->enabled) {
  41.106 -        WaitForSingleObject(this->hidden->semaphore, INFINITE);
  41.107 +        SDL_SemWait(this->hidden->semaphore);
  41.108      }
  41.109  }
  41.110  
  41.111 @@ -191,10 +240,18 @@
  41.112      XAUDIO2_VOICE_STATE state;
  41.113      SDL_assert(!this->enabled);  /* flag that stops playing. */
  41.114      IXAudio2SourceVoice_Discontinuity(source);
  41.115 +#if SDL_XAUDIO2_WIN8
  41.116 +    IXAudio2SourceVoice_GetState(source, &state, 0);
  41.117 +#else
  41.118      IXAudio2SourceVoice_GetState(source, &state);
  41.119 +#endif
  41.120      while (state.BuffersQueued > 0) {
  41.121 -        WaitForSingleObject(this->hidden->semaphore, INFINITE);
  41.122 +        SDL_SemWait(this->hidden->semaphore);
  41.123 +#if SDL_XAUDIO2_WIN8
  41.124 +        IXAudio2SourceVoice_GetState(source, &state, 0);
  41.125 +#else
  41.126          IXAudio2SourceVoice_GetState(source, &state);
  41.127 +#endif
  41.128      }
  41.129  }
  41.130  
  41.131 @@ -223,7 +280,7 @@
  41.132          }
  41.133          SDL_free(this->hidden->mixbuf);
  41.134          if (this->hidden->semaphore != NULL) {
  41.135 -            CloseHandle(this->hidden->semaphore);
  41.136 +            SDL_DestroySemaphore(this->hidden->semaphore);
  41.137          }
  41.138  
  41.139          SDL_free(this->hidden);
  41.140 @@ -240,7 +297,11 @@
  41.141      SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
  41.142      IXAudio2 *ixa2 = NULL;
  41.143      IXAudio2SourceVoice *source = NULL;
  41.144 +#if defined(SDL_XAUDIO2_WIN8)
  41.145 +    LPCWSTR devId = NULL;
  41.146 +#else
  41.147      UINT32 devId = 0;  /* 0 == system default device. */
  41.148 +#endif
  41.149  
  41.150      static IXAudio2VoiceCallbackVtbl callbacks_vtable = {
  41.151          VoiceCBOnVoiceProcessPassStart,
  41.152 @@ -260,6 +321,18 @@
  41.153          return SDL_SetError("XAudio2: XAudio2Create() failed at open.");
  41.154      }
  41.155  
  41.156 +    /*
  41.157 +    XAUDIO2_DEBUG_CONFIGURATION debugConfig;
  41.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;
  41.159 +    debugConfig.BreakMask = XAUDIO2_LOG_ERRORS; //XAUDIO2_LOG_WARNINGS;
  41.160 +    debugConfig.LogThreadID = TRUE;
  41.161 +    debugConfig.LogFileline = TRUE;
  41.162 +    debugConfig.LogFunctionName = TRUE;
  41.163 +    debugConfig.LogTiming = TRUE;
  41.164 +    ixa2->SetDebugConfiguration(&debugConfig);
  41.165 +    */
  41.166 +
  41.167 +#if ! defined(__WINRT__)
  41.168      if (devname != NULL) {
  41.169          UINT32 devcount = 0;
  41.170          UINT32 i = 0;
  41.171 @@ -288,6 +361,7 @@
  41.172              return SDL_SetError("XAudio2: Requested device not found.");
  41.173          }
  41.174      }
  41.175 +#endif
  41.176  
  41.177      /* Initialize all variables that we clean on shutdown */
  41.178      this->hidden = (struct SDL_PrivateAudioData *)
  41.179 @@ -299,7 +373,7 @@
  41.180      SDL_memset(this->hidden, 0, (sizeof *this->hidden));
  41.181  
  41.182      this->hidden->ixa2 = ixa2;
  41.183 -    this->hidden->semaphore = CreateSemaphore(NULL, 1, 2, NULL);
  41.184 +    this->hidden->semaphore = SDL_CreateSemaphore(1);
  41.185      if (this->hidden->semaphore == NULL) {
  41.186          XAUDIO2_CloseDevice(this);
  41.187          return SDL_SetError("XAudio2: CreateSemaphore() failed!");
  41.188 @@ -342,9 +416,15 @@
  41.189         stereo output to appropriate surround sound configurations
  41.190         instead of clamping to 2 channels, even though we'll configure the
  41.191         Source Voice for whatever number of channels you supply. */
  41.192 +#if SDL_XAUDIO2_WIN8
  41.193 +    result = IXAudio2_CreateMasteringVoice(ixa2, &this->hidden->mastering,
  41.194 +                                           XAUDIO2_DEFAULT_CHANNELS,
  41.195 +                                           this->spec.freq, 0, devId, NULL, AudioCategory_GameEffects);
  41.196 +#else
  41.197      result = IXAudio2_CreateMasteringVoice(ixa2, &this->hidden->mastering,
  41.198                                             XAUDIO2_DEFAULT_CHANNELS,
  41.199                                             this->spec.freq, 0, devId, NULL);
  41.200 +#endif
  41.201      if (result != S_OK) {
  41.202          XAUDIO2_CloseDevice(this);
  41.203          return SDL_SetError("XAudio2: Couldn't create mastering voice");
  41.204 @@ -363,11 +443,23 @@
  41.205          waveformat.nChannels * (waveformat.wBitsPerSample / 8);
  41.206      waveformat.nAvgBytesPerSec =
  41.207          waveformat.nSamplesPerSec * waveformat.nBlockAlign;
  41.208 +    waveformat.cbSize = sizeof(waveformat);
  41.209  
  41.210 +#ifdef __WINRT__
  41.211 +    // DLudwig: for now, make XAudio2 do sample rate conversion, just to
  41.212 +    // get the loopwave test to work.
  41.213 +    //
  41.214 +    // TODO, WinRT: consider removing WinRT-specific source-voice creation code from SDL_xaudio2.c
  41.215 +    result = IXAudio2_CreateSourceVoice(ixa2, &source, &waveformat,
  41.216 +                                        0,
  41.217 +                                        1.0f, &callbacks, NULL, NULL);
  41.218 +#else
  41.219      result = IXAudio2_CreateSourceVoice(ixa2, &source, &waveformat,
  41.220                                          XAUDIO2_VOICE_NOSRC |
  41.221                                          XAUDIO2_VOICE_NOPITCH,
  41.222                                          1.0f, &callbacks, NULL, NULL);
  41.223 +
  41.224 +#endif
  41.225      if (result != S_OK) {
  41.226          XAUDIO2_CloseDevice(this);
  41.227          return SDL_SetError("XAudio2: Couldn't create source voice");
  41.228 @@ -393,7 +485,9 @@
  41.229  static void
  41.230  XAUDIO2_Deinitialize(void)
  41.231  {
  41.232 +#if defined(__WIN32__)
  41.233      WIN_CoUninitialize();
  41.234 +#endif
  41.235  }
  41.236  
  41.237  #endif  /* SDL_XAUDIO2_HAS_SDK */
  41.238 @@ -408,13 +502,18 @@
  41.239  #else
  41.240      /* XAudio2Create() is a macro that uses COM; we don't load the .dll */
  41.241      IXAudio2 *ixa2 = NULL;
  41.242 +#if defined(__WIN32__)
  41.243 +    // TODO, WinRT: Investigate using CoInitializeEx here
  41.244      if (FAILED(WIN_CoInitialize())) {
  41.245          SDL_SetError("XAudio2: CoInitialize() failed");
  41.246          return 0;
  41.247      }
  41.248 +#endif
  41.249  
  41.250      if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) {
  41.251 +#if defined(__WIN32__)
  41.252          WIN_CoUninitialize();
  41.253 +#endif
  41.254          SDL_SetError("XAudio2: XAudio2Create() failed at initialization");
  41.255          return 0;  /* not available. */
  41.256      }
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp	Sun Mar 09 11:36:47 2014 -0700
    42.3 @@ -0,0 +1,69 @@
    42.4 +
    42.5 +#include <xaudio2.h>
    42.6 +#include "SDL_xaudio2_winrthelpers.h"
    42.7 +
    42.8 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
    42.9 +using Windows::Devices::Enumeration::DeviceClass;
   42.10 +using Windows::Devices::Enumeration::DeviceInformation;
   42.11 +using Windows::Devices::Enumeration::DeviceInformationCollection;
   42.12 +#endif
   42.13 +
   42.14 +extern "C" HRESULT __cdecl IXAudio2_GetDeviceCount(IXAudio2 * ixa2, UINT32 * devcount)
   42.15 +{
   42.16 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
   42.17 +    // There doesn't seem to be any audio device enumeration on Windows Phone.
   42.18 +    // In lieu of this, just treat things as if there is one and only one
   42.19 +    // audio device.
   42.20 +    *devcount = 1;
   42.21 +    return S_OK;
   42.22 +#else
   42.23 +    // TODO, WinRT: make xaudio2 device enumeration only happen once, and in the background
   42.24 +    auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender);
   42.25 +    while (operation->Status != Windows::Foundation::AsyncStatus::Completed)
   42.26 +    {
   42.27 +    }
   42.28 + 
   42.29 +    DeviceInformationCollection^ devices = operation->GetResults();
   42.30 +    *devcount = devices->Size;
   42.31 +    return S_OK;
   42.32 +#endif
   42.33 +}
   42.34 +
   42.35 +extern "C" HRESULT IXAudio2_GetDeviceDetails(IXAudio2 * unused, UINT32 index, XAUDIO2_DEVICE_DETAILS * details)
   42.36 +{
   42.37 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
   42.38 +    // Windows Phone doesn't seem to have the same device enumeration APIs that
   42.39 +    // Windows 8/RT has, or it doesn't have them at all.  In lieu of this,
   42.40 +    // just treat things as if there is one, and only one, default device.
   42.41 +    if (index != 0)
   42.42 +    {
   42.43 +        return XAUDIO2_E_INVALID_CALL;
   42.44 +    }
   42.45 +
   42.46 +    if (details)
   42.47 +    {
   42.48 +        wcsncpy_s(details->DeviceID, ARRAYSIZE(details->DeviceID), L"default", _TRUNCATE);
   42.49 +        wcsncpy_s(details->DisplayName, ARRAYSIZE(details->DisplayName), L"default", _TRUNCATE);
   42.50 +    }
   42.51 +    return S_OK;
   42.52 +#else
   42.53 +    auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender);
   42.54 +    while (operation->Status != Windows::Foundation::AsyncStatus::Completed)
   42.55 +    {
   42.56 +    }
   42.57 + 
   42.58 +    DeviceInformationCollection^ devices = operation->GetResults();
   42.59 +    if (index >= devices->Size)
   42.60 +    {
   42.61 +        return XAUDIO2_E_INVALID_CALL;
   42.62 +    }
   42.63 +
   42.64 +    DeviceInformation^ d = devices->GetAt(index);
   42.65 +    if (details)
   42.66 +    {
   42.67 +        wcsncpy_s(details->DeviceID, ARRAYSIZE(details->DeviceID), d->Id->Data(), _TRUNCATE);
   42.68 +        wcsncpy_s(details->DisplayName, ARRAYSIZE(details->DisplayName), d->Name->Data(), _TRUNCATE);
   42.69 +    }
   42.70 +    return S_OK;
   42.71 +#endif
   42.72 +}
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h	Sun Mar 09 11:36:47 2014 -0700
    43.3 @@ -0,0 +1,52 @@
    43.4 +
    43.5 +#pragma once
    43.6 +
    43.7 +//
    43.8 +// Re-implementation of methods removed from XAudio2 (in WinRT):
    43.9 +//
   43.10 +
   43.11 +typedef struct XAUDIO2_DEVICE_DETAILS
   43.12 +{
   43.13 +    WCHAR DeviceID[256];
   43.14 +    WCHAR DisplayName[256];
   43.15 +    /* Other fields exist in the pre-Windows 8 version of this struct, however
   43.16 +       they weren't used by SDL, so they weren't added.
   43.17 +    */
   43.18 +} XAUDIO2_DEVICE_DETAILS;
   43.19 +
   43.20 +
   43.21 +#ifdef __cplusplus
   43.22 +extern "C" {
   43.23 +#endif
   43.24 +
   43.25 +HRESULT IXAudio2_GetDeviceCount(IXAudio2 * unused, UINT32 * devcount);
   43.26 +HRESULT IXAudio2_GetDeviceDetails(IXAudio2 * unused, UINT32 index, XAUDIO2_DEVICE_DETAILS * details);
   43.27 +
   43.28 +#ifdef __cplusplus
   43.29 +}
   43.30 +#endif
   43.31 +
   43.32 +
   43.33 +//
   43.34 +// C-style macros to call XAudio2's methods in C++:
   43.35 +//
   43.36 +#ifdef __cplusplus
   43.37 +/*
   43.38 +#define IXAudio2_CreateMasteringVoice(A, B, C, D, E, F, G) (A)->CreateMasteringVoice((B), (C), (D), (E), (F), (G))
   43.39 +#define IXAudio2_CreateSourceVoice(A, B, C, D, E, F, G, H) (A)->CreateSourceVoice((B), (C), (D), (E), (F), (G), (H))
   43.40 +#define IXAudio2_QueryInterface(A, B, C) (A)->QueryInterface((B), (C))
   43.41 +#define IXAudio2_Release(A) (A)->Release()
   43.42 +#define IXAudio2_StartEngine(A) (A)->StartEngine()
   43.43 +#define IXAudio2_StopEngine(A) (A)->StopEngine()
   43.44 +
   43.45 +#define IXAudio2MasteringVoice_DestroyVoice(A) (A)->DestroyVoice()
   43.46 +
   43.47 +#define IXAudio2SourceVoice_DestroyVoice(A) (A)->DestroyVoice()
   43.48 +#define IXAudio2SourceVoice_Discontinuity(A) (A)->Discontinuity()
   43.49 +#define IXAudio2SourceVoice_FlushSourceBuffers(A) (A)->FlushSourceBuffers()
   43.50 +#define IXAudio2SourceVoice_GetState(A, B) (A)->GetState((B))
   43.51 +#define IXAudio2SourceVoice_Start(A, B, C) (A)->Start((B), (C))
   43.52 +#define IXAudio2SourceVoice_Stop(A, B, C) (A)->Stop((B), (C))
   43.53 +#define IXAudio2SourceVoice_SubmitSourceBuffer(A, B, C) (A)->SubmitSourceBuffer((B), (C))
   43.54 +*/
   43.55 +#endif // ifdef __cplusplus
    44.1 --- a/src/core/windows/SDL_windows.c	Sun Mar 09 10:38:30 2014 -0700
    44.2 +++ b/src/core/windows/SDL_windows.c	Sun Mar 09 11:36:47 2014 -0700
    44.3 @@ -20,26 +20,33 @@
    44.4  */
    44.5  #include "../../SDL_internal.h"
    44.6  
    44.7 -#ifdef __WIN32__
    44.8 +#if defined(__WIN32__) || defined(__WINRT__)
    44.9  
   44.10  #include "SDL_windows.h"
   44.11  #include "SDL_error.h"
   44.12  #include "SDL_assert.h"
   44.13  
   44.14 -#include <objbase.h>  /* for CoInitialize/CoUninitialize */
   44.15 +#include <objbase.h>  /* for CoInitialize/CoUninitialize (Win32 only) */
   44.16 +
   44.17 +/* Sets an error message based on GetLastError() */
   44.18 +int
   44.19 +WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr)
   44.20 +{
   44.21 +    TCHAR buffer[1024];
   44.22 +    char *message;
   44.23 +    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, 0,
   44.24 +                  buffer, SDL_arraysize(buffer), NULL);
   44.25 +    message = WIN_StringToUTF8(buffer);
   44.26 +    SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message);
   44.27 +    SDL_free(message);
   44.28 +    return -1;
   44.29 +}
   44.30  
   44.31  /* Sets an error message based on GetLastError() */
   44.32  int
   44.33  WIN_SetError(const char *prefix)
   44.34  {
   44.35 -    TCHAR buffer[1024];
   44.36 -    char *message;
   44.37 -    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
   44.38 -                  buffer, SDL_arraysize(buffer), NULL);
   44.39 -    message = WIN_StringToUTF8(buffer);
   44.40 -    SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message);
   44.41 -    SDL_free(message);
   44.42 -    return -1;
   44.43 +    return WIN_SetErrorFromHRESULT(prefix, GetLastError());
   44.44  }
   44.45  
   44.46  HRESULT
   44.47 @@ -50,6 +57,14 @@
   44.48  
   44.49         If you need multi-threaded mode, call CoInitializeEx() before SDL_Init()
   44.50      */
   44.51 +#ifdef __WINRT__
   44.52 +    /* DLudwig: On WinRT, it is assumed that COM was initialized in main().
   44.53 +       CoInitializeEx is available (not CoInitialize though), however
   44.54 +       on WinRT, main() is typically declared with the [MTAThread]
   44.55 +       attribute, which, AFAIK, should initialize COM.
   44.56 +    */
   44.57 +    return S_OK;
   44.58 +#else
   44.59      HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
   44.60      if (hr == RPC_E_CHANGED_MODE) {
   44.61          hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
   44.62 @@ -62,12 +77,15 @@
   44.63      }
   44.64  
   44.65      return hr;
   44.66 +#endif
   44.67  }
   44.68  
   44.69  void
   44.70  WIN_CoUninitialize(void)
   44.71  {
   44.72 +#ifndef __WINRT__
   44.73      CoUninitialize();
   44.74 +#endif
   44.75  }
   44.76  
   44.77  #endif /* __WIN32__ */
    45.1 --- a/src/core/windows/SDL_windows.h	Sun Mar 09 10:38:30 2014 -0700
    45.2 +++ b/src/core/windows/SDL_windows.h	Sun Mar 09 11:36:47 2014 -0700
    45.3 @@ -24,6 +24,7 @@
    45.4  #ifndef _INCLUDED_WINDOWS_H
    45.5  #define _INCLUDED_WINDOWS_H
    45.6  
    45.7 +#if defined(__WIN32__)
    45.8  #define WIN32_LEAN_AND_MEAN
    45.9  #define STRICT
   45.10  #ifndef UNICODE
   45.11 @@ -31,6 +32,7 @@
   45.12  #endif
   45.13  #undef _WIN32_WINNT
   45.14  #define _WIN32_WINNT  0x501   /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices(), 0x501 for raw input */
   45.15 +#endif
   45.16  
   45.17  #include <windows.h>
   45.18  
   45.19 @@ -44,6 +46,9 @@
   45.20  #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)(S), SDL_strlen(S)+1)
   45.21  #endif
   45.22  
   45.23 +/* Sets an error message based on a given HRESULT */
   45.24 +extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr);
   45.25 +
   45.26  /* Sets an error message based on GetLastError(). Always return -1. */
   45.27  extern int WIN_SetError(const char *prefix);
   45.28  
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/src/core/winrt/SDL_winrtapp_common.cpp	Sun Mar 09 11:36:47 2014 -0700
    46.3 @@ -0,0 +1,16 @@
    46.4 +
    46.5 +#include <SDL_system.h>
    46.6 +#include "SDL_winrtapp_direct3d.h"
    46.7 +#include "SDL_winrtapp_xaml.h"
    46.8 +
    46.9 +int (*WINRT_SDLAppEntryPoint)(int, char **) = NULL;
   46.10 +
   46.11 +extern "C" DECLSPEC int
   46.12 +SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel)
   46.13 +{
   46.14 +    if (xamlBackgroundPanel) {
   46.15 +        return SDL_WinRTInitXAMLApp(mainFunction, xamlBackgroundPanel);
   46.16 +    } else {
   46.17 +        return SDL_WinRTInitNonXAMLApp(mainFunction);
   46.18 +    }
   46.19 +}
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/src/core/winrt/SDL_winrtapp_common.h	Sun Mar 09 11:36:47 2014 -0700
    47.3 @@ -0,0 +1,31 @@
    47.4 +/*
    47.5 +  Simple DirectMedia Layer
    47.6 +  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
    47.7 +
    47.8 +  This software is provided 'as-is', without any express or implied
    47.9 +  warranty.  In no event will the authors be held liable for any damages
   47.10 +  arising from the use of this software.
   47.11 +
   47.12 +  Permission is granted to anyone to use this software for any purpose,
   47.13 +  including commercial applications, and to alter it and redistribute it
   47.14 +  freely, subject to the following restrictions:
   47.15 +
   47.16 +  1. The origin of this software must not be misrepresented; you must not
   47.17 +     claim that you wrote the original software. If you use this software
   47.18 +     in a product, an acknowledgment in the product documentation would be
   47.19 +     appreciated but is not required.
   47.20 +  2. Altered source versions must be plainly marked as such, and must not be
   47.21 +     misrepresented as being the original software.
   47.22 +  3. This notice may not be removed or altered from any source distribution.
   47.23 +*/
   47.24 +#include "SDL_config.h"
   47.25 +
   47.26 +#ifndef _SDL_winrtapp_common_h
   47.27 +#define _SDL_winrtapp_common_h
   47.28 +
   47.29 +/* A pointer to the app's C-style main() function (which is a different
   47.30 +   function than the WinRT app's actual entry point).
   47.31 + */
   47.32 +extern int (*WINRT_SDLAppEntryPoint)(int, char **);
   47.33 +
   47.34 +#endif // ifndef _SDL_winrtapp_common_h
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp	Sun Mar 09 11:36:47 2014 -0700
    48.3 @@ -0,0 +1,668 @@
    48.4 +
    48.5 +/* Standard C++11 includes */
    48.6 +#include <functional>
    48.7 +#include <string>
    48.8 +#include <sstream>
    48.9 +using namespace std;
   48.10 +
   48.11 +
   48.12 +/* Windows includes */
   48.13 +#include "ppltasks.h"
   48.14 +using namespace concurrency;
   48.15 +using namespace Windows::ApplicationModel;
   48.16 +using namespace Windows::ApplicationModel::Core;
   48.17 +using namespace Windows::ApplicationModel::Activation;
   48.18 +using namespace Windows::Devices::Input;
   48.19 +using namespace Windows::Graphics::Display;
   48.20 +using namespace Windows::Foundation;
   48.21 +using namespace Windows::System;
   48.22 +using namespace Windows::UI::Core;
   48.23 +using namespace Windows::UI::Input;
   48.24 +
   48.25 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
   48.26 +using namespace Windows::Phone::UI::Input;
   48.27 +#endif
   48.28 +
   48.29 +
   48.30 +/* SDL includes */
   48.31 +extern "C" {
   48.32 +#include "SDL_assert.h"
   48.33 +#include "SDL_events.h"
   48.34 +#include "SDL_hints.h"
   48.35 +#include "SDL_log.h"
   48.36 +#include "SDL_main.h"
   48.37 +#include "SDL_stdinc.h"
   48.38 +#include "SDL_render.h"
   48.39 +#include "../../video/SDL_sysvideo.h"
   48.40 +//#include "../../SDL_hints_c.h"
   48.41 +#include "../../events/SDL_events_c.h"
   48.42 +#include "../../events/SDL_keyboard_c.h"
   48.43 +#include "../../events/SDL_mouse_c.h"
   48.44 +#include "../../events/SDL_windowevents_c.h"
   48.45 +#include "../../render/SDL_sysrender.h"
   48.46 +#include "../windows/SDL_windows.h"
   48.47 +}
   48.48 +
   48.49 +#include "../../video/winrt/SDL_winrtevents_c.h"
   48.50 +#include "../../video/winrt/SDL_winrtvideo_cpp.h"
   48.51 +#include "SDL_winrtapp_common.h"
   48.52 +#include "SDL_winrtapp_direct3d.h"
   48.53 +
   48.54 +
   48.55 +// Compile-time debugging options:
   48.56 +// To enable, uncomment; to disable, comment them out.
   48.57 +//#define LOG_POINTER_EVENTS 1
   48.58 +//#define LOG_WINDOW_EVENTS 1
   48.59 +//#define LOG_ORIENTATION_EVENTS 1
   48.60 +
   48.61 +
   48.62 +// HACK, DLudwig: record a reference to the global, WinRT 'app'/view.
   48.63 +// SDL/WinRT will use this throughout its code.
   48.64 +//
   48.65 +// TODO, WinRT: consider replacing SDL_WinRTGlobalApp with something
   48.66 +// non-global, such as something created inside
   48.67 +// SDL_InitSubSystem(SDL_INIT_VIDEO), or something inside
   48.68 +// SDL_CreateWindow().
   48.69 +SDL_WinRTApp ^ SDL_WinRTGlobalApp = nullptr;
   48.70 +
   48.71 +ref class SDLApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
   48.72 +{
   48.73 +public:
   48.74 +    virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
   48.75 +};
   48.76 +
   48.77 +IFrameworkView^ SDLApplicationSource::CreateView()
   48.78 +{
   48.79 +    // TODO, WinRT: see if this function (CreateView) can ever get called
   48.80 +    // more than once.  For now, just prevent it from ever assigning
   48.81 +    // SDL_WinRTGlobalApp more than once.
   48.82 +    SDL_assert(!SDL_WinRTGlobalApp);
   48.83 +    SDL_WinRTApp ^ app = ref new SDL_WinRTApp();
   48.84 +    if (!SDL_WinRTGlobalApp)
   48.85 +    {
   48.86 +        SDL_WinRTGlobalApp = app;
   48.87 +    }
   48.88 +    return app;
   48.89 +}
   48.90 +
   48.91 +int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **))
   48.92 +{
   48.93 +    WINRT_SDLAppEntryPoint = mainFunction;
   48.94 +    auto direct3DApplicationSource = ref new SDLApplicationSource();
   48.95 +    CoreApplication::Run(direct3DApplicationSource);
   48.96 +    return 0;
   48.97 +}
   48.98 +
   48.99 +static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue)
  48.100 +{
  48.101 +    SDL_assert(SDL_strcmp(name, SDL_HINT_ORIENTATIONS) == 0);
  48.102 +
  48.103 +    // Start with no orientation flags, then add each in as they're parsed
  48.104 +    // from newValue.
  48.105 +    unsigned int orientationFlags = 0;
  48.106 +    if (newValue) {
  48.107 +        std::istringstream tokenizer(newValue);
  48.108 +        while (!tokenizer.eof()) {
  48.109 +            std::string orientationName;
  48.110 +            std::getline(tokenizer, orientationName, ' ');
  48.111 +            if (orientationName == "LandscapeLeft") {
  48.112 +                orientationFlags |= (unsigned int) DisplayOrientations::LandscapeFlipped;
  48.113 +            } else if (orientationName == "LandscapeRight") {
  48.114 +                orientationFlags |= (unsigned int) DisplayOrientations::Landscape;
  48.115 +            } else if (orientationName == "Portrait") {
  48.116 +                orientationFlags |= (unsigned int) DisplayOrientations::Portrait;
  48.117 +            } else if (orientationName == "PortraitUpsideDown") {
  48.118 +                orientationFlags |= (unsigned int) DisplayOrientations::PortraitFlipped;
  48.119 +            }
  48.120 +        }
  48.121 +    }
  48.122 +
  48.123 +    // If no valid orientation flags were specified, use a reasonable set of defaults:
  48.124 +    if (!orientationFlags) {
  48.125 +        // TODO, WinRT: consider seeing if an app's default orientation flags can be found out via some API call(s).
  48.126 +        orientationFlags = (unsigned int) ( \
  48.127 +            DisplayOrientations::Landscape |
  48.128 +            DisplayOrientations::LandscapeFlipped |
  48.129 +            DisplayOrientations::Portrait |
  48.130 +            DisplayOrientations::PortraitFlipped);
  48.131 +    }
  48.132 +
  48.133 +    // Set the orientation/rotation preferences.  Please note that this does
  48.134 +    // not constitute a 100%-certain lock of a given set of possible
  48.135 +    // orientations.  According to Microsoft's documentation on WinRT [1]
  48.136 +    // when a device is not capable of being rotated, Windows may ignore
  48.137 +    // the orientation preferences, and stick to what the device is capable of
  48.138 +    // displaying.
  48.139 +    //
  48.140 +    // [1] Documentation on the 'InitialRotationPreference' setting for a
  48.141 +    // Windows app's manifest file describes how some orientation/rotation
  48.142 +    // preferences may be ignored.  See
  48.143 +    // http://msdn.microsoft.com/en-us/library/windows/apps/hh700343.aspx
  48.144 +    // for details.  Microsoft's "Display orientation sample" also gives an
  48.145 +    // outline of how Windows treats device rotation
  48.146 +    // (http://code.msdn.microsoft.com/Display-Orientation-Sample-19a58e93).
  48.147 +    DisplayProperties::AutoRotationPreferences = (DisplayOrientations) orientationFlags;
  48.148 +}
  48.149 +
  48.150 +static void
  48.151 +WINRT_ProcessWindowSizeChange()
  48.152 +{
  48.153 +    // Make the new window size be the one true fullscreen mode.
  48.154 +    // This change was initially done, in part, to allow the Direct3D 11.1
  48.155 +    // renderer to receive window-resize events as a device rotates.
  48.156 +    // Before, rotating a device from landscape, to portrait, and then
  48.157 +    // back to landscape would cause the Direct3D 11.1 swap buffer to
  48.158 +    // not get resized appropriately.  SDL would, on the rotation from
  48.159 +    // landscape to portrait, re-resize the SDL window to it's initial
  48.160 +    // size (landscape).  On the subsequent rotation, SDL would drop the
  48.161 +    // window-resize event as it appeared the SDL window didn't change
  48.162 +    // size, and the Direct3D 11.1 renderer wouldn't resize its swap
  48.163 +    // chain.
  48.164 +    SDL_DisplayMode newDisplayMode;
  48.165 +    if (WINRT_CalcDisplayModeUsingNativeWindow(&newDisplayMode) != 0) {
  48.166 +        return;
  48.167 +    }
  48.168 +
  48.169 +    // Make note of the old display mode, and it's old driverdata.
  48.170 +    SDL_DisplayMode oldDisplayMode;
  48.171 +    SDL_zero(oldDisplayMode);
  48.172 +    if (WINRT_GlobalSDLVideoDevice) {
  48.173 +        oldDisplayMode = WINRT_GlobalSDLVideoDevice->displays[0].desktop_mode;
  48.174 +    }
  48.175 +
  48.176 +    // Setup the new display mode in the appropriate spots.
  48.177 +    if (WINRT_GlobalSDLVideoDevice) {
  48.178 +        // Make a full copy of the display mode for display_modes[0],
  48.179 +        // one with with a separately malloced 'driverdata' field.
  48.180 +        // SDL_VideoQuit(), if called, will attempt to free the driverdata
  48.181 +        // fields in 'desktop_mode' and each entry in the 'display_modes'
  48.182 +        // array.
  48.183 +        if (WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0].driverdata) {
  48.184 +            // Free the previous mode's memory
  48.185 +            SDL_free(WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0].driverdata);
  48.186 +            WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0].driverdata = NULL;
  48.187 +        }
  48.188 +        if (WINRT_DuplicateDisplayMode(&(WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0]), &newDisplayMode) != 0) {
  48.189 +            // Uh oh, something went wrong.  A malloc call probably failed.
  48.190 +            SDL_free(newDisplayMode.driverdata);
  48.191 +            return;
  48.192 +        }
  48.193 +
  48.194 +        // Install 'newDisplayMode' into 'current_mode' and 'desktop_mode'.
  48.195 +        WINRT_GlobalSDLVideoDevice->displays[0].current_mode = newDisplayMode;
  48.196 +        WINRT_GlobalSDLVideoDevice->displays[0].desktop_mode = newDisplayMode;
  48.197 +    }
  48.198 +
  48.199 +    if (WINRT_GlobalSDLWindow) {
  48.200 +        // Send a window-resize event to the rest of SDL, and to apps:
  48.201 +        SDL_SendWindowEvent(
  48.202 +            WINRT_GlobalSDLWindow,
  48.203 +            SDL_WINDOWEVENT_RESIZED,
  48.204 +            newDisplayMode.w,
  48.205 +            newDisplayMode.h);
  48.206 +
  48.207 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  48.208 +        // HACK: On Windows Phone, make sure that orientation changes from
  48.209 +        // Landscape to LandscapeFlipped, Portrait to PortraitFlipped,
  48.210 +        // or vice-versa on either of those two, lead to the Direct3D renderer
  48.211 +        // getting updated.
  48.212 +        const DisplayOrientations oldOrientation = ((SDL_DisplayModeData *)oldDisplayMode.driverdata)->currentOrientation;
  48.213 +        const DisplayOrientations newOrientation = ((SDL_DisplayModeData *)newDisplayMode.driverdata)->currentOrientation;
  48.214 +
  48.215 +        if ((oldOrientation == DisplayOrientations::Landscape && newOrientation == DisplayOrientations::LandscapeFlipped) ||
  48.216 +            (oldOrientation == DisplayOrientations::LandscapeFlipped && newOrientation == DisplayOrientations::Landscape) ||
  48.217 +            (oldOrientation == DisplayOrientations::Portrait && newOrientation == DisplayOrientations::PortraitFlipped) ||
  48.218 +            (oldOrientation == DisplayOrientations::PortraitFlipped && newOrientation == DisplayOrientations::Portrait))
  48.219 +        {
  48.220 +            // One of the reasons this event is getting sent out is because SDL
  48.221 +            // will ignore requests to send out SDL_WINDOWEVENT_RESIZED events
  48.222 +            // if and when the event size doesn't change (and the Direct3D 11.1
  48.223 +            // renderer doesn't get the memo).
  48.224 +            //
  48.225 +            // Make sure that the display/window size really didn't change.  If
  48.226 +            // it did, then a SDL_WINDOWEVENT_SIZE_CHANGED event got sent, and
  48.227 +            // the Direct3D 11.1 renderer picked it up, presumably.
  48.228 +            if (oldDisplayMode.w == newDisplayMode.w &&
  48.229 +                oldDisplayMode.h == newDisplayMode.h)
  48.230 +            {
  48.231 +                SDL_SendWindowEvent(
  48.232 +                    WINRT_GlobalSDLWindow,
  48.233 +                    SDL_WINDOWEVENT_SIZE_CHANGED,
  48.234 +                    newDisplayMode.w,
  48.235 +                    newDisplayMode.h);
  48.236 +            }
  48.237 +        }
  48.238 +#endif
  48.239 +    }
  48.240 +    
  48.241 +    // Finally, free the 'driverdata' field of the old 'desktop_mode'.
  48.242 +    if (oldDisplayMode.driverdata) {
  48.243 +        SDL_free(oldDisplayMode.driverdata);
  48.244 +        oldDisplayMode.driverdata = NULL;
  48.245 +    }
  48.246 +}
  48.247 +
  48.248 +SDL_WinRTApp::SDL_WinRTApp() :
  48.249 +    m_windowClosed(false),
  48.250 +    m_windowVisible(true)
  48.251 +{
  48.252 +}
  48.253 +
  48.254 +void SDL_WinRTApp::Initialize(CoreApplicationView^ applicationView)
  48.255 +{
  48.256 +    applicationView->Activated +=
  48.257 +        ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &SDL_WinRTApp::OnActivated);
  48.258 +
  48.259 +    CoreApplication::Suspending +=
  48.260 +        ref new EventHandler<SuspendingEventArgs^>(this, &SDL_WinRTApp::OnSuspending);
  48.261 +
  48.262 +    CoreApplication::Resuming +=
  48.263 +        ref new EventHandler<Platform::Object^>(this, &SDL_WinRTApp::OnResuming);
  48.264 +
  48.265 +    CoreApplication::Exiting +=
  48.266 +        ref new EventHandler<Platform::Object^>(this, &SDL_WinRTApp::OnExiting);
  48.267 +
  48.268 +    DisplayProperties::OrientationChanged +=
  48.269 +        ref new DisplayPropertiesEventHandler(this, &SDL_WinRTApp::OnOrientationChanged);
  48.270 +
  48.271 +    // Register the hint, SDL_HINT_ORIENTATIONS, with SDL.  This needs to be
  48.272 +    // done before the hint's callback is registered (as of Feb 22, 2013),
  48.273 +    // otherwise the hint callback won't get registered.
  48.274 +    //
  48.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.
  48.276 +    //SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight Portrait PortraitUpsideDown");   // DavidL: this is no longer needed (for SDL_AddHintCallback)
  48.277 +    SDL_AddHintCallback(SDL_HINT_ORIENTATIONS, WINRT_SetDisplayOrientationsPreference, NULL);
  48.278 +}
  48.279 +
  48.280 +void SDL_WinRTApp::OnOrientationChanged(Object^ sender)
  48.281 +{
  48.282 +#if LOG_ORIENTATION_EVENTS==1
  48.283 +    CoreWindow^ window = CoreWindow::GetForCurrentThread();
  48.284 +    if (window) {
  48.285 +        SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, CoreWindow Size={%f,%f}\n",
  48.286 +            __FUNCTION__,
  48.287 +            (int)DisplayProperties::CurrentOrientation,
  48.288 +            (int)DisplayProperties::NativeOrientation,
  48.289 +            (int)DisplayProperties::AutoRotationPreferences,
  48.290 +            window->Bounds.Width,
  48.291 +            window->Bounds.Height);
  48.292 +    } else {
  48.293 +        SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d\n",
  48.294 +            __FUNCTION__,
  48.295 +            (int)DisplayProperties::CurrentOrientation,
  48.296 +            (int)DisplayProperties::NativeOrientation,
  48.297 +            (int)DisplayProperties::AutoRotationPreferences);
  48.298 +    }
  48.299 +#endif
  48.300 +
  48.301 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  48.302 +    // On Windows Phone, treat an orientation change as a change in window size.
  48.303 +    // The native window's size doesn't seem to change, however SDL will simulate
  48.304 +    // a window size change.
  48.305 +    WINRT_ProcessWindowSizeChange();
  48.306 +#endif
  48.307 +}
  48.308 +
  48.309 +void SDL_WinRTApp::SetWindow(CoreWindow^ window)
  48.310 +{
  48.311 +#if LOG_WINDOW_EVENTS==1
  48.312 +    SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, window Size={%f,%f}\n",
  48.313 +        __FUNCTION__,
  48.314 +        (int)DisplayProperties::CurrentOrientation,
  48.315 +        (int)DisplayProperties::NativeOrientation,
  48.316 +        (int)DisplayProperties::AutoRotationPreferences,
  48.317 +        window->Bounds.Width,
  48.318 +        window->Bounds.Height);
  48.319 +#endif
  48.320 +
  48.321 +    window->SizeChanged += 
  48.322 +        ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &SDL_WinRTApp::OnWindowSizeChanged);
  48.323 +
  48.324 +    window->VisibilityChanged +=
  48.325 +        ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &SDL_WinRTApp::OnVisibilityChanged);
  48.326 +
  48.327 +    window->Closed += 
  48.328 +        ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &SDL_WinRTApp::OnWindowClosed);
  48.329 +
  48.330 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
  48.331 +    window->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0);
  48.332 +#endif
  48.333 +
  48.334 +    window->PointerPressed +=
  48.335 +        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerPressed);
  48.336 +
  48.337 +    window->PointerMoved +=
  48.338 +        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerMoved);
  48.339 +
  48.340 +    window->PointerReleased +=
  48.341 +        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerReleased);
  48.342 +
  48.343 +    window->PointerWheelChanged +=
  48.344 +        ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerWheelChanged);
  48.345 +
  48.346 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
  48.347 +    // Retrieves relative-only mouse movements:
  48.348 +    Windows::Devices::Input::MouseDevice::GetForCurrentView()->MouseMoved +=
  48.349 +        ref new TypedEventHandler<MouseDevice^, MouseEventArgs^>(this, &SDL_WinRTApp::OnMouseMoved);
  48.350 +#endif
  48.351 +
  48.352 +    window->KeyDown +=
  48.353 +        ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &SDL_WinRTApp::OnKeyDown);
  48.354 +
  48.355 +    window->KeyUp +=
  48.356 +        ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &SDL_WinRTApp::OnKeyUp);
  48.357 +
  48.358 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  48.359 +    HardwareButtons::BackPressed +=
  48.360 +        ref new EventHandler<BackPressedEventArgs^>(this, &SDL_WinRTApp::OnBackButtonPressed);
  48.361 +#endif
  48.362 +
  48.363 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP  // for Windows 8/8.1/RT apps... (and not Phone apps)
  48.364 +    // Make sure we know when a user has opened the app's settings pane.
  48.365 +    // This is needed in order to display a privacy policy, which needs
  48.366 +    // to be done for network-enabled apps, as per Windows Store requirements.
  48.367 +    using namespace Windows::UI::ApplicationSettings;
  48.368 +    SettingsPane::GetForCurrentView()->CommandsRequested +=
  48.369 +        ref new TypedEventHandler<SettingsPane^, SettingsPaneCommandsRequestedEventArgs^>
  48.370 +            (this, &SDL_WinRTApp::OnSettingsPaneCommandsRequested);
  48.371 +#endif
  48.372 +}
  48.373 +
  48.374 +void SDL_WinRTApp::Load(Platform::String^ entryPoint)
  48.375 +{
  48.376 +}
  48.377 +
  48.378 +void SDL_WinRTApp::Run()
  48.379 +{
  48.380 +    SDL_SetMainReady();
  48.381 +    if (WINRT_SDLAppEntryPoint)
  48.382 +    {
  48.383 +        // TODO, WinRT: pass the C-style main() a reasonably realistic
  48.384 +        // representation of command line arguments.
  48.385 +        int argc = 0;
  48.386 +        char **argv = NULL;
  48.387 +        WINRT_SDLAppEntryPoint(argc, argv);
  48.388 +    }
  48.389 +}
  48.390 +
  48.391 +void SDL_WinRTApp::PumpEvents()
  48.392 +{
  48.393 +    if (!m_windowClosed)
  48.394 +    {
  48.395 +        if (m_windowVisible)
  48.396 +        {
  48.397 +            CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
  48.398 +        }
  48.399 +        else
  48.400 +        {
  48.401 +            CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending);
  48.402 +        }
  48.403 +    }
  48.404 +}
  48.405 +
  48.406 +void SDL_WinRTApp::Uninitialize()
  48.407 +{
  48.408 +}
  48.409 +
  48.410 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
  48.411 +void SDL_WinRTApp::OnSettingsPaneCommandsRequested(
  48.412 +    Windows::UI::ApplicationSettings::SettingsPane ^p,
  48.413 +    Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args)
  48.414 +{
  48.415 +    using namespace Platform;
  48.416 +    using namespace Windows::UI::ApplicationSettings;
  48.417 +    using namespace Windows::UI::Popups;
  48.418 +
  48.419 +    String ^privacyPolicyURL = nullptr;     // a URL to an app's Privacy Policy
  48.420 +    String ^privacyPolicyLabel = nullptr;   // label/link text
  48.421 +    const char *tmpHintValue = NULL;        // SDL_GetHint-retrieved value, used immediately
  48.422 +    wchar_t *tmpStr = NULL;                 // used for UTF8 to UCS2 conversion
  48.423 +
  48.424 +    // Setup a 'Privacy Policy' link, if one is available (via SDL_GetHint):
  48.425 +    tmpHintValue = SDL_GetHint(SDL_HINT_WINRT_PRIVACY_POLICY_URL);
  48.426 +    if (tmpHintValue && tmpHintValue[0] != '\0') {
  48.427 +        // Convert the privacy policy's URL to UCS2:
  48.428 +        tmpStr = WIN_UTF8ToString(tmpHintValue);
  48.429 +        privacyPolicyURL = ref new String(tmpStr);
  48.430 +        SDL_free(tmpStr);
  48.431 +
  48.432 +        // Optionally retrieve custom label-text for the link.  If this isn't
  48.433 +        // available, a default value will be used instead.
  48.434 +        tmpHintValue = SDL_GetHint(SDL_HINT_WINRT_PRIVACY_POLICY_LABEL);
  48.435 +        if (tmpHintValue && tmpHintValue[0] != '\0') {
  48.436 +            tmpStr = WIN_UTF8ToString(tmpHintValue);
  48.437 +            privacyPolicyLabel = ref new String(tmpStr);
  48.438 +            SDL_free(tmpStr);
  48.439 +        } else {
  48.440 +            privacyPolicyLabel = ref new String(L"Privacy Policy");
  48.441 +        }
  48.442 +
  48.443 +        // Register the link, along with a handler to be called if and when it is
  48.444 +        // clicked:
  48.445 +        auto cmd = ref new SettingsCommand(L"privacyPolicy", privacyPolicyLabel,
  48.446 +            ref new UICommandInvokedHandler([=](IUICommand ^) {
  48.447 +                Windows::System::Launcher::LaunchUriAsync(ref new Uri(privacyPolicyURL));
  48.448 +        }));
  48.449 +        args->Request->ApplicationCommands->Append(cmd);
  48.450 +    }
  48.451 +}
  48.452 +#endif // if WINAPI_FAMILY == WINAPI_FAMILY_APP
  48.453 +
  48.454 +void SDL_WinRTApp::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args)
  48.455 +{
  48.456 +#if LOG_WINDOW_EVENTS==1
  48.457 +    SDL_Log("%s, size={%f,%f}, current orientation=%d, native orientation=%d, auto rot. pref=%d, WINRT_GlobalSDLWindow?=%s\n",
  48.458 +        __FUNCTION__,
  48.459 +        args->Size.Width, args->Size.Height,
  48.460 +        (int)DisplayProperties::CurrentOrientation,
  48.461 +        (int)DisplayProperties::NativeOrientation,
  48.462 +        (int)DisplayProperties::AutoRotationPreferences,
  48.463 +        (WINRT_GlobalSDLWindow ? "yes" : "no"));
  48.464 +#endif
  48.465 +
  48.466 +    WINRT_ProcessWindowSizeChange();
  48.467 +}
  48.468 +
  48.469 +void SDL_WinRTApp::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args)
  48.470 +{
  48.471 +#if LOG_WINDOW_EVENTS==1
  48.472 +    SDL_Log("%s, visible?=%s, WINRT_GlobalSDLWindow?=%s\n",
  48.473 +        __FUNCTION__,
  48.474 +        (args->Visible ? "yes" : "no"),
  48.475 +        (WINRT_GlobalSDLWindow ? "yes" : "no"));
  48.476 +#endif
  48.477 +
  48.478 +    m_windowVisible = args->Visible;
  48.479 +    if (WINRT_GlobalSDLWindow) {
  48.480 +        SDL_bool wasSDLWindowSurfaceValid = WINRT_GlobalSDLWindow->surface_valid;
  48.481 +
  48.482 +        if (args->Visible) {
  48.483 +            SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_SHOWN, 0, 0);
  48.484 +        } else {
  48.485 +            SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_WINDOWEVENT_HIDDEN, 0, 0);
  48.486 +        }
  48.487 +
  48.488 +        // HACK: Prevent SDL's window-hide handling code, which currently
  48.489 +        // triggers a fake window resize (possibly erronously), from
  48.490 +        // marking the SDL window's surface as invalid.
  48.491 +        //
  48.492 +        // A better solution to this probably involves figuring out if the
  48.493 +        // fake window resize can be prevented.
  48.494 +        WINRT_GlobalSDLWindow->surface_valid = wasSDLWindowSurfaceValid;
  48.495 +    }
  48.496 +}
  48.497 +
  48.498 +void SDL_WinRTApp::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
  48.499 +{
  48.500 +#if LOG_WINDOW_EVENTS==1
  48.501 +    SDL_Log("%s\n", __FUNCTION__);
  48.502 +#endif
  48.503 +    m_windowClosed = true;
  48.504 +}
  48.505 +
  48.506 +void SDL_WinRTApp::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
  48.507 +{
  48.508 +    CoreWindow::GetForCurrentThread()->Activate();
  48.509 +}
  48.510 +
  48.511 +static int SDLCALL RemoveAppSuspendAndResumeEvents(void * userdata, SDL_Event * event)
  48.512 +{
  48.513 +    if (event->type == SDL_WINDOWEVENT)
  48.514 +    {
  48.515 +        switch (event->window.event)
  48.516 +        {
  48.517 +            case SDL_WINDOWEVENT_MINIMIZED:
  48.518 +            case SDL_WINDOWEVENT_RESTORED:
  48.519 +                // Return 0 to indicate that the event should be removed from the
  48.520 +                // event queue:
  48.521 +                return 0;
  48.522 +            default:
  48.523 +                break;
  48.524 +        }
  48.525 +    }
  48.526 +
  48.527 +    // Return 1 to indicate that the event should stay in the event queue:
  48.528 +    return 1;
  48.529 +}
  48.530 +
  48.531 +void SDL_WinRTApp::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args)
  48.532 +{
  48.533 +    // Save app state asynchronously after requesting a deferral. Holding a deferral
  48.534 +    // indicates that the application is busy performing suspending operations. Be
  48.535 +    // aware that a deferral may not be held indefinitely. After about five seconds,
  48.536 +    // the app will be forced to exit.
  48.537 +    SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral();
  48.538 +    create_task([this, deferral]()
  48.539 +    {
  48.540 +        // Send a window-minimized event immediately to observers.
  48.541 +        // CoreDispatcher::ProcessEvents, which is the backbone on which
  48.542 +        // SDL_WinRTApp::PumpEvents is built, will not return to its caller
  48.543 +        // once it sends out a suspend event.  Any events posted to SDL's
  48.544 +        // event queue won't get received until the WinRT app is resumed.
  48.545 +        // SDL_AddEventWatch() may be used to receive app-suspend events on
  48.546 +        // WinRT.
  48.547 +        //
  48.548 +        // In order to prevent app-suspend events from being received twice:
  48.549 +        // first via a callback passed to SDL_AddEventWatch, and second via
  48.550 +        // SDL's event queue, the event will be sent to SDL, then immediately
  48.551 +        // removed from the queue.
  48.552 +        if (WINRT_GlobalSDLWindow)
  48.553 +        {
  48.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)
  48.555 +            SDL_FilterEvents(RemoveAppSuspendAndResumeEvents, 0);
  48.556 +        }
  48.557 +
  48.558 +        SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
  48.559 +        SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
  48.560 +
  48.561 +        deferral->Complete();
  48.562 +    });
  48.563 +}
  48.564 +
  48.565 +void SDL_WinRTApp::OnResuming(Platform::Object^ sender, Platform::Object^ args)
  48.566 +{
  48.567 +    SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
  48.568 +    SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
  48.569 +
  48.570 +    // Restore any data or state that was unloaded on suspend. By default, data
  48.571 +    // and state are persisted when resuming from suspend. Note that this event
  48.572 +    // does not occur if the app was previously terminated.
  48.573 +    if (WINRT_GlobalSDLWindow)
  48.574 +    {
  48.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)
  48.576 +
  48.577 +        // Remove the app-resume event from the queue, as is done with the
  48.578 +        // app-suspend event.
  48.579 +        //
  48.580 +        // TODO, WinRT: consider posting this event to the queue even though
  48.581 +        // its counterpart, the app-suspend event, effectively has to be
  48.582 +        // processed immediately.
  48.583 +        SDL_FilterEvents(RemoveAppSuspendAndResumeEvents, 0);
  48.584 +    }
  48.585 +}
  48.586 +
  48.587 +void SDL_WinRTApp::OnExiting(Platform::Object^ sender, Platform::Object^ args)
  48.588 +{
  48.589 +    SDL_SendAppEvent(SDL_APP_TERMINATING);
  48.590 +}
  48.591 +
  48.592 +static void
  48.593 +WINRT_LogPointerEvent(const char * header, Windows::UI::Core::PointerEventArgs ^ args, Windows::Foundation::Point transformedPoint)
  48.594 +{
  48.595 +    Windows::UI::Input::PointerPoint ^ pt = args->CurrentPoint;
  48.596 +    SDL_Log("%s: Position={%f,%f}, Transformed Pos={%f, %f}, MouseWheelDelta=%d, FrameId=%d, PointerId=%d, SDL button=%d\n",
  48.597 +        header,
  48.598 +        pt->Position.X, pt->Position.Y,
  48.599 +        transformedPoint.X, transformedPoint.Y,
  48.600 +        pt->Properties->MouseWheelDelta,
  48.601 +        pt->FrameId,
  48.602 +        pt->PointerId,
  48.603 +        WINRT_GetSDLButtonForPointerPoint(pt));
  48.604 +}
  48.605 +
  48.606 +void SDL_WinRTApp::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args)
  48.607 +{
  48.608 +#if LOG_POINTER_EVENTS
  48.609 +    WINRT_LogPointerEvent("pointer pressed", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
  48.610 +#endif
  48.611 +
  48.612 +    WINRT_ProcessPointerPressedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
  48.613 +}
  48.614 +
  48.615 +void SDL_WinRTApp::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args)
  48.616 +{
  48.617 +#if LOG_POINTER_EVENTS
  48.618 +    WINRT_LogPointerEvent("pointer moved", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
  48.619 +#endif
  48.620 +
  48.621 +    WINRT_ProcessPointerMovedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
  48.622 +}
  48.623 +
  48.624 +void SDL_WinRTApp::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args)
  48.625 +{
  48.626 +#if LOG_POINTER_EVENTS
  48.627 +    WINRT_LogPointerEvent("pointer released", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
  48.628 +#endif
  48.629 +
  48.630 +    WINRT_ProcessPointerReleasedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
  48.631 +}
  48.632 +
  48.633 +void SDL_WinRTApp::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args)
  48.634 +{
  48.635 +#if LOG_POINTER_EVENTS
  48.636 +    WINRT_LogPointerEvent("pointer wheel changed", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize));
  48.637 +#endif
  48.638 +
  48.639 +    WINRT_ProcessPointerWheelChangedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint);
  48.640 +}
  48.641 +
  48.642 +void SDL_WinRTApp::OnMouseMoved(MouseDevice^ mouseDevice, MouseEventArgs^ args)
  48.643 +{
  48.644 +    WINRT_ProcessMouseMovedEvent(WINRT_GlobalSDLWindow, args);
  48.645 +}
  48.646 +
  48.647 +void SDL_WinRTApp::OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args)
  48.648 +{
  48.649 +    WINRT_ProcessKeyDownEvent(args);
  48.650 +}
  48.651 +
  48.652 +void SDL_WinRTApp::OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args)
  48.653 +{
  48.654 +    WINRT_ProcessKeyUpEvent(args);
  48.655 +}
  48.656 +
  48.657 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  48.658 +void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args)
  48.659 +{
  48.660 +    SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_AC_BACK);
  48.661 +    SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_AC_BACK);
  48.662 +
  48.663 +    const char *hint = SDL_GetHint(SDL_HINT_WINRT_HANDLE_BACK_BUTTON);
  48.664 +    if (hint) {
  48.665 +        if (*hint == '1') {
  48.666 +            args->Handled = true;
  48.667 +        }
  48.668 +    }
  48.669 +}
  48.670 +#endif
  48.671 +
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/src/core/winrt/SDL_winrtapp_direct3d.h	Sun Mar 09 11:36:47 2014 -0700
    49.3 @@ -0,0 +1,58 @@
    49.4 +#pragma once
    49.5 +
    49.6 +#include <Windows.h>
    49.7 +
    49.8 +extern int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **));
    49.9 +
   49.10 +ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFrameworkView
   49.11 +{
   49.12 +public:
   49.13 +    SDL_WinRTApp();
   49.14 +    
   49.15 +    // IFrameworkView Methods.
   49.16 +    virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
   49.17 +    virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
   49.18 +    virtual void Load(Platform::String^ entryPoint);
   49.19 +    virtual void Run();
   49.20 +    virtual void Uninitialize();
   49.21 +
   49.22 +internal:
   49.23 +    // SDL-specific methods
   49.24 +    void PumpEvents();
   49.25 +
   49.26 +protected:
   49.27 +    // Event Handlers.
   49.28 +
   49.29 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP  // for Windows 8/8.1/RT apps... (and not Phone apps)
   49.30 +    void OnSettingsPaneCommandsRequested(
   49.31 +        Windows::UI::ApplicationSettings::SettingsPane ^p,
   49.32 +        Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args);
   49.33 +#endif // if WINAPI_FAMILY == WINAPI_FAMILY_APP
   49.34 +
   49.35 +    void OnOrientationChanged(Platform::Object^ sender);
   49.36 +    void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
   49.37 +    void OnLogicalDpiChanged(Platform::Object^ sender);
   49.38 +    void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
   49.39 +    void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
   49.40 +    void OnResuming(Platform::Object^ sender, Platform::Object^ args);
   49.41 +    void OnExiting(Platform::Object^ sender, Platform::Object^ args);
   49.42 +    void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
   49.43 +    void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
   49.44 +    void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
   49.45 +    void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
   49.46 +    void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
   49.47 +    void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
   49.48 +    void OnMouseMoved(Windows::Devices::Input::MouseDevice^ mouseDevice, Windows::Devices::Input::MouseEventArgs^ args);
   49.49 +    void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
   49.50 +    void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
   49.51 +
   49.52 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
   49.53 +    void OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args);
   49.54 +#endif
   49.55 +
   49.56 +private:
   49.57 +    bool m_windowClosed;
   49.58 +    bool m_windowVisible;
   49.59 +};
   49.60 +
   49.61 +extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/src/core/winrt/SDL_winrtapp_xaml.cpp	Sun Mar 09 11:36:47 2014 -0700
    50.3 @@ -0,0 +1,158 @@
    50.4 +/*
    50.5 +  Simple DirectMedia Layer
    50.6 +  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    50.7 +
    50.8 +  This software is provided 'as-is', without any express or implied
    50.9 +  warranty.  In no event will the authors be held liable for any damages
   50.10 +  arising from the use of this software.
   50.11 +
   50.12 +  Permission is granted to anyone to use this software for any purpose,
   50.13 +  including commercial applications, and to alter it and redistribute it
   50.14 +  freely, subject to the following restrictions:
   50.15 +
   50.16 +  1. The origin of this software must not be misrepresented; you must not
   50.17 +     claim that you wrote the original software. If you use this software
   50.18 +     in a product, an acknowledgment in the product documentation would be
   50.19 +     appreciated but is not required.
   50.20 +  2. Altered source versions must be plainly marked as such, and must not be
   50.21 +     misrepresented as being the original software.
   50.22 +  3. This notice may not be removed or altered from any source distribution.
   50.23 +*/
   50.24 +
   50.25 +/* Windows includes */
   50.26 +#include <agile.h>
   50.27 +#include <Windows.h>
   50.28 +
   50.29 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
   50.30 +#include <windows.ui.xaml.media.dxinterop.h>
   50.31 +#endif
   50.32 +
   50.33 +
   50.34 +/* SDL includes */
   50.35 +#include "SDL.h"
   50.36 +#include "../../video/winrt/SDL_winrtevents_c.h"
   50.37 +#include "../../video/winrt/SDL_winrtvideo_cpp.h"
   50.38 +#include "SDL_winrtapp_common.h"
   50.39 +#include "SDL_winrtapp_xaml.h"
   50.40 +
   50.41 +
   50.42 +
   50.43 +/* SDL-internal globals: */
   50.44 +SDL_bool WINRT_XAMLWasEnabled = SDL_FALSE;
   50.45 +
   50.46 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
   50.47 +ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative = NULL;
   50.48 +static Windows::Foundation::EventRegistrationToken	WINRT_XAMLAppEventToken;
   50.49 +#endif
   50.50 +
   50.51 +
   50.52 +/*
   50.53 + * Input event handlers (XAML)
   50.54 + */
   50.55 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
   50.56 +
   50.57 +static void
   50.58 +WINRT_OnPointerPressedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
   50.59 +{
   50.60 +    WINRT_ProcessPointerPressedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr));
   50.61 +}
   50.62 +
   50.63 +static void
   50.64 +WINRT_OnPointerMovedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
   50.65 +{
   50.66 +    WINRT_ProcessPointerMovedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr));
   50.67 +}
   50.68 +
   50.69 +static void
   50.70 +WINRT_OnPointerReleasedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
   50.71 +{
   50.72 +    WINRT_ProcessPointerReleasedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr));
   50.73 +}
   50.74 +
   50.75 +static void
   50.76 +WINRT_OnPointerWheelChangedViaXAML(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
   50.77 +{
   50.78 +    WINRT_ProcessPointerWheelChangedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr));
   50.79 +}
   50.80 +
   50.81 +#endif // WINAPI_FAMILY == WINAPI_FAMILY_APP
   50.82 +
   50.83 +
   50.84 +/*
   50.85 + * XAML-to-SDL Rendering Callback
   50.86 + */
   50.87 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
   50.88 +
   50.89 +static void
   50.90 +WINRT_OnRenderViaXAML(_In_ Platform::Object^ sender, _In_ Platform::Object^ args)
   50.91 +{
   50.92 +    WINRT_CycleXAMLThread();
   50.93 +}
   50.94 +
   50.95 +#endif // WINAPI_FAMILY == WINAPI_FAMILY_APP
   50.96 +
   50.97 +
   50.98 +/*
   50.99 + * SDL + XAML Initialization
  50.100 + */
  50.101 +
  50.102 +int
  50.103 +SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAsIInspectable)
  50.104 +{
  50.105 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  50.106 +    return SDL_SetError("XAML support is not yet available in Windows Phone.");
  50.107 +#else
  50.108 +    // Declare C++/CX namespaces:
  50.109 +    using namespace Platform;
  50.110 +    using namespace Windows::Foundation;
  50.111 +    using namespace Windows::UI::Core;
  50.112 +    using namespace Windows::UI::Xaml;
  50.113 +    using namespace Windows::UI::Xaml::Controls;
  50.114 +    using namespace Windows::UI::Xaml::Input;
  50.115 +    using namespace Windows::UI::Xaml::Media;
  50.116 +
  50.117 +    // Make sure we have a valid XAML element (to draw onto):
  50.118 +    if ( ! backgroundPanelAsIInspectable) {
  50.119 +        return SDL_SetError("'backgroundPanelAsIInspectable' can't be NULL");
  50.120 +    }
  50.121 +
  50.122 +    Platform::Object ^ backgroundPanel = reinterpret_cast<Object ^>((IInspectable *) backgroundPanelAsIInspectable);
  50.123 +    SwapChainBackgroundPanel ^swapChainBackgroundPanel = dynamic_cast<SwapChainBackgroundPanel ^>(backgroundPanel);
  50.124 +    if ( ! swapChainBackgroundPanel) {
  50.125 +        return SDL_SetError("An unknown or unsupported type of XAML control was specified.");
  50.126 +    }
  50.127 +
  50.128 +    // Setup event handlers:
  50.129 +    swapChainBackgroundPanel->PointerPressed += ref new PointerEventHandler(WINRT_OnPointerPressedViaXAML);
  50.130 +    swapChainBackgroundPanel->PointerReleased += ref new PointerEventHandler(WINRT_OnPointerReleasedViaXAML);
  50.131 +    swapChainBackgroundPanel->PointerWheelChanged += ref new PointerEventHandler(WINRT_OnPointerWheelChangedViaXAML);
  50.132 +    swapChainBackgroundPanel->PointerMoved += ref new PointerEventHandler(WINRT_OnPointerMovedViaXAML);
  50.133 +
  50.134 +    // Setup for rendering:
  50.135 +    IInspectable *panelInspectable = (IInspectable*) reinterpret_cast<IInspectable*>(swapChainBackgroundPanel);
  50.136 +    panelInspectable->QueryInterface(__uuidof(ISwapChainBackgroundPanelNative), (void **)&WINRT_GlobalSwapChainBackgroundPanelNative);
  50.137 +
  50.138 +    WINRT_XAMLAppEventToken = CompositionTarget::Rendering::add(ref new EventHandler<Object^>(WINRT_OnRenderViaXAML));
  50.139 +
  50.140 +    // Make sure the app is ready to call the SDL-centric main() function:
  50.141 +    WINRT_SDLAppEntryPoint = mainFunction;
  50.142 +    SDL_SetMainReady();
  50.143 +
  50.144 +    // Make sure video-init knows that we're initializing XAML:
  50.145 +    SDL_bool oldXAMLWasEnabledValue = WINRT_XAMLWasEnabled;
  50.146 +    WINRT_XAMLWasEnabled = SDL_TRUE;
  50.147 +
  50.148 +    // Make sure video modes are detected now, while we still have access to the WinRT
  50.149 +    // CoreWindow.  WinRT will not allow the app's CoreWindow to be accessed via the
  50.150 +    // SDL/WinRT thread.
  50.151 +    if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) {
  50.152 +        // SDL_InitSubSystem will, on error, set the SDL error.  Let that propogate to
  50.153 +        // the caller to here:
  50.154 +        WINRT_XAMLWasEnabled = oldXAMLWasEnabledValue;
  50.155 +        return -1;
  50.156 +    }
  50.157 +
  50.158 +    // All done, for now.
  50.159 +    return 0;
  50.160 +#endif // WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP  /  else
  50.161 +}
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/src/core/winrt/SDL_winrtapp_xaml.h	Sun Mar 09 11:36:47 2014 -0700
    51.3 @@ -0,0 +1,33 @@
    51.4 +/*
    51.5 +  Simple DirectMedia Layer
    51.6 +  Copyright (C) 1997-2012 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 +#ifndef _SDL_winrtapp_xaml_h
   51.27 +#define _SDL_winrtapp_xaml_h
   51.28 +
   51.29 +#include "SDL_types.h"
   51.30 +
   51.31 +#ifdef __cplusplus
   51.32 +extern SDL_bool WINRT_XAMLWasEnabled;
   51.33 +extern int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAsIInspectable);
   51.34 +#endif // ifdef __cplusplus
   51.35 +
   51.36 +#endif // ifndef _SDL_winrtapp_xaml_h
    53.1 --- a/src/file/SDL_rwops.c	Sun Mar 09 10:38:30 2014 -0700
    53.2 +++ b/src/file/SDL_rwops.c	Sun Mar 09 11:36:47 2014 -0700
    53.3 @@ -316,6 +316,10 @@
    53.4      if (fseeko(context->hidden.stdio.fp, (off_t)offset, whence) == 0) {
    53.5          return ftello(context->hidden.stdio.fp);
    53.6      }
    53.7 +#elif defined(HAVE__FSEEKI64)
    53.8 +    if (_fseeki64(context->hidden.stdio.fp, offset, whence) == 0) {
    53.9 +        return _ftelli64(context->hidden.stdio.fp);
   53.10 +    }
   53.11  #else
   53.12      if (fseek(context->hidden.stdio.fp, offset, whence) == 0) {
   53.13          return ftell(context->hidden.stdio.fp);
   53.14 @@ -522,6 +526,9 @@
   53.15      {
   53.16          #ifdef __APPLE__
   53.17          FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode);
   53.18 +        #elif __WINRT__
   53.19 +        FILE *fp = NULL;
   53.20 +        fopen_s(&fp, file, mode);
   53.21          #else
   53.22          FILE *fp = fopen(file, mode);
   53.23          #endif
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/src/filesystem/winrt/SDL_sysfilesystem.cpp	Sun Mar 09 11:36:47 2014 -0700
    54.3 @@ -0,0 +1,154 @@
    54.4 +/* TODO, WinRT: include copyright info in SDL_winrtpaths.cpp
    54.5 +   TODO, WinRT: remove the need to compile this with C++/CX (/ZW) extensions, and if possible, without C++ at all
    54.6 +*/
    54.7 +
    54.8 +#include "SDL_config.h"
    54.9 +
   54.10 +#ifdef __WINRT__
   54.11 +
   54.12 +extern "C" {
   54.13 +#include "SDL_filesystem.h"
   54.14 +#include "SDL_error.h"
   54.15 +#include "SDL_stdinc.h"
   54.16 +#include "SDL_system.h"
   54.17 +#include "../../core/windows/SDL_windows.h"
   54.18 +}
   54.19 +
   54.20 +#include <string>
   54.21 +#include <unordered_map>
   54.22 +
   54.23 +using namespace std;
   54.24 +using namespace Windows::Storage;
   54.25 +
   54.26 +extern "C" const wchar_t *
   54.27 +SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType)
   54.28 +{
   54.29 +    switch (pathType) {
   54.30 +        case SDL_WINRT_PATH_INSTALLED_LOCATION:
   54.31 +        {
   54.32 +            static wstring path;
   54.33 +            if (path.empty()) {
   54.34 +                path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data();
   54.35 +            }
   54.36 +            return path.c_str();
   54.37 +        }
   54.38 +
   54.39 +        case SDL_WINRT_PATH_LOCAL_FOLDER:
   54.40 +        {
   54.41 +            static wstring path;
   54.42 +            if (path.empty()) {
   54.43 +                path = ApplicationData::Current->LocalFolder->Path->Data();
   54.44 +            }
   54.45 +            return path.c_str();
   54.46 +        }
   54.47 +
   54.48 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
   54.49 +        case SDL_WINRT_PATH_ROAMING_FOLDER:
   54.50 +        {
   54.51 +            static wstring path;
   54.52 +            if (path.empty()) {
   54.53 +                path = ApplicationData::Current->RoamingFolder->Path->Data();
   54.54 +            }
   54.55 +            return path.c_str();
   54.56 +        }
   54.57 +
   54.58 +        case SDL_WINRT_PATH_TEMP_FOLDER:
   54.59 +        {
   54.60 +            static wstring path;
   54.61 +            if (path.empty()) {
   54.62 +                path = ApplicationData::Current->TemporaryFolder->Path->Data();
   54.63 +            }
   54.64 +            return path.c_str();
   54.65 +        }
   54.66 +#endif
   54.67 +
   54.68 +        default:
   54.69 +            break;
   54.70 +    }
   54.71 +
   54.72 +    SDL_Unsupported();
   54.73 +    return NULL;
   54.74 +}
   54.75 +
   54.76 +extern "C" const char *
   54.77 +SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType)
   54.78 +{
   54.79 +    typedef unordered_map<SDL_WinRT_Path, string> UTF8PathMap;
   54.80 +    static UTF8PathMap utf8Paths;
   54.81 +
   54.82 +    UTF8PathMap::iterator searchResult = utf8Paths.find(pathType);
   54.83 +    if (searchResult != utf8Paths.end()) {
   54.84 +        return searchResult->second.c_str();
   54.85 +    }
   54.86 +
   54.87 +    const wchar_t * ucs2Path = SDL_WinRTGetFSPathUNICODE(pathType);
   54.88 +    if (!ucs2Path) {
   54.89 +        return NULL;
   54.90 +    }
   54.91 +
   54.92 +    char * utf8Path = WIN_StringToUTF8(ucs2Path);
   54.93 +    utf8Paths[pathType] = utf8Path;
   54.94 +    SDL_free(utf8Path);
   54.95 +    return utf8Paths[pathType].c_str();
   54.96 +}
   54.97 +
   54.98 +extern "C" char *
   54.99 +SDL_GetBasePath(void)
  54.100 +{
  54.101 +    const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_INSTALLED_LOCATION);
  54.102 +    size_t destPathLen;
  54.103 +    char * destPath = NULL;
  54.104 +
  54.105 +    if (!srcPath) {
  54.106 +        SDL_SetError("Couldn't locate our basepath: %s", SDL_GetError());
  54.107 +        return NULL;
  54.108 +    }
  54.109 +
  54.110 +    destPathLen = SDL_strlen(srcPath) + 2;
  54.111 +    destPath = (char *) SDL_malloc(destPathLen);
  54.112 +    if (!destPath) {
  54.113 +        SDL_OutOfMemory();
  54.114 +        return NULL;
  54.115 +    }
  54.116 +
  54.117 +    SDL_snprintf(destPath, destPathLen, "%s\\", srcPath);
  54.118 +    return destPath;
  54.119 +}
  54.120 +
  54.121 +extern "C" char *
  54.122 +SDL_GetPrefPath(const char *org, const char *app)
  54.123 +{
  54.124 +    /* WinRT note: The 'SHGetFolderPath' API that is used in Windows 7 and
  54.125 +     * earlier is not available on WinRT or Windows Phone.  WinRT provides
  54.126 +     * a similar API, but SHGetFolderPath can't be called, at least not
  54.127 +     * without violating Microsoft's app-store requirements.
  54.128 +     */
  54.129 +
  54.130 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  54.131 +    /* A 'Roaming' folder is not available in Windows Phone 8, however a 'Local' folder is. */
  54.132 +    const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_LOCAL_FOLDER);
  54.133 +#else
  54.134 +    /* A 'Roaming' folder is available on Windows 8 and 8.1.  Use that. */
  54.135 +    const char * srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_ROAMING_FOLDER);
  54.136 +#endif
  54.137 +
  54.138 +    size_t destPathLen;
  54.139 +    char * destPath = NULL;
  54.140 +
  54.141 +    if (!srcPath) {
  54.142 +        SDL_SetError("Couldn't locate our basepath: %s", SDL_GetError());
  54.143 +        return NULL;
  54.144 +    }
  54.145 +
  54.146 +    destPathLen = SDL_strlen(srcPath) + SDL_strlen(org) + SDL_strlen(app) + 4;
  54.147 +    destPath = (char *) SDL_malloc(destPathLen);
  54.148 +    if (!destPath) {
  54.149 +        SDL_OutOfMemory();
  54.150 +        return NULL;
  54.151 +    }
  54.152 +
  54.153 +    SDL_snprintf(destPath, destPathLen, "%s\\%s\\%s\\", srcPath, org, app);
  54.154 +    return destPath;
  54.155 +}
  54.156 +
  54.157 +#endif /* __WINRT__ */
    55.1 --- a/src/joystick/SDL_gamecontroller.c	Sun Mar 09 10:38:30 2014 -0700
    55.2 +++ b/src/joystick/SDL_gamecontroller.c	Sun Mar 09 11:36:47 2014 -0700
    55.3 @@ -88,7 +88,7 @@
    55.4  } ControllerMapping_t;
    55.5  
    55.6  static ControllerMapping_t *s_pSupportedControllers = NULL;
    55.7 -#ifdef SDL_JOYSTICK_DINPUT
    55.8 +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
    55.9  static ControllerMapping_t *s_pXInputMapping = NULL;
   55.10  #endif
   55.11  
   55.12 @@ -279,7 +279,7 @@
   55.13   */
   55.14  ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index)
   55.15  {
   55.16 -#ifdef SDL_JOYSTICK_DINPUT
   55.17 +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
   55.18      if ( SDL_SYS_IsXInputDeviceIndex(device_index) && s_pXInputMapping )
   55.19      {
   55.20          return s_pXInputMapping;
   55.21 @@ -737,7 +737,7 @@
   55.22      char *pchMapping;
   55.23      SDL_JoystickGUID jGUID;
   55.24      ControllerMapping_t *pControllerMapping;
   55.25 -#ifdef SDL_JOYSTICK_DINPUT
   55.26 +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
   55.27      SDL_bool is_xinput_mapping = SDL_FALSE;
   55.28  #endif
   55.29  
   55.30 @@ -745,7 +745,7 @@
   55.31      if (!pchGUID) {
   55.32          return SDL_SetError("Couldn't parse GUID from %s", mappingString);
   55.33      }
   55.34 -#ifdef SDL_JOYSTICK_DINPUT
   55.35 +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
   55.36      if ( !SDL_strcasecmp( pchGUID, "xinput" ) ) {
   55.37          is_xinput_mapping = SDL_TRUE;
   55.38      }
   55.39 @@ -782,7 +782,7 @@
   55.40              SDL_free( pchMapping );
   55.41              return SDL_OutOfMemory();
   55.42          }
   55.43 -#ifdef SDL_JOYSTICK_DINPUT
   55.44 +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
   55.45          if ( is_xinput_mapping )
   55.46          {
   55.47              s_pXInputMapping = pControllerMapping;
    56.1 --- a/src/joystick/SDL_gamecontrollerdb.h	Sun Mar 09 10:38:30 2014 -0700
    56.2 +++ b/src/joystick/SDL_gamecontrollerdb.h	Sun Mar 09 11:36:47 2014 -0700
    56.3 @@ -42,6 +42,8 @@
    56.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,",
    56.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,",
    56.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,",
    56.7 +#elif defined(SDL_JOYSTICK_XINPUT)
    56.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,",
    56.9  #elif defined(__MACOSX__)
   56.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,",
   56.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. */
    57.1 --- a/src/joystick/SDL_sysjoystick.h	Sun Mar 09 10:38:30 2014 -0700
    57.2 +++ b/src/joystick/SDL_sysjoystick.h	Sun Mar 09 11:36:47 2014 -0700
    57.3 @@ -108,7 +108,7 @@
    57.4  /* Function to return the stable GUID for a opened joystick */
    57.5  extern SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick);
    57.6  
    57.7 -#ifdef SDL_JOYSTICK_DINPUT
    57.8 +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT)
    57.9  /* Function to get the current instance id of the joystick located at device_index */
   57.10  extern SDL_bool SDL_SYS_IsXInputDeviceIndex( int device_index );
   57.11  extern SDL_bool SDL_SYS_IsXInputJoystick(SDL_Joystick * joystick);
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/src/joystick/winrt/SDL_xinputjoystick.c	Sun Mar 09 11:36:47 2014 -0700
    59.3 @@ -0,0 +1,537 @@
    59.4 +/*
    59.5 +  Simple DirectMedia Layer
    59.6 +  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    59.7 +
    59.8 +  This software is provided 'as-is', without any express or implied
    59.9 +  warranty.  In no event will the authors be held liable for any damages
   59.10 +  arising from the use of this software.
   59.11 +
   59.12 +  Permission is granted to anyone to use this software for any purpose,
   59.13 +  including commercial applications, and to alter it and redistribute it
   59.14 +  freely, subject to the following restrictions:
   59.15 +
   59.16 +  1. The origin of this software must not be misrepresented; you must not
   59.17 +     claim that you wrote the original software. If you use this software
   59.18 +     in a product, an acknowledgment in the product documentation would be
   59.19 +     appreciated but is not required.
   59.20 +  2. Altered source versions must be plainly marked as such, and must not be
   59.21 +     misrepresented as being the original software.
   59.22 +  3. This notice may not be removed or altered from any source distribution.
   59.23 +*/
   59.24 +#include "SDL_config.h"
   59.25 +
   59.26 +#if SDL_JOYSTICK_XINPUT
   59.27 +
   59.28 +/* SDL_xinputjoystick.c implements an XInput-only joystick and game controller
   59.29 +   backend that is suitable for use on WinRT.  SDL's DirectInput backend, also
   59.30 +   XInput-capable, was not used as DirectInput is not available on WinRT (or,
   59.31 +   at least, it isn't a public API).  Some portions of this XInput backend
   59.32 +   may copy parts of the XInput-using code from the DirectInput backend.
   59.33 +   Refactoring the common parts into one location may be good to-do at some
   59.34 +   point.
   59.35 +
   59.36 +   TODO, WinRT: add hotplug support for XInput based game controllers
   59.37 +*/
   59.38 +
   59.39 +#include "SDL_joystick.h"
   59.40 +#include "../SDL_sysjoystick.h"
   59.41 +#include "../SDL_joystick_c.h"
   59.42 +#include "SDL_events.h"
   59.43 +#include "../../events/SDL_events_c.h"
   59.44 +#include "SDL_timer.h"
   59.45 +
   59.46 +#include <Windows.h>
   59.47 +#include <Xinput.h>
   59.48 +
   59.49 +struct joystick_hwdata {
   59.50 +    //Uint8 bXInputHaptic; // Supports force feedback via XInput.
   59.51 +    DWORD userIndex;    // The XInput device index, in the range [0, XUSER_MAX_COUNT-1] (probably [0,3]).
   59.52 +    XINPUT_STATE XInputState;   // the last-read in XInputState, kept around to compare old and new values
   59.53 +    SDL_bool isDeviceConnected; // was the device connected (on the last detection-polling, or during backend-initialization)?
   59.54 +    SDL_bool isDeviceConnectionEventPending;    // was a device added, and is the associated add-event pending?
   59.55 +    SDL_bool isDeviceRemovalEventPending;   // was the device removed, and is the associated remove-event pending?
   59.56 +};
   59.57 +
   59.58 +/* Keep track of data on all XInput devices, regardless of whether or not
   59.59 +   they've been opened (via SDL_JoystickOpen).
   59.60 + */
   59.61 +static struct joystick_hwdata g_XInputData[XUSER_MAX_COUNT];
   59.62 +
   59.63 +/* Device detection can be extremely costly performance-wise, in some cases.
   59.64 +   In particular, if no devices are connected, calls to detect a single device,
   59.65 +   via either XInputGetState() or XInputGetCapabilities(), can take upwards of
   59.66 +   20 ms on a 1st generation Surface RT, more if devices are detected across
   59.67 +   all of of XInput's four device slots.  WinRT and XInput do not appear to
   59.68 +   have callback-based APIs to notify an app when a device is connected, at
   59.69 +   least as of Windows 8.1.  The synchronous XInput calls must be used.
   59.70 +
   59.71 +   Once a device is connected, calling XInputGetState() is a much less costly
   59.72 +   operation, with individual calls costing well under 1 ms, and often under
   59.73 +   0.1 ms [on a 1st gen Surface RT].
   59.74 +
   59.75 +   With XInput's performance limitations in mind, a separate device-detection
   59.76 +   thread will be utilized (by SDL) to try to move costly XInput calls off the
   59.77 +   main thread.  Polling of active devices still, however, occurs on the main
   59.78 +   thread.
   59.79 + */
   59.80 +static SDL_Thread * g_DeviceDetectionThread = NULL;
   59.81 +static SDL_mutex * g_DeviceInfoLock = NULL;
   59.82 +static SDL_bool g_DeviceDetectionQuit = SDL_FALSE;
   59.83 +
   59.84 +/* Main function for the device-detection thread.
   59.85 + */
   59.86 +static int
   59.87 +DeviceDetectionThreadMain(void * _data)
   59.88 +{
   59.89 +    DWORD result;
   59.90 +    XINPUT_CAPABILITIES tempXInputCaps;
   59.91 +    int i;
   59.92 +
   59.93 +    while (1) {
   59.94 +        /* See if the device-detection thread is being asked to shutdown.
   59.95 +         */
   59.96 +        SDL_LockMutex(g_DeviceInfoLock);
   59.97 +        if (g_DeviceDetectionQuit) {
   59.98 +            SDL_UnlockMutex(g_DeviceInfoLock);
   59.99 +            break;
  59.100 +        }
  59.101 +        SDL_UnlockMutex(g_DeviceInfoLock);
  59.102 +
  59.103 +        /* Add a short delay to prevent the device-detection thread from eating
  59.104 +           up too much CPU time:
  59.105 +         */
  59.106 +        SDL_Delay(300);
  59.107 +
  59.108 +        /* TODO, WinRT: try making the device-detection thread wakeup sooner from its CPU-preserving SDL_Delay, if the thread was asked to quit.
  59.109 +         */
  59.110 +
  59.111 +        /* See if any new devices are connected. */
  59.112 +        SDL_LockMutex(g_DeviceInfoLock);
  59.113 +        for (i = 0; i < XUSER_MAX_COUNT; ++i) {
  59.114 +            if (!g_XInputData[i].isDeviceConnected &&
  59.115 +                !g_XInputData[i].isDeviceConnectionEventPending &&
  59.116 +                !g_XInputData[i].isDeviceRemovalEventPending)
  59.117 +            {
  59.118 +                SDL_UnlockMutex(g_DeviceInfoLock);
  59.119 +                result = XInputGetCapabilities(i, 0, &tempXInputCaps);
  59.120 +                SDL_LockMutex(g_DeviceInfoLock);
  59.121 +                if (result == ERROR_SUCCESS) {
  59.122 +                    /* Yes, a device is connected.  Mark it as such.
  59.123 +                       Others will be told about this (via an
  59.124 +                       SDL_JOYDEVICEADDED event) in the next call to
  59.125 +                       SDL_SYS_JoystickDetect.
  59.126 +                     */
  59.127 +                    g_XInputData[i].isDeviceConnected = SDL_TRUE;
  59.128 +                    g_XInputData[i].isDeviceConnectionEventPending = SDL_TRUE;
  59.129 +                }
  59.130 +            }
  59.131 +        }
  59.132 +        SDL_UnlockMutex(g_DeviceInfoLock);
  59.133 +    }
  59.134 +
  59.135 +    return 0;
  59.136 +}
  59.137 +
  59.138 +/* Function to scan the system for joysticks.
  59.139 + * It should return 0, or -1 on an unrecoverable fatal error.
  59.140 + */
  59.141 +int
  59.142 +SDL_SYS_JoystickInit(void)
  59.143 +{
  59.144 +    HRESULT result = S_OK;
  59.145 +    XINPUT_STATE tempXInputState;
  59.146 +    int i;
  59.147 +
  59.148 +    SDL_zero(g_XInputData);
  59.149 +
  59.150 +    /* Make initial notes on whether or not devices are connected (or not).
  59.151 +     */
  59.152 +    for (i = 0; i < XUSER_MAX_COUNT; ++i) {
  59.153 +        result = XInputGetState(i, &tempXInputState);
  59.154 +        if (result == ERROR_SUCCESS) {
  59.155 +            g_XInputData[i].isDeviceConnected = SDL_TRUE;
  59.156 +        }
  59.157 +    }
  59.158 +
  59.159 +    /* Start up the device-detection thread.
  59.160 +     */
  59.161 +    g_DeviceDetectionQuit = SDL_FALSE;
  59.162 +    g_DeviceInfoLock = SDL_CreateMutex();
  59.163 +    g_DeviceDetectionThread = SDL_CreateThread(DeviceDetectionThreadMain, "SDL_joystick", NULL);
  59.164 +
  59.165 +    return (0);
  59.166 +}
  59.167 +
  59.168 +int SDL_SYS_NumJoysticks()
  59.169 +{
  59.170 +    int joystickCount = 0;
  59.171 +    DWORD i;
  59.172 +
  59.173 +    /* Iterate through each possible XInput device and see if something
  59.174 +       was connected (at joystick init, or during the last polling).
  59.175 +     */
  59.176 +    SDL_LockMutex(g_DeviceInfoLock);
  59.177 +    for (i = 0; i < XUSER_MAX_COUNT; ++i) {
  59.178 +        if (g_XInputData[i].isDeviceConnected) {
  59.179 +            ++joystickCount;
  59.180 +        }
  59.181 +    }
  59.182 +    SDL_UnlockMutex(g_DeviceInfoLock);
  59.183 +
  59.184 +    return joystickCount;
  59.185 +}
  59.186 +
  59.187 +void SDL_SYS_JoystickDetect()
  59.188 +{
  59.189 +    DWORD i;
  59.190 +    SDL_Event event;
  59.191 +
  59.192 +    /* Iterate through each possible XInput device, seeing if any devices
  59.193 +       have been connected, or if they were removed.
  59.194 +     */
  59.195 +    SDL_LockMutex(g_DeviceInfoLock);
  59.196 +    for (i = 0; i < XUSER_MAX_COUNT; ++i) {
  59.197 +        /* See if any new devices are connected. */
  59.198 +        if (g_XInputData[i].isDeviceConnectionEventPending) {
  59.199 +#if !SDL_EVENTS_DISABLED
  59.200 +            SDL_zero(event);
  59.201 +            event.type = SDL_JOYDEVICEADDED;
  59.202 +                
  59.203 +            if (SDL_GetEventState(event.type) == SDL_ENABLE) {
  59.204 +                event.jdevice.which = i;
  59.205 +                if ((SDL_EventOK == NULL)
  59.206 +                    || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
  59.207 +                    SDL_PushEvent(&event);
  59.208 +                }
  59.209 +            }
  59.210 +#endif
  59.211 +            g_XInputData[i].isDeviceConnectionEventPending = SDL_FALSE;
  59.212 +        } else if (g_XInputData[i].isDeviceRemovalEventPending) {
  59.213 +            /* A device was previously marked as removed (by
  59.214 +               SDL_SYS_JoystickUpdate).  Tell others about the device removal.
  59.215 +            */
  59.216 +
  59.217 +            g_XInputData[i].isDeviceRemovalEventPending = SDL_FALSE;
  59.218 +
  59.219 +#if !SDL_EVENTS_DISABLED
  59.220 +            SDL_zero(event);
  59.221 +            event.type = SDL_JOYDEVICEREMOVED;
  59.222 +                
  59.223 +            if (SDL_GetEventState(event.type) == SDL_ENABLE) {
  59.224 +                event.jdevice.which = i; //joystick->hwdata->userIndex;
  59.225 +                if ((SDL_EventOK == NULL)
  59.226 +                    || (*SDL_EventOK) (SDL_EventOKParam, &event)) {
  59.227 +                    SDL_PushEvent(&event);
  59.228 +                }
  59.229 +            }
  59.230 +#endif
  59.231 +        }
  59.232 +    }
  59.233 +    SDL_UnlockMutex(g_DeviceInfoLock);
  59.234 +}
  59.235 +
  59.236 +SDL_bool SDL_SYS_JoystickNeedsPolling()
  59.237 +{
  59.238 +    /* Since XInput, or WinRT, provides any events to indicate when a game
  59.239 +       controller gets connected, and instead indicates device availability
  59.240 +       solely through polling, we'll poll (for new devices).
  59.241 +     */
  59.242 +    return SDL_TRUE;
  59.243 +}
  59.244 +
  59.245 +/* Internal function to retreive device capabilities.
  59.246 +   This function will return an SDL-standard value of 0 on success
  59.247 +   (a device is connected, and data on it was retrieved), or -1
  59.248 +   on failure (no device was connected, or some other error
  59.249 +   occurred.  SDL_SetError() will be invoked to set an appropriate
  59.250 +   error message.
  59.251 + */
  59.252 +static int
  59.253 +SDL_XInput_GetDeviceCapabilities(int device_index, XINPUT_CAPABILITIES * pDeviceCaps)
  59.254 +{
  59.255 +    HRESULT dwResult;
  59.256 +
  59.257 +    /* Make sure that the device index is a valid one.  If not, return to the
  59.258 +       caller with an error.
  59.259 +     */
  59.260 +    if (device_index < 0 || device_index >= XUSER_MAX_COUNT) {
  59.261 +        return SDL_SetError("invalid/unavailable device index");
  59.262 +    }
  59.263 +
  59.264 +    /* See if a device exists, and if so, what its capabilities are.  If a
  59.265 +       device is not available, return to the caller with an error.
  59.266 +     */
  59.267 +    switch ((dwResult = XInputGetCapabilities(device_index, 0, pDeviceCaps))) {
  59.268 +        case ERROR_SUCCESS:
  59.269 +            /* A device is available, and its capabilities were retrieved! */
  59.270 +            return 0;
  59.271 +        case ERROR_DEVICE_NOT_CONNECTED:
  59.272 +            return SDL_SetError("no device is connected at joystick index, %d", device_index);
  59.273 +        default:
  59.274 +            return SDL_SetError("an unknown error occurred when retrieving info on a device at joystick index, %d", device_index);
  59.275 +    }
  59.276 +}
  59.277 +
  59.278 +/* Function to get the device-dependent name of a joystick */
  59.279 +const char *
  59.280 +SDL_SYS_JoystickNameForDeviceIndex(int device_index)
  59.281 +{
  59.282 +    XINPUT_CAPABILITIES deviceCaps;
  59.283 +
  59.284 +    if (SDL_XInput_GetDeviceCapabilities(device_index, &deviceCaps) != 0) {
  59.285 +        /* Uh oh.  Device capabilities couldn't be retrieved.  Return to the
  59.286 +           caller.  SDL_SetError() has already been invoked (with relevant
  59.287 +           information).
  59.288 +         */
  59.289 +        return NULL;
  59.290 +    }
  59.291 +
  59.292 +    switch (deviceCaps.SubType) {
  59.293 +        default:
  59.294 +            if (deviceCaps.Type == XINPUT_DEVTYPE_GAMEPAD) {
  59.295 +                return "Undefined game controller";
  59.296 +            } else {
  59.297 +                return "Undefined controller";
  59.298 +            }
  59.299 +        case XINPUT_DEVSUBTYPE_UNKNOWN:
  59.300 +            if (deviceCaps.Type == XINPUT_DEVTYPE_GAMEPAD) {
  59.301 +                return "Unknown game controller";
  59.302 +            } else {
  59.303 +                return "Unknown controller";
  59.304 +            }
  59.305 +        case XINPUT_DEVSUBTYPE_GAMEPAD:
  59.306 +            return "Gamepad controller";
  59.307 +        case XINPUT_DEVSUBTYPE_WHEEL:
  59.308 +            return "Racing wheel controller";
  59.309 +        case XINPUT_DEVSUBTYPE_ARCADE_STICK:
  59.310 +            return "Arcade stick controller";
  59.311 +        case XINPUT_DEVSUBTYPE_FLIGHT_STICK:
  59.312 +            return "Flight stick controller";
  59.313 +        case XINPUT_DEVSUBTYPE_DANCE_PAD:
  59.314 +            return "Dance pad controller";
  59.315 +        case XINPUT_DEVSUBTYPE_GUITAR:
  59.316 +            return "Guitar controller";
  59.317 +        case XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE:
  59.318 +            return "Guitar controller, Alternate";
  59.319 +        case XINPUT_DEVSUBTYPE_GUITAR_BASS:
  59.320 +            return "Guitar controller, Bass";
  59.321 +        case XINPUT_DEVSUBTYPE_DRUM_KIT:
  59.322 +            return "Drum controller";
  59.323 +        case XINPUT_DEVSUBTYPE_ARCADE_PAD:
  59.324 +            return "Arcade pad controller";
  59.325 +    }
  59.326 +}
  59.327 +
  59.328 +/* Function to perform the mapping from device index to the instance id for this index */
  59.329 +SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index)
  59.330 +{
  59.331 +    return device_index;
  59.332 +}
  59.333 +
  59.334 +/* Function to open a joystick for use.
  59.335 +   The joystick to open is specified by the index field of the joystick.
  59.336 +   This should fill the nbuttons and naxes fields of the joystick structure.
  59.337 +   It returns 0, or -1 if there is an error.
  59.338 + */
  59.339 +int
  59.340 +SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index)
  59.341 +{
  59.342 +    XINPUT_CAPABILITIES deviceCaps;
  59.343 +
  59.344 +    if (SDL_XInput_GetDeviceCapabilities(device_index, &deviceCaps) != 0) {
  59.345 +        /* Uh oh.  Device capabilities couldn't be retrieved.  Return to the
  59.346 +           caller.  SDL_SetError() has already been invoked (with relevant
  59.347 +           information).
  59.348 +         */
  59.349 +        return -1;
  59.350 +    }
  59.351 +
  59.352 +    /* For now, only game pads are supported.  If the device is something other
  59.353 +       than that, return an error to the caller.
  59.354 +     */
  59.355 +    if (deviceCaps.Type != XINPUT_DEVTYPE_GAMEPAD) {
  59.356 +        return SDL_SetError("a device is connected (at joystick index, %d), but it is of an unknown device type (deviceCaps.Flags=%ul)",
  59.357 +            device_index, (unsigned int)deviceCaps.Flags);
  59.358 +    }
  59.359 +
  59.360 +    /* Create the joystick data structure */
  59.361 +    joystick->instance_id = device_index;
  59.362 +    joystick->hwdata = &g_XInputData[device_index];
  59.363 +
  59.364 +    // The XInput API has a hard coded button/axis mapping, so we just match it
  59.365 +    joystick->naxes = 6;
  59.366 +    joystick->nbuttons = 15;
  59.367 +    joystick->nballs = 0;
  59.368 +    joystick->nhats = 0;
  59.369 +
  59.370 +    /* We're done! */
  59.371 +    return (0);
  59.372 +}
  59.373 +
  59.374 +/* Function to determine is this joystick is attached to the system right now */
  59.375 +SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
  59.376 +{
  59.377 +    SDL_bool isDeviceConnected;
  59.378 +    SDL_LockMutex(g_DeviceInfoLock);
  59.379 +    isDeviceConnected = joystick->hwdata->isDeviceConnected;
  59.380 +    SDL_UnlockMutex(g_DeviceInfoLock);
  59.381 +    return isDeviceConnected;
  59.382 +}
  59.383 +
  59.384 +/* Function to return > 0 if a bit array of buttons differs after applying a mask
  59.385 +*/
  59.386 +static int ButtonChanged( int ButtonsNow, int ButtonsPrev, int ButtonMask )
  59.387 +{
  59.388 +    return ( ButtonsNow & ButtonMask ) != ( ButtonsPrev & ButtonMask );
  59.389 +}
  59.390 +
  59.391 +/* Function to update the state of a joystick - called as a device poll.
  59.392 + * This function shouldn't update the joystick structure directly,
  59.393 + * but instead should call SDL_PrivateJoystick*() to deliver events
  59.394 + * and update joystick device state.
  59.395 + */
  59.396 +void
  59.397 +SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
  59.398 +{
  59.399 +    HRESULT result;
  59.400 +    XINPUT_STATE prevXInputState;
  59.401 +
  59.402 +    SDL_LockMutex(g_DeviceInfoLock);
  59.403 +
  59.404 +    /* Before polling for new data, make note of the old data */
  59.405 +    prevXInputState = joystick->hwdata->XInputState;
  59.406 +
  59.407 +    /* Poll for new data */
  59.408 +    result = XInputGetState(joystick->hwdata->userIndex, &joystick->hwdata->XInputState);
  59.409 +    if (result == ERROR_DEVICE_NOT_CONNECTED) {
  59.410 +        if (joystick->hwdata->isDeviceConnected) {
  59.411 +            joystick->hwdata->isDeviceConnected = SDL_FALSE;
  59.412 +            joystick->hwdata->isDeviceRemovalEventPending = SDL_TRUE;
  59.413 +            /* TODO, WinRT: make sure isDeviceRemovalEventPending gets cleared as appropriate, and that quick re-plugs don't cause trouble */
  59.414 +        }
  59.415 +        SDL_UnlockMutex(g_DeviceInfoLock);
  59.416 +        return;
  59.417 +    }
  59.418 +
  59.419 +    /* Make sure the device is marked as connected */
  59.420 +    joystick->hwdata->isDeviceConnected = SDL_TRUE;
  59.421 +
  59.422 +    // only fire events if the data changed from last time
  59.423 +    if ( joystick->hwdata->XInputState.dwPacketNumber != 0 
  59.424 +        && joystick->hwdata->XInputState.dwPacketNumber != prevXInputState.dwPacketNumber )
  59.425 +    {
  59.426 +        XINPUT_STATE *pXInputState = &joystick->hwdata->XInputState;
  59.427 +        XINPUT_STATE *pXInputStatePrev = &prevXInputState;
  59.428 +
  59.429 +        SDL_PrivateJoystickAxis(joystick, 0, (Sint16)pXInputState->Gamepad.sThumbLX );
  59.430 +        SDL_PrivateJoystickAxis(joystick, 1, (Sint16)(-1*pXInputState->Gamepad.sThumbLY-1) );
  59.431 +        SDL_PrivateJoystickAxis(joystick, 2, (Sint16)pXInputState->Gamepad.sThumbRX );
  59.432 +        SDL_PrivateJoystickAxis(joystick, 3, (Sint16)(-1*pXInputState->Gamepad.sThumbRY-1) );
  59.433 +        SDL_PrivateJoystickAxis(joystick, 4, (Sint16)((int)pXInputState->Gamepad.bLeftTrigger*32767/255) );
  59.434 +        SDL_PrivateJoystickAxis(joystick, 5, (Sint16)((int)pXInputState->Gamepad.bRightTrigger*32767/255) );
  59.435 +
  59.436 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_UP ) )
  59.437 +            SDL_PrivateJoystickButton(joystick, 0, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP ? SDL_PRESSED :	SDL_RELEASED );
  59.438 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_DOWN ) )
  59.439 +            SDL_PrivateJoystickButton(joystick, 1, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN ? SDL_PRESSED :	SDL_RELEASED );
  59.440 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_LEFT ) )
  59.441 +            SDL_PrivateJoystickButton(joystick, 2, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT ? SDL_PRESSED :	SDL_RELEASED );
  59.442 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_DPAD_RIGHT ) )
  59.443 +            SDL_PrivateJoystickButton(joystick, 3, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT ? SDL_PRESSED :	SDL_RELEASED );
  59.444 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_START ) )
  59.445 +            SDL_PrivateJoystickButton(joystick, 4, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_START ? SDL_PRESSED :	SDL_RELEASED );
  59.446 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_BACK ) )
  59.447 +            SDL_PrivateJoystickButton(joystick, 5, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_BACK ? SDL_PRESSED :	SDL_RELEASED );
  59.448 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_LEFT_THUMB ) )
  59.449 +            SDL_PrivateJoystickButton(joystick, 6, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB ? SDL_PRESSED :	SDL_RELEASED );
  59.450 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_RIGHT_THUMB ) )
  59.451 +            SDL_PrivateJoystickButton(joystick, 7, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB ? SDL_PRESSED :	SDL_RELEASED );
  59.452 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_LEFT_SHOULDER ) )
  59.453 +            SDL_PrivateJoystickButton(joystick, 8, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER ? SDL_PRESSED :	SDL_RELEASED );
  59.454 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_RIGHT_SHOULDER ) )
  59.455 +            SDL_PrivateJoystickButton(joystick, 9, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER ? SDL_PRESSED :	SDL_RELEASED );
  59.456 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_A ) )
  59.457 +            SDL_PrivateJoystickButton(joystick, 10, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_A ? SDL_PRESSED :	SDL_RELEASED );
  59.458 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_B ) )
  59.459 +            SDL_PrivateJoystickButton(joystick, 11, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_B ? SDL_PRESSED :	SDL_RELEASED );
  59.460 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_X ) )
  59.461 +            SDL_PrivateJoystickButton(joystick, 12, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_X ? SDL_PRESSED :	SDL_RELEASED );
  59.462 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons, XINPUT_GAMEPAD_Y ) )
  59.463 +            SDL_PrivateJoystickButton(joystick, 13, pXInputState->Gamepad.wButtons & XINPUT_GAMEPAD_Y ? SDL_PRESSED :	SDL_RELEASED );
  59.464 +        if ( ButtonChanged( pXInputState->Gamepad.wButtons, pXInputStatePrev->Gamepad.wButtons,  0x400 ) )
  59.465 +            SDL_PrivateJoystickButton(joystick, 14, pXInputState->Gamepad.wButtons & 0x400 ? SDL_PRESSED :	SDL_RELEASED ); // 0x400 is the undocumented code for the guide button
  59.466 +    }
  59.467 +
  59.468 +    SDL_UnlockMutex(g_DeviceInfoLock);
  59.469 +}
  59.470 +
  59.471 +/* Function to close a joystick after use */
  59.472 +void
  59.473 +SDL_SYS_JoystickClose(SDL_Joystick * joystick)
  59.474 +{
  59.475 +    /* Clear cached button data on the joystick */
  59.476 +    SDL_LockMutex(g_DeviceInfoLock);
  59.477 +    SDL_zero(joystick->hwdata->XInputState);
  59.478 +    SDL_UnlockMutex(g_DeviceInfoLock);
  59.479 +
  59.480 +    /* There's need to free 'hwdata', as it's a pointer to a global array.
  59.481 +       The field will be cleared anyways, just to indicate that it's not
  59.482 +       currently needed.
  59.483 +     */
  59.484 +    joystick->hwdata = NULL;
  59.485 +}
  59.486 +
  59.487 +/* Function to perform any system-specific joystick related cleanup */
  59.488 +void
  59.489 +SDL_SYS_JoystickQuit(void)
  59.490 +{
  59.491 +    /* Tell the joystick detection thread to stop, then wait for it to finish */
  59.492 +    SDL_LockMutex(g_DeviceInfoLock);
  59.493 +    g_DeviceDetectionQuit = SDL_TRUE;
  59.494 +    SDL_UnlockMutex(g_DeviceInfoLock);
  59.495 +    SDL_WaitThread(g_DeviceDetectionThread, NULL);
  59.496 +
  59.497 +    /* Clean up device-detection stuff */
  59.498 +    SDL_DestroyMutex(g_DeviceInfoLock);
  59.499 +    g_DeviceInfoLock = NULL;
  59.500 +    g_DeviceDetectionThread = NULL;
  59.501 +    g_DeviceDetectionQuit = SDL_FALSE;
  59.502 +
  59.503 +    return;
  59.504 +}
  59.505 +
  59.506 +SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index )
  59.507 +{
  59.508 +    SDL_JoystickGUID guid;
  59.509 +    // the GUID is just the first 16 chars of the name for now
  59.510 +    const char *name = SDL_SYS_JoystickNameForDeviceIndex( device_index );
  59.511 +    SDL_zero( guid );
  59.512 +    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
  59.513 +    return guid;
  59.514 +}
  59.515 +
  59.516 +
  59.517 +SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick)
  59.518 +{
  59.519 +    SDL_JoystickGUID guid;
  59.520 +    // the GUID is just the first 16 chars of the name for now
  59.521 +    const char *name = joystick->name;
  59.522 +    SDL_zero( guid );
  59.523 +    SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
  59.524 +    return guid;
  59.525 +}
  59.526 +
  59.527 +SDL_bool SDL_SYS_IsXInputDeviceIndex(int device_index)
  59.528 +{
  59.529 +    /* The XInput-capable DirectInput joystick backend implements the same
  59.530 +       function (SDL_SYS_IsXInputDeviceIndex), however in that case, not all
  59.531 +       joystick devices are XInput devices.  In this case, with the
  59.532 +       WinRT-enabled XInput-only backend, all "joystick" devices are XInput
  59.533 +       devices.
  59.534 +     */
  59.535 +    return SDL_TRUE;
  59.536 +}
  59.537 +
  59.538 +#endif /* SDL_JOYSTICK_XINPUT */
  59.539 +
  59.540 +/* vi: set ts=4 sw=4 expandtab: */
    60.1 --- a/src/loadso/windows/SDL_sysloadso.c	Sun Mar 09 10:38:30 2014 -0700
    60.2 +++ b/src/loadso/windows/SDL_sysloadso.c	Sun Mar 09 11:36:47 2014 -0700
    60.3 @@ -33,7 +33,15 @@
    60.4  SDL_LoadObject(const char *sofile)
    60.5  {
    60.6      LPTSTR tstr = WIN_UTF8ToString(sofile);
    60.7 +#ifdef __WINRT__
    60.8 +    /* WinRT only publically supports LoadPackagedLibrary() for loading .dll
    60.9 +       files.  LoadLibrary() is a private API, and not available for apps
   60.10 +       (that can be published to MS' Windows Store.)
   60.11 +    */
   60.12 +    void *handle = (void *) LoadPackagedLibrary(tstr, 0);
   60.13 +#else
   60.14      void *handle = (void *) LoadLibrary(tstr);
   60.15 +#endif
   60.16      SDL_free(tstr);
   60.17  
   60.18      /* Generate an error message if all loads failed */
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/src/main/winrt/SDL_winrt_main_NonXAML.cpp	Sun Mar 09 11:36:47 2014 -0700
    61.3 @@ -0,0 +1,56 @@
    61.4 +
    61.5 +#include <SDL_main.h>
    61.6 +#include <wrl.h>
    61.7 +
    61.8 +/* At least one file in any SDL/WinRT app appears to require compilation
    61.9 +   with C++/CX, otherwise a Windows Metadata file won't get created, and
   61.10 +   an APPX0702 build error can appear shortly after linking.
   61.11 +
   61.12 +   The following set of preprocessor code forces this file to be compiled
   61.13 +   as C++/CX, which appears to cause Visual C++ 2012's build tools to
   61.14 +   create this .winmd file, and will help allow builds of SDL/WinRT apps
   61.15 +   to proceed without error.
   61.16 +
   61.17 +   If other files in an app's project enable C++/CX compilation, then it might
   61.18 +   be possible for SDL_winrt_main_NonXAML.cpp to be compiled without /ZW,
   61.19 +   for Visual C++'s build tools to create a winmd file, and for the app to
   61.20 +   build without APPX0702 errors.  In this case, if
   61.21 +   SDL_WINRT_METADATA_FILE_AVAILABLE is defined as a C/C++ macro, then
   61.22 +   the #error (to force C++/CX compilation) will be disabled.
   61.23 +
   61.24 +   Please note that /ZW can be specified on a file-by-file basis.  To do this,
   61.25 +   right click on the file in Visual C++, click Properties, then change the
   61.26 +   setting through the dialog that comes up.
   61.27 +*/
   61.28 +#ifndef SDL_WINRT_METADATA_FILE_AVAILABLE
   61.29 +#ifndef __cplusplus_winrt
   61.30 +#error SDL_winrt_main_NonXAML.cpp must be compiled with /ZW, otherwise build errors due to missing .winmd files can occur.
   61.31 +#endif
   61.32 +#endif
   61.33 +
   61.34 +/* Prevent MSVC++ from warning about threading models when defining our
   61.35 +   custom WinMain.  The threading model will instead be set via a direct
   61.36 +   call to Windows::Foundation::Initialize (rather than via an attributed
   61.37 +   function).
   61.38 +
   61.39 +   To note, this warning (C4447) does not seem to come up unless this file
   61.40 +   is compiled with C++/CX enabled (via the /ZW compiler flag).
   61.41 +*/
   61.42 +#ifdef _MSC_VER
   61.43 +#pragma warning(disable:4447)
   61.44 +#endif
   61.45 +
   61.46 +/* Make sure the function to initialize the Windows Runtime gets linked in. */
   61.47 +#ifdef _MSC_VER
   61.48 +#pragma comment(lib, "runtimeobject.lib")
   61.49 +#endif
   61.50 +
   61.51 +int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
   61.52 +{
   61.53 +    if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) {
   61.54 +        return 1;
   61.55 +    }
   61.56 +
   61.57 +    SDL_WinRTRunApp(SDL_main, NULL);
   61.58 +    return 0;
   61.59 +}
    62.1 --- a/src/render/SDL_render.c	Sun Mar 09 10:38:30 2014 -0700
    62.2 +++ b/src/render/SDL_render.c	Sun Mar 09 11:36:47 2014 -0700
    62.3 @@ -50,6 +50,9 @@
    62.4  #if SDL_VIDEO_RENDER_D3D
    62.5      &D3D_RenderDriver,
    62.6  #endif
    62.7 +#if SDL_VIDEO_RENDER_D3D11
    62.8 +    &D3D11_RenderDriver,
    62.9 +#endif
   62.10  #if SDL_VIDEO_RENDER_OGL
   62.11      &GL_RenderDriver,
   62.12  #endif
    63.1 --- a/src/render/SDL_sysrender.h	Sun Mar 09 10:38:30 2014 -0700
    63.2 +++ b/src/render/SDL_sysrender.h	Sun Mar 09 11:36:47 2014 -0700
    63.3 @@ -171,6 +171,9 @@
    63.4  #if SDL_VIDEO_RENDER_D3D
    63.5  extern SDL_RenderDriver D3D_RenderDriver;
    63.6  #endif
    63.7 +#if SDL_VIDEO_RENDER_D3D11
    63.8 +extern SDL_RenderDriver D3D11_RenderDriver;
    63.9 +#endif
   63.10  #if SDL_VIDEO_RENDER_OGL
   63.11  extern SDL_RenderDriver GL_RenderDriver;
   63.12  #endif
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/src/render/direct3d11/SDL_render_d3d11.cpp	Sun Mar 09 11:36:47 2014 -0700
    64.3 @@ -0,0 +1,2386 @@
    64.4 +/*
    64.5 +  Simple DirectMedia Layer
    64.6 +  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
    64.7 +
    64.8 +  This software is provided 'as-is', without any express or implied
    64.9 +  warranty.  In no event will the authors be held liable for any damages
   64.10 +  arising from the use of this software.
   64.11 +
   64.12 +  Permission is granted to anyone to use this software for any purpose,
   64.13 +  including commercial applications, and to alter it and redistribute it
   64.14 +  freely, subject to the following restrictions:
   64.15 +
   64.16 +  1. The origin of this software must not be misrepresented; you must not
   64.17 +     claim that you wrote the original software. If you use this software
   64.18 +     in a product, an acknowledgment in the product documentation would be
   64.19 +     appreciated but is not required.
   64.20 +  2. Altered source versions must be plainly marked as such, and must not be
   64.21 +     misrepresented as being the original software.
   64.22 +  3. This notice may not be removed or altered from any source distribution.
   64.23 +*/
   64.24 +
   64.25 +#include "SDL_config.h"
   64.26 +
   64.27 +#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
   64.28 +
   64.29 +#ifdef __WINRT__
   64.30 +#include <windows.ui.core.h>
   64.31 +#include <windows.foundation.h>
   64.32 +
   64.33 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
   64.34 +#include <windows.ui.xaml.media.dxinterop.h>
   64.35 +#endif
   64.36 +
   64.37 +#endif
   64.38 +
   64.39 +extern "C" {
   64.40 +#include "../../core/windows/SDL_windows.h"
   64.41 +#include "SDL_hints.h"
   64.42 +#include "SDL_system.h"
   64.43 +#include "SDL_syswm.h"
   64.44 +#include "../SDL_sysrender.h"
   64.45 +#include "../../video/SDL_sysvideo.h"
   64.46 +}
   64.47 +
   64.48 +#include <string>
   64.49 +#include <vector>
   64.50 +
   64.51 +#include <D3D11_1.h>
   64.52 +#include <DirectXMath.h>
   64.53 +#include <wrl/client.h>
   64.54 +
   64.55 +
   64.56 +using namespace DirectX;
   64.57 +using namespace Microsoft::WRL;
   64.58 +using namespace std;
   64.59 +
   64.60 +#ifdef __WINRT__
   64.61 +using namespace Windows::Graphics::Display;
   64.62 +using namespace Windows::UI::Core;
   64.63 +#endif
   64.64 +
   64.65 +/* Texture sampling types */
   64.66 +static const D3D11_FILTER SDL_D3D11_NEAREST_PIXEL_FILTER = D3D11_FILTER_MIN_MAG_MIP_POINT;
   64.67 +static const D3D11_FILTER SDL_D3D11_LINEAR_FILTER = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
   64.68 +
   64.69 +/* Vertex shader, common values */
   64.70 +struct VertexShaderConstants
   64.71 +{
   64.72 +    DirectX::XMFLOAT4X4 model;
   64.73 +    DirectX::XMFLOAT4X4 projectionAndView;
   64.74 +};
   64.75 +
   64.76 +/* Per-vertex data */
   64.77 +struct VertexPositionColor
   64.78 +{
   64.79 +    DirectX::XMFLOAT3 pos;
   64.80 +    DirectX::XMFLOAT2 tex;
   64.81 +    DirectX::XMFLOAT4 color;
   64.82 +};
   64.83 +
   64.84 +/* Per-texture data */
   64.85 +typedef struct
   64.86 +{
   64.87 +    Microsoft::WRL::ComPtr<ID3D11Texture2D> mainTexture;
   64.88 +    Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> mainTextureResourceView;
   64.89 +    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> mainTextureRenderTargetView;
   64.90 +    SDL_PixelFormat * pixelFormat;
   64.91 +    Microsoft::WRL::ComPtr<ID3D11Texture2D> stagingTexture;
   64.92 +    DirectX::XMINT2 lockedTexturePosition;
   64.93 +    D3D11_FILTER scaleMode;
   64.94 +} D3D11_TextureData;
   64.95 +
   64.96 +/* Private renderer data */
   64.97 +typedef struct
   64.98 +{
   64.99 +    Microsoft::WRL::ComPtr<ID3D11Device1> d3dDevice;
  64.100 +    Microsoft::WRL::ComPtr<ID3D11DeviceContext1> d3dContext;
  64.101 +    Microsoft::WRL::ComPtr<IDXGISwapChain1> swapChain;
  64.102 +    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> mainRenderTargetView;
  64.103 +    Microsoft::WRL::ComPtr<ID3D11RenderTargetView> currentOffscreenRenderTargetView;
  64.104 +    Microsoft::WRL::ComPtr<ID3D11InputLayout> inputLayout;
  64.105 +    Microsoft::WRL::ComPtr<ID3D11Buffer> vertexBuffer;
  64.106 +    Microsoft::WRL::ComPtr<ID3D11VertexShader> vertexShader;
  64.107 +    Microsoft::WRL::ComPtr<ID3D11PixelShader> texturePixelShader;
  64.108 +    Microsoft::WRL::ComPtr<ID3D11PixelShader> colorPixelShader;
  64.109 +    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeBlend;
  64.110 +    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeAdd;
  64.111 +    Microsoft::WRL::ComPtr<ID3D11BlendState> blendModeMod;
  64.112 +    Microsoft::WRL::ComPtr<ID3D11SamplerState> nearestPixelSampler;
  64.113 +    Microsoft::WRL::ComPtr<ID3D11SamplerState> linearSampler;
  64.114 +    D3D_FEATURE_LEVEL featureLevel;
  64.115 +
  64.116 +    // Rasterizers:
  64.117 +    // If this list starts to get unwieldy, then consider using a map<> of them.
  64.118 +    Microsoft::WRL::ComPtr<ID3D11RasterizerState> mainRasterizer;
  64.119 +    Microsoft::WRL::ComPtr<ID3D11RasterizerState> clippedRasterizer;
  64.120 +
  64.121 +    // Vertex buffer constants:
  64.122 +    VertexShaderConstants vertexShaderConstantsData;
  64.123 +    Microsoft::WRL::ComPtr<ID3D11Buffer> vertexShaderConstants;
  64.124 +
  64.125 +    // Cached renderer properties.
  64.126 +    DirectX::XMFLOAT2 windowSizeInDIPs;
  64.127 +    DirectX::XMFLOAT2 renderTargetSize;
  64.128 +    Windows::Graphics::Display::DisplayOrientations orientation;
  64.129 +
  64.130 +    // Transform used for display orientation.
  64.131 +    DirectX::XMFLOAT4X4 orientationTransform3D;
  64.132 +} D3D11_RenderData;
  64.133 +
  64.134 +
  64.135 +/* Direct3D 11.x shaders
  64.136 +
  64.137 +   SDL's shaders are compiled into SDL itself, to simplify distribution.
  64.138 +
  64.139 +   All Direct3D 11.x shaders were compiled with the following:
  64.140 +
  64.141 +   fxc /E"main" /T "<TYPE>" /Fo"<OUTPUT FILE>" "<INPUT FILE>"
  64.142 +
  64.143 +     Variables:
  64.144 +     - <TYPE>: the type of shader.  A table of utilized shader types is
  64.145 +       listed below.
  64.146 +     - <OUTPUT FILE>: where to store compiled output
  64.147 +     - <INPUT FILE>: where to read shader source code from
  64.148 +
  64.149 +     Shader types:
  64.150 +     - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT
  64.151 +     - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT
  64.152 +     - ps_4_0_level_9_3: Pixel shader for Windows Phone 8
  64.153 +     - vs_4_0_level_9_3: Vertex shader for Windows Phone 8
  64.154 +   
  64.155 +
  64.156 +   Shader object code was converted to a list of DWORDs via the following
  64.157 +   *nix style command (available separately from Windows + MSVC):
  64.158 +
  64.159 +     hexdump -v -e '6/4 "0x%08.8x, " "\n"' <FILE>
  64.160 +  */
  64.161 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
  64.162 +#define D3D11_USE_SHADER_MODEL_4_0_level_9_3
  64.163 +#else
  64.164 +#define D3D11_USE_SHADER_MODEL_4_0_level_9_1
  64.165 +#endif
  64.166 +
  64.167 +/* The texture-rendering pixel shader:
  64.168 +
  64.169 +    --- D3D11_PixelShader_Textures.hlsl ---
  64.170 +    Texture2D theTexture : register(t0);
  64.171 +    SamplerState theSampler : register(s0);
  64.172 +
  64.173 +    struct PixelShaderInput
  64.174 +    {
  64.175 +        float4 pos : SV_POSITION;
  64.176 +        float2 tex : TEXCOORD0;
  64.177 +        float4 color : COLOR0;
  64.178 +    };
  64.179 +
  64.180 +    float4 main(PixelShaderInput input) : SV_TARGET
  64.181 +    {
  64.182 +        return theTexture.Sample(theSampler, input.tex) * input.color;
  64.183 +    }
  64.184 +*/
  64.185 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  64.186 +static const DWORD D3D11_PixelShader_Textures[] = {
  64.187 +    0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001,
  64.188 +    0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8,
  64.189 +    0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200,
  64.190 +    0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001,
  64.191 +    0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000,
  64.192 +    0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800,
  64.193 +    0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000,
  64.194 +    0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
  64.195 +    0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000,
  64.196 +    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
  64.197 +    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
  64.198 +    0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2,
  64.199 +    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
  64.200 +    0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
  64.201 +    0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003,
  64.202 +    0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000,
  64.203 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.204 +    0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.205 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.206 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8,
  64.207 +    0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100,
  64.208 +    0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
  64.209 +    0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005,
  64.210 +    0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874,
  64.211 +    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263,
  64.212 +    0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
  64.213 +    0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00,
  64.214 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  64.215 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  64.216 +    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
  64.217 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  64.218 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  64.219 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  64.220 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  64.221 +};
  64.222 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  64.223 +static const DWORD D3D11_PixelShader_Textures[] = {
  64.224 +    0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001,
  64.225 +    0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8,
  64.226 +    0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200,
  64.227 +    0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001,
  64.228 +    0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000,
  64.229 +    0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800,
  64.230 +    0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000,
  64.231 +    0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
  64.232 +    0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000,
  64.233 +    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
  64.234 +    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
  64.235 +    0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2,
  64.236 +    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
  64.237 +    0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
  64.238 +    0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003,
  64.239 +    0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000,
  64.240 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.241 +    0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.242 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.243 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8,
  64.244 +    0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100,
  64.245 +    0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
  64.246 +    0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005,
  64.247 +    0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874,
  64.248 +    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263,
  64.249 +    0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
  64.250 +    0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00,
  64.251 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  64.252 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  64.253 +    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
  64.254 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  64.255 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  64.256 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  64.257 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  64.258 +};
  64.259 +#else
  64.260 +#error "An appropriate 'textures' pixel shader is not defined"
  64.261 +#endif
  64.262 +
  64.263 +/* The color-only-rendering pixel shader:
  64.264 +
  64.265 +   --- D3D11_PixelShader_Colors.hlsl ---
  64.266 +   struct PixelShaderInput
  64.267 +   {
  64.268 +       float4 pos : SV_POSITION;
  64.269 +       float2 tex : TEXCOORD0;
  64.270 +       float4 color : COLOR0;
  64.271 +   };
  64.272 +
  64.273 +   float4 main(PixelShaderInput input) : SV_TARGET
  64.274 +   {
  64.275 +       return input.color;
  64.276 +   }
  64.277 +*/
  64.278 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  64.279 +static const DWORD D3D11_PixelShader_Colors[] = {
  64.280 +    0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001,
  64.281 +    0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140,
  64.282 +    0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200,
  64.283 +    0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
  64.284 +    0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001,
  64.285 +    0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040,
  64.286 +    0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2,
  64.287 +    0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002,
  64.288 +    0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000,
  64.289 +    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  64.290 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.291 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
  64.292 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.293 +    0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000,
  64.294 +    0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d,
  64.295 +    0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
  64.296 +    0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438,
  64.297 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  64.298 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  64.299 +    0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000,
  64.300 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  64.301 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  64.302 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  64.303 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  64.304 +};
  64.305 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  64.306 +static const DWORD D3D11_PixelShader_Colors[] = {
  64.307 +    0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001,
  64.308 +    0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140,
  64.309 +    0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200,
  64.310 +    0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
  64.311 +    0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001,
  64.312 +    0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040,
  64.313 +    0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2,
  64.314 +    0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002,
  64.315 +    0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000,
  64.316 +    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  64.317 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.318 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
  64.319 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.320 +    0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000,
  64.321 +    0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d,
  64.322 +    0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
  64.323 +    0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438,
  64.324 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  64.325 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  64.326 +    0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000,
  64.327 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  64.328 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  64.329 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  64.330 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  64.331 +};
  64.332 +#else
  64.333 +#error "An appropriate 'colors' pixel shader is not defined."
  64.334 +#endif
  64.335 +
  64.336 +/* The sole vertex shader:
  64.337 +
  64.338 +   --- D3D11_VertexShader.hlsl ---
  64.339 +   #pragma pack_matrix( row_major )
  64.340 +
  64.341 +   cbuffer VertexShaderConstants : register(b0)
  64.342 +   {
  64.343 +       matrix model;
  64.344 +       matrix projectionAndView;
  64.345 +   };
  64.346 +
  64.347 +   struct VertexShaderInput
  64.348 +   {
  64.349 +       float3 pos : POSITION;
  64.350 +       float2 tex : TEXCOORD0;
  64.351 +       float4 color : COLOR0;
  64.352 +   };
  64.353 +
  64.354 +   struct VertexShaderOutput
  64.355 +   {
  64.356 +       float4 pos : SV_POSITION;
  64.357 +       float2 tex : TEXCOORD0;
  64.358 +       float4 color : COLOR0;
  64.359 +   };
  64.360 +
  64.361 +   VertexShaderOutput main(VertexShaderInput input)
  64.362 +   {
  64.363 +       VertexShaderOutput output;
  64.364 +       float4 pos = float4(input.pos, 1.0f);
  64.365 +
  64.366 +       // Transform the vertex position into projected space.
  64.367 +       pos = mul(pos, model);
  64.368 +       pos = mul(pos, projectionAndView);
  64.369 +       output.pos = pos;
  64.370 +
  64.371 +       // Pass through texture coordinates and color values without transformation
  64.372 +       output.tex = input.tex;
  64.373 +       output.color = input.color;
  64.374 +
  64.375 +       return output;
  64.376 +   }
  64.377 +*/
  64.378 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  64.379 +static const DWORD D3D11_VertexShader[] = {
  64.380 +    0x43425844, 0x62dfae5f, 0x3e8bd8df, 0x9ec97127, 0x5044eefb, 0x00000001,
  64.381 +    0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0,
  64.382 +    0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200,
  64.383 +    0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000,
  64.384 +    0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0200,
  64.385 +    0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001,
  64.386 +    0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000,
  64.387 +    0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000,
  64.388 +    0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002,
  64.389 +    0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000,
  64.390 +    0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001,
  64.391 +    0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004,
  64.392 +    0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000,
  64.393 +    0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000,
  64.394 +    0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002,
  64.395 +    0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059,
  64.396 +    0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000,
  64.397 +    0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002,
  64.398 +    0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032,
  64.399 +    0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002,
  64.400 +    0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46,
  64.401 +    0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006,
  64.402 +    0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000,
  64.403 +    0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46,
  64.404 +    0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2,
  64.405 +    0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003,
  64.406 +    0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46,
  64.407 +    0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006,
  64.408 +    0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001,
  64.409 +    0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46,
  64.410 +    0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2,
  64.411 +    0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007,
  64.412 +    0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046,
  64.413 +    0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002,
  64.414 +    0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000,
  64.415 +    0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  64.416 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.417 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
  64.418 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.419 +    0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054,
  64.420 +    0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c,
  64.421 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
  64.422 +    0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174,
  64.423 +    0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000,
  64.424 +    0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4,
  64.425 +    0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4,
  64.426 +    0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000,
  64.427 +    0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077,
  64.428 +    0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564,
  64.429 +    0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336,
  64.430 +    0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050,
  64.431 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059,
  64.432 +    0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062,
  64.433 +    0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50,
  64.434 +    0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f,
  64.435 +    0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
  64.436 +    0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
  64.437 +    0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000,
  64.438 +    0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
  64.439 +    0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f
  64.440 +};
  64.441 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  64.442 +static const DWORD D3D11_VertexShader[] = {
  64.443 +    0x43425844, 0x01a24e41, 0x696af551, 0x4b2a87d1, 0x82ea03f6, 0x00000001,
  64.444 +    0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0,
  64.445 +    0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200,
  64.446 +    0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000,
  64.447 +    0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0201,
  64.448 +    0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001,
  64.449 +    0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000,
  64.450 +    0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000,
  64.451 +    0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002,
  64.452 +    0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000,
  64.453 +    0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001,
  64.454 +    0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004,
  64.455 +    0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000,
  64.456 +    0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000,
  64.457 +    0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002,
  64.458 +    0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059,
  64.459 +    0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000,
  64.460 +    0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002,
  64.461 +    0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032,
  64.462 +    0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002,
  64.463 +    0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46,
  64.464 +    0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006,
  64.465 +    0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000,
  64.466 +    0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46,
  64.467 +    0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2,
  64.468 +    0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003,
  64.469 +    0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46,
  64.470 +    0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006,
  64.471 +    0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001,
  64.472 +    0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46,
  64.473 +    0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2,
  64.474 +    0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007,
  64.475 +    0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046,
  64.476 +    0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002,
  64.477 +    0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000,
  64.478 +    0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  64.479 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.480 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
  64.481 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  64.482 +    0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054,
  64.483 +    0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c,
  64.484 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
  64.485 +    0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174,
  64.486 +    0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000,
  64.487 +    0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4,
  64.488 +    0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4,
  64.489 +    0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000,
  64.490 +    0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077,
  64.491 +    0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564,
  64.492 +    0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336,
  64.493 +    0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050,
  64.494 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059,
  64.495 +    0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062,
  64.496 +    0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50,
  64.497 +    0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f,
  64.498 +    0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
  64.499 +    0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
  64.500 +    0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000,
  64.501 +    0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
  64.502 +    0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f
  64.503 +};
  64.504 +#else
  64.505 +#error "An appropriate vertex shader is not defined."
  64.506 +#endif
  64.507 +
  64.508 +/* Direct3D 11.1 renderer implementation */
  64.509 +static SDL_Renderer *D3D11_CreateRenderer(SDL_Window * window, Uint32 flags);
  64.510 +static void D3D11_WindowEvent(SDL_Renderer * renderer,
  64.511 +                            const SDL_WindowEvent *event);
  64.512 +static int D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
  64.513 +static int D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
  64.514 +                             const SDL_Rect * rect, const void *srcPixels,
  64.515 +                             int srcPitch);
  64.516 +static int D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
  64.517 +                             const SDL_Rect * rect, void **pixels, int *pitch);
  64.518 +static void D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
  64.519 +static int D3D11_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
  64.520 +static int D3D11_UpdateViewport(SDL_Renderer * renderer);
  64.521 +static int D3D11_UpdateClipRect(SDL_Renderer * renderer);
  64.522 +static int D3D11_RenderClear(SDL_Renderer * renderer);
  64.523 +static int D3D11_RenderDrawPoints(SDL_Renderer * renderer,
  64.524 +                                  const SDL_FPoint * points, int count);
  64.525 +static int D3D11_RenderDrawLines(SDL_Renderer * renderer,
  64.526 +                                 const SDL_FPoint * points, int count);
  64.527 +static int D3D11_RenderFillRects(SDL_Renderer * renderer,
  64.528 +                                 const SDL_FRect * rects, int count);
  64.529 +static int D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
  64.530 +                            const SDL_Rect * srcrect, const SDL_FRect * dstrect);
  64.531 +static int D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
  64.532 +                              const SDL_Rect * srcrect, const SDL_FRect * dstrect,
  64.533 +                              const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip);
  64.534 +static int D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
  64.535 +                                  Uint32 format, void * pixels, int pitch);
  64.536 +static void D3D11_RenderPresent(SDL_Renderer * renderer);
  64.537 +static void D3D11_DestroyTexture(SDL_Renderer * renderer,
  64.538 +                                 SDL_Texture * texture);
  64.539 +static void D3D11_DestroyRenderer(SDL_Renderer * renderer);
  64.540 +
  64.541 +/* Direct3D 11.1 Internal Functions */
  64.542 +HRESULT D3D11_CreateDeviceResources(SDL_Renderer * renderer);
  64.543 +HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer);
  64.544 +HRESULT D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer);
  64.545 +HRESULT D3D11_HandleDeviceLost(SDL_Renderer * renderer);
  64.546 +
  64.547 +extern "C" SDL_RenderDriver D3D11_RenderDriver = {
  64.548 +    D3D11_CreateRenderer,
  64.549 +    {
  64.550 +        "direct3d 11.1",
  64.551 +        (
  64.552 +            SDL_RENDERER_ACCELERATED |
  64.553 +            SDL_RENDERER_PRESENTVSYNC |
  64.554 +            SDL_RENDERER_TARGETTEXTURE
  64.555 +        ),                          // flags.  see SDL_RendererFlags
  64.556 +        2,                          // num_texture_formats
  64.557 +        {                           // texture_formats
  64.558 +            SDL_PIXELFORMAT_RGB888,
  64.559 +            SDL_PIXELFORMAT_ARGB8888
  64.560 +        },
  64.561 +        0,                          // max_texture_width: will be filled in later
  64.562 +        0                           // max_texture_height: will be filled in later
  64.563 +    }
  64.564 +};
  64.565 +
  64.566 +
  64.567 +static Uint32
  64.568 +DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) {
  64.569 +    switch (dxgiFormat) {
  64.570 +        case DXGI_FORMAT_B8G8R8A8_UNORM:
  64.571 +            return SDL_PIXELFORMAT_ARGB8888;
  64.572 +        case DXGI_FORMAT_B8G8R8X8_UNORM:
  64.573 +            return SDL_PIXELFORMAT_RGB888;
  64.574 +        default:
  64.575 +            return SDL_PIXELFORMAT_UNKNOWN;
  64.576 +    }
  64.577 +}
  64.578 +
  64.579 +static DXGI_FORMAT
  64.580 +SDLPixelFormatToDXGIFormat(Uint32 sdlFormat)
  64.581 +{
  64.582 +    switch (sdlFormat) {
  64.583 +        case SDL_PIXELFORMAT_ARGB8888:
  64.584 +            return DXGI_FORMAT_B8G8R8A8_UNORM;
  64.585 +        case SDL_PIXELFORMAT_RGB888:
  64.586 +            return DXGI_FORMAT_B8G8R8X8_UNORM;
  64.587 +        default:
  64.588 +            return DXGI_FORMAT_UNKNOWN;
  64.589 +    }
  64.590 +}
  64.591 +
  64.592 +SDL_Renderer *
  64.593 +D3D11_CreateRenderer(SDL_Window * window, Uint32 flags)
  64.594 +{
  64.595 +    SDL_Renderer *renderer;
  64.596 +    D3D11_RenderData *data;
  64.597 +
  64.598 +    renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
  64.599 +    if (!renderer) {
  64.600 +        SDL_OutOfMemory();
  64.601 +        return NULL;
  64.602 +    }
  64.603 +    SDL_zerop(renderer);
  64.604 +
  64.605 +    data = new D3D11_RenderData;    // Use the C++ 'new' operator to make sure the struct's members initialize using C++ rules
  64.606 +    if (!data) {
  64.607 +        SDL_OutOfMemory();
  64.608 +        return NULL;
  64.609 +    }
  64.610 +    data->featureLevel = (D3D_FEATURE_LEVEL) 0;
  64.611 +    data->windowSizeInDIPs = XMFLOAT2(0, 0);
  64.612 +    data->renderTargetSize = XMFLOAT2(0, 0);
  64.613 +
  64.614 +    renderer->WindowEvent = D3D11_WindowEvent;
  64.615 +    renderer->CreateTexture = D3D11_CreateTexture;
  64.616 +    renderer->UpdateTexture = D3D11_UpdateTexture;
  64.617 +    renderer->LockTexture = D3D11_LockTexture;
  64.618 +    renderer->UnlockTexture = D3D11_UnlockTexture;
  64.619 +    renderer->SetRenderTarget = D3D11_SetRenderTarget;
  64.620 +    renderer->UpdateViewport = D3D11_UpdateViewport;
  64.621 +    renderer->UpdateClipRect = D3D11_UpdateClipRect;
  64.622 +    renderer->RenderClear = D3D11_RenderClear;
  64.623 +    renderer->RenderDrawPoints = D3D11_RenderDrawPoints;
  64.624 +    renderer->RenderDrawLines = D3D11_RenderDrawLines;
  64.625 +    renderer->RenderFillRects = D3D11_RenderFillRects;
  64.626 +    renderer->RenderCopy = D3D11_RenderCopy;
  64.627 +    renderer->RenderCopyEx = D3D11_RenderCopyEx;
  64.628 +    renderer->RenderReadPixels = D3D11_RenderReadPixels;
  64.629 +    renderer->RenderPresent = D3D11_RenderPresent;
  64.630 +    renderer->DestroyTexture = D3D11_DestroyTexture;
  64.631 +    renderer->DestroyRenderer = D3D11_DestroyRenderer;
  64.632 +    renderer->info = D3D11_RenderDriver.info;
  64.633 +    renderer->driverdata = data;
  64.634 +
  64.635 +    // HACK: make sure the SDL_Renderer references the SDL_Window data now, in
  64.636 +    // order to give init functions access to the underlying window handle:
  64.637 +    renderer->window = window;
  64.638 +
  64.639 +    /* Initialize Direct3D resources */
  64.640 +    if (FAILED(D3D11_CreateDeviceResources(renderer))) {
  64.641 +        D3D11_DestroyRenderer(renderer);
  64.642 +        return NULL;
  64.643 +    }
  64.644 +    if (FAILED(D3D11_CreateWindowSizeDependentResources(renderer))) {
  64.645 +        D3D11_DestroyRenderer(renderer);
  64.646 +        return NULL;
  64.647 +    }
  64.648 +
  64.649 +    // TODO, WinRT: fill in renderer->info.texture_formats where appropriate
  64.650 +
  64.651 +    return renderer;
  64.652 +}
  64.653 +
  64.654 +static void
  64.655 +D3D11_DestroyRenderer(SDL_Renderer * renderer)
  64.656 +{
  64.657 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
  64.658 +    if (data) {
  64.659 +        delete data;
  64.660 +        data = NULL;
  64.661 +    }
  64.662 +}
  64.663 +
  64.664 +static HRESULT
  64.665 +D3D11_CreateBlendMode(SDL_Renderer * renderer,
  64.666 +                      BOOL enableBlending,
  64.667 +                      D3D11_BLEND srcBlend,
  64.668 +                      D3D11_BLEND destBlend,
  64.669 +                      D3D11_BLEND srcBlendAlpha,
  64.670 +                      D3D11_BLEND destBlendAlpha,
  64.671 +                      ID3D11BlendState ** blendStateOutput)
  64.672 +{
  64.673 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
  64.674 +    HRESULT result = S_OK;
  64.675 +
  64.676 +    D3D11_BLEND_DESC blendDesc;
  64.677 +    memset(&blendDesc, 0, sizeof(blendDesc));
  64.678 +    blendDesc.AlphaToCoverageEnable = FALSE;
  64.679 +    blendDesc.IndependentBlendEnable = FALSE;
  64.680 +    blendDesc.RenderTarget[0].BlendEnable = enableBlending;
  64.681 +    blendDesc.RenderTarget[0].SrcBlend = srcBlend;
  64.682 +    blendDesc.RenderTarget[0].DestBlend = destBlend;
  64.683 +    blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
  64.684 +    blendDesc.RenderTarget[0].SrcBlendAlpha = srcBlendAlpha;
  64.685 +    blendDesc.RenderTarget[0].DestBlendAlpha = destBlendAlpha;
  64.686 +    blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
  64.687 +    blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
  64.688 +    result = data->d3dDevice->CreateBlendState(&blendDesc, blendStateOutput);
  64.689 +    if (FAILED(result)) {
  64.690 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBlendState", result);
  64.691 +        return result;
  64.692 +    }
  64.693 +
  64.694 +    return S_OK;
  64.695 +}
  64.696 +
  64.697 +// Create resources that depend on the device.
  64.698 +HRESULT
  64.699 +D3D11_CreateDeviceResources(SDL_Renderer * renderer)
  64.700 +{
  64.701 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
  64.702 +
  64.703 +    // This flag adds support for surfaces with a different color channel ordering
  64.704 +    // than the API default. It is required for compatibility with Direct2D.
  64.705 +    UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
  64.706 +
  64.707 +    // Make sure Direct3D's debugging feature gets used, if the app requests it.
  64.708 +    const char *hint = SDL_GetHint(SDL_HINT_RENDER_DIRECT3D11_DEBUG);
  64.709 +    if (hint) {
  64.710 +        if (*hint == '1') {
  64.711 +            creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
  64.712 +        }
  64.713 +    }
  64.714 +
  64.715 +    // This array defines the set of DirectX hardware feature levels this app will support.
  64.716 +    // Note the ordering should be preserved.
  64.717 +    // Don't forget to declare your application's minimum required feature level in its
  64.718 +    // description.  All applications are assumed to support 9.1 unless otherwise stated.
  64.719 +    D3D_FEATURE_LEVEL featureLevels[] = 
  64.720 +    {
  64.721 +        D3D_FEATURE_LEVEL_11_1,
  64.722 +        D3D_FEATURE_LEVEL_11_0,
  64.723 +        D3D_FEATURE_LEVEL_10_1,
  64.724 +        D3D_FEATURE_LEVEL_10_0,
  64.725 +        D3D_FEATURE_LEVEL_9_3,
  64.726 +        D3D_FEATURE_LEVEL_9_2,
  64.727 +        D3D_FEATURE_LEVEL_9_1
  64.728 +    };
  64.729 +
  64.730 +    // Create the Direct3D 11 API device object and a corresponding context.
  64.731 +    ComPtr<ID3D11Device> device;
  64.732 +    ComPtr<ID3D11DeviceContext> context;
  64.733 +    HRESULT result = S_OK;
  64.734 +    result = D3D11CreateDevice(
  64.735 +        nullptr, // Specify nullptr to use the default adapter.
  64.736 +        D3D_DRIVER_TYPE_HARDWARE,
  64.737 +        nullptr,
  64.738 +        creationFlags, // Set set debug and Direct2D compatibility flags.
  64.739 +        featureLevels, // List of feature levels this app can support.
  64.740 +        ARRAYSIZE(featureLevels),
  64.741 +        D3D11_SDK_VERSION, // Always set this to D3D11_SDK_VERSION for Windows Store apps.
  64.742 +        &device, // Returns the Direct3D device created.
  64.743 +        &data->featureLevel, // Returns feature level of device created.
  64.744 +        &context // Returns the device immediate context.
  64.745 +        );
  64.746 +    if (FAILED(result)) {
  64.747 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", D3D11CreateDevice", result);
  64.748 +        return result;
  64.749 +    }
  64.750 +
  64.751 +    // Get the Direct3D 11.1 API device and context interfaces.
  64.752 +    result = device.As(&(data->d3dDevice));
  64.753 +    if (FAILED(result)) {
  64.754 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device to ID3D11Device1", result);
  64.755 +        return result;
  64.756 +    }
  64.757 +
  64.758 +    result = context.As(&data->d3dContext);
  64.759 +    if (FAILED(result)) {
  64.760 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11DeviceContext to ID3D11DeviceContext1", result);
  64.761 +        return result;
  64.762 +    }
  64.763 +
  64.764 +    //
  64.765 +    // Make note of the maximum texture size
  64.766 +    // Max texture sizes are documented on MSDN, at:
  64.767 +    // http://msdn.microsoft.com/en-us/library/windows/apps/ff476876.aspx
  64.768 +    //
  64.769 +    switch (data->d3dDevice->GetFeatureLevel()) {
  64.770 +        case D3D_FEATURE_LEVEL_11_1:
  64.771 +        case D3D_FEATURE_LEVEL_11_0:
  64.772 +            renderer->info.max_texture_width = renderer->info.max_texture_height = 16384;
  64.773 +            break;
  64.774 +
  64.775 +        case D3D_FEATURE_LEVEL_10_1:
  64.776 +        case D3D_FEATURE_LEVEL_10_0:
  64.777 +            renderer->info.max_texture_width = renderer->info.max_texture_height = 8192;
  64.778 +            break;
  64.779 +
  64.780 +        case D3D_FEATURE_LEVEL_9_3:
  64.781 +            renderer->info.max_texture_width = renderer->info.max_texture_height = 4096;
  64.782 +            break;
  64.783 +
  64.784 +        case D3D_FEATURE_LEVEL_9_2:
  64.785 +        case D3D_FEATURE_LEVEL_9_1:
  64.786 +            renderer->info.max_texture_width = renderer->info.max_texture_height = 2048;
  64.787 +            break;
  64.788 +    }
  64.789 +
  64.790 +    //
  64.791 +    // Load in SDL's one and only vertex shader:
  64.792 +    //
  64.793 +    result = data->d3dDevice->CreateVertexShader(
  64.794 +        D3D11_VertexShader,
  64.795 +        sizeof(D3D11_VertexShader),
  64.796 +        nullptr,
  64.797 +        &data->vertexShader
  64.798 +        );
  64.799 +    if (FAILED(result)) {
  64.800 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateVertexShader", result);
  64.801 +        return result;
  64.802 +    }
  64.803 +
  64.804 +    //
  64.805 +    // Create an input layout for SDL's vertex shader:
  64.806 +    //
  64.807 +    const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = 
  64.808 +    {
  64.809 +        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  64.810 +        { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  64.811 +        { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  64.812 +    };
  64.813 +
  64.814 +    result = data->d3dDevice->CreateInputLayout(
  64.815 +        vertexDesc,
  64.816 +        ARRAYSIZE(vertexDesc),
  64.817 +        D3D11_VertexShader,
  64.818 +        sizeof(D3D11_VertexShader),
  64.819 +        &data->inputLayout
  64.820 +        );
  64.821 +    if (FAILED(result)) {
  64.822 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateInputLayout", result);
  64.823 +        return result;
  64.824 +    }
  64.825 +
  64.826 +    //
  64.827 +    // Load in SDL's pixel shaders
  64.828 +    //
  64.829 +
  64.830 +    result = data->d3dDevice->CreatePixelShader(
  64.831 +        D3D11_PixelShader_Textures,
  64.832 +        sizeof(D3D11_PixelShader_Textures),
  64.833 +        nullptr,
  64.834 +        &data->texturePixelShader
  64.835 +        );
  64.836 +    if (FAILED(result)) {
  64.837 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreatePixelShader ['textures' shader]", result);
  64.838 +        return result;
  64.839 +    }
  64.840 +
  64.841 +    result = data->d3dDevice->CreatePixelShader(
  64.842 +        D3D11_PixelShader_Colors,
  64.843 +        sizeof(D3D11_PixelShader_Colors),
  64.844 +        nullptr,
  64.845 +        &data->colorPixelShader
  64.846 +        );
  64.847 +    if (FAILED(result)) {
  64.848 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreatePixelShader ['color' shader]", result);
  64.849 +        return result;
  64.850 +    }
  64.851 +
  64.852 +    //
  64.853 +    // Setup space to hold vertex shader constants:
  64.854 +    //
  64.855 +    CD3D11_BUFFER_DESC constantBufferDesc(sizeof(VertexShaderConstants), D3D11_BIND_CONSTANT_BUFFER);
  64.856 +    result = data->d3dDevice->CreateBuffer(
  64.857 +		&constantBufferDesc,
  64.858 +		nullptr,
  64.859 +        &data->vertexShaderConstants
  64.860 +		);
  64.861 +    if (FAILED(result)) {
  64.862 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateBuffer [vertex shader constants]", result);
  64.863 +        return result;
  64.864 +    }
  64.865 +
  64.866 +    //
  64.867 +    // Make sure that the vertex buffer, if already created, gets freed.
  64.868 +    // It will be recreated later.
  64.869 +    //
  64.870 +    data->vertexBuffer = nullptr;
  64.871 +
  64.872 +    //
  64.873 +    // Create samplers to use when drawing textures:
  64.874 +    //
  64.875 +    D3D11_SAMPLER_DESC samplerDesc;
  64.876 +    samplerDesc.Filter = SDL_D3D11_NEAREST_PIXEL_FILTER;
  64.877 +    samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
  64.878 +    samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
  64.879 +    samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
  64.880 +    samplerDesc.MipLODBias = 0.0f;
  64.881 +    samplerDesc.MaxAnisotropy = 1;
  64.882 +    samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
  64.883 +    samplerDesc.BorderColor[0] = 0.0f;
  64.884 +    samplerDesc.BorderColor[1] = 0.0f;
  64.885 +    samplerDesc.BorderColor[2] = 0.0f;
  64.886 +    samplerDesc.BorderColor[3] = 0.0f;
  64.887 +    samplerDesc.MinLOD = 0.0f;
  64.888 +    samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
  64.889 +    result = data->d3dDevice->CreateSamplerState(
  64.890 +        &samplerDesc,
  64.891 +        &data->nearestPixelSampler
  64.892 +        );
  64.893 +    if (FAILED(result)) {
  64.894 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateSamplerState [nearest-pixel filter]", result);
  64.895 +        return result;
  64.896 +    }
  64.897 +
  64.898 +    samplerDesc.Filter = SDL_D3D11_LINEAR_FILTER;
  64.899 +    result = data->d3dDevice->CreateSamplerState(
  64.900 +        &samplerDesc,
  64.901 +        &data->linearSampler
  64.902 +        );
  64.903 +    if (FAILED(result)) {
  64.904 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateSamplerState [linear filter]", result);
  64.905 +        return result;
  64.906 +    }
  64.907 +
  64.908 +    //
  64.909 +    // Setup Direct3D rasterizer states
  64.910 +    //
  64.911 +    D3D11_RASTERIZER_DESC rasterDesc;
  64.912 +    memset(&rasterDesc, 0, sizeof(rasterDesc));
  64.913 +	rasterDesc.AntialiasedLineEnable = false;
  64.914 +	rasterDesc.CullMode = D3D11_CULL_NONE;
  64.915 +	rasterDesc.DepthBias = 0;
  64.916 +	rasterDesc.DepthBiasClamp = 0.0f;
  64.917 +	rasterDesc.DepthClipEnable = true;
  64.918 +	rasterDesc.FillMode = D3D11_FILL_SOLID;
  64.919 +	rasterDesc.FrontCounterClockwise = false;
  64.920 +	rasterDesc.MultisampleEnable = false;
  64.921 +	rasterDesc.ScissorEnable = false;
  64.922 +	rasterDesc.SlopeScaledDepthBias = 0.0f;
  64.923 +	result = data->d3dDevice->CreateRasterizerState(&rasterDesc, &data->mainRasterizer);
  64.924 +	if (FAILED(result)) {
  64.925 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRasterizerState [main rasterizer]", result);
  64.926 +        return result;
  64.927 +    }
  64.928 +
  64.929 +    rasterDesc.ScissorEnable = true;
  64.930 +    result = data->d3dDevice->CreateRasterizerState(&rasterDesc, &data->clippedRasterizer);
  64.931 +	if (FAILED(result)) {
  64.932 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRasterizerState [clipped rasterizer]", result);
  64.933 +        return result;
  64.934 +    }
  64.935 +
  64.936 +    //
  64.937 +    // Create blending states:
  64.938 +    //
  64.939 +    result = D3D11_CreateBlendMode(
  64.940 +        renderer,
  64.941 +        TRUE,
  64.942 +        D3D11_BLEND_SRC_ALPHA,          /* srcBlend */
  64.943 +        D3D11_BLEND_INV_SRC_ALPHA,      /* destBlend */
  64.944 +        D3D11_BLEND_ONE,                /* srcBlendAlpha */
  64.945 +        D3D11_BLEND_INV_SRC_ALPHA,      /* destBlendAlpha */
  64.946 +        &data->blendModeBlend);
  64.947 +    if (FAILED(result)) {
  64.948 +        // D3D11_CreateBlendMode will set the SDL error, if it fails
  64.949 +        return result;
  64.950 +    }
  64.951 +
  64.952 +    result = D3D11_CreateBlendMode(
  64.953 +        renderer,
  64.954 +        TRUE,
  64.955 +        D3D11_BLEND_SRC_ALPHA,          /* srcBlend */
  64.956 +        D3D11_BLEND_ONE,                /* destBlend */
  64.957 +        D3D11_BLEND_ZERO,               /* srcBlendAlpha */
  64.958 +        D3D11_BLEND_ONE,                /* destBlendAlpha */
  64.959 +        &data->blendModeAdd);
  64.960 +    if (FAILED(result)) {
  64.961 +        // D3D11_CreateBlendMode will set the SDL error, if it fails
  64.962 +        return result;
  64.963 +    }
  64.964 +
  64.965 +    result = D3D11_CreateBlendMode(
  64.966 +        renderer,
  64.967 +        TRUE,
  64.968 +        D3D11_BLEND_ZERO,               /* srcBlend */
  64.969 +        D3D11_BLEND_SRC_COLOR,          /* destBlend */
  64.970 +        D3D11_BLEND_ZERO,               /* srcBlendAlpha */
  64.971 +        D3D11_BLEND_ONE,                /* destBlendAlpha */
  64.972 +        &data->blendModeMod);
  64.973 +    if (FAILED(result)) {
  64.974 +        // D3D11_CreateBlendMode will set the SDL error, if it fails
  64.975 +        return result;
  64.976 +    }
  64.977 +
  64.978 +    //
  64.979 +    // All done!
  64.980 +    //
  64.981 +    return S_OK;
  64.982 +}
  64.983 +
  64.984 +#ifdef __WINRT__
  64.985 +
  64.986 +static ABI::Windows::UI::Core::ICoreWindow *
  64.987 +D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer * renderer)
  64.988 +{
  64.989 +    SDL_Window * sdlWindow = renderer->window;
  64.990 +    if ( ! renderer->window ) {
  64.991 +        return nullptr;
  64.992 +    }
  64.993 +
  64.994 +    SDL_SysWMinfo sdlWindowInfo;
  64.995 +    SDL_VERSION(&sdlWindowInfo.version);
  64.996 +    if ( ! SDL_GetWindowWMInfo(sdlWindow, &sdlWindowInfo) ) {
  64.997 +        return nullptr;
  64.998 +    }
  64.999 +
 64.1000 +    if (sdlWindowInfo.subsystem != SDL_SYSWM_WINRT) {
 64.1001 +        return nullptr;
 64.1002 +    }
 64.1003 +
 64.1004 +    if ( ! sdlWindowInfo.info.winrt.window ) {
 64.1005 +        return nullptr;
 64.1006 +    }
 64.1007 +
 64.1008 +    ABI::Windows::UI::Core::ICoreWindow * coreWindow = nullptr;
 64.1009 +    if (FAILED(sdlWindowInfo.info.winrt.window->QueryInterface(&coreWindow))) {
 64.1010 +        return nullptr;
 64.1011 +    }
 64.1012 +
 64.1013 +    return coreWindow;
 64.1014 +}
 64.1015 +
 64.1016 +// Method to convert a length in device-independent pixels (DIPs) to a length in physical pixels.
 64.1017 +static float
 64.1018 +D3D11_ConvertDipsToPixels(float dips)
 64.1019 +{
 64.1020 +    static const float dipsPerInch = 96.0f;
 64.1021 +    return floor(dips * DisplayProperties::LogicalDpi / dipsPerInch + 0.5f); // Round to nearest integer.
 64.1022 +}
 64.1023 +#endif
 64.1024 +
 64.1025 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
 64.1026 +// TODO, WinRT, XAML: get the ISwapChainBackgroundPanelNative from something other than a global var
 64.1027 +extern ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative;
 64.1028 +#endif
 64.1029 +
 64.1030 +static DXGI_MODE_ROTATION
 64.1031 +D3D11_GetRotationForOrientation(Windows::Graphics::Display::DisplayOrientations orientation)
 64.1032 +{
 64.1033 +    switch (orientation)
 64.1034 +    {
 64.1035 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
 64.1036 +        //
 64.1037 +        // Windows Phone rotations
 64.1038 +        //
 64.1039 +        case DisplayOrientations::Landscape:
 64.1040 +            return DXGI_MODE_ROTATION_ROTATE90;
 64.1041 +        case DisplayOrientations::Portrait:
 64.1042 +            return DXGI_MODE_ROTATION_IDENTITY;
 64.1043 +        case DisplayOrientations::LandscapeFlipped:
 64.1044 +            return DXGI_MODE_ROTATION_ROTATE270;
 64.1045 +        case DisplayOrientations::PortraitFlipped:
 64.1046 +            return DXGI_MODE_ROTATION_ROTATE180;
 64.1047 +#else
 64.1048 +        //
 64.1049 +        // Non-Windows-Phone rotations (ex: Windows 8, Windows RT)
 64.1050 +        //
 64.1051 +        case DisplayOrientations::Landscape:
 64.1052 +            return DXGI_MODE_ROTATION_IDENTITY;
 64.1053 +        case DisplayOrientations::Portrait:
 64.1054 +            return DXGI_MODE_ROTATION_ROTATE270;
 64.1055 +        case DisplayOrientations::LandscapeFlipped:
 64.1056 +            return DXGI_MODE_ROTATION_ROTATE180;
 64.1057 +        case DisplayOrientations::PortraitFlipped:
 64.1058 +            return DXGI_MODE_ROTATION_ROTATE90;
 64.1059 +#endif // WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
 64.1060 +
 64.1061 +        default:
 64.1062 +            return DXGI_MODE_ROTATION_UNSPECIFIED;
 64.1063 +    }
 64.1064 +}
 64.1065 +
 64.1066 +static bool
 64.1067 +D3D11_IsDisplayRotated90Degrees(Windows::Graphics::Display::DisplayOrientations orientation)
 64.1068 +{
 64.1069 +    switch (D3D11_GetRotationForOrientation(orientation)) {
 64.1070 +        case DXGI_MODE_ROTATION_ROTATE90:
 64.1071 +        case DXGI_MODE_ROTATION_ROTATE270:
 64.1072 +            return true;
 64.1073 +        default:
 64.1074 +            return false;
 64.1075 +    }
 64.1076 +}
 64.1077 +
 64.1078 +static int
 64.1079 +D3D11_GetViewportAlignedD3DRect(SDL_Renderer * renderer, const SDL_Rect * sdlRect, D3D11_RECT * outRect)
 64.1080 +{
 64.1081 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
 64.1082 +    switch (D3D11_GetRotationForOrientation(data-> orientation)) {
 64.1083 +        case DXGI_MODE_ROTATION_IDENTITY:
 64.1084 +            outRect->left = sdlRect->x;
 64.1085 +            outRect->right = sdlRect->x + sdlRect->w;
 64.1086 +            outRect->top = sdlRect->y;
 64.1087 +            outRect->bottom = sdlRect->y + sdlRect->h;
 64.1088 +            break;
 64.1089 +        case DXGI_MODE_ROTATION_ROTATE270:
 64.1090 +            outRect->left = sdlRect->y;
 64.1091 +            outRect->right = sdlRect->y + sdlRect->h;
 64.1092 +            outRect->top = renderer->viewport.w - sdlRect->x - sdlRect->w;
 64.1093 +            outRect->bottom = renderer->viewport.w - sdlRect->x;
 64.1094 +            break;
 64.1095 +        case DXGI_MODE_ROTATION_ROTATE180:
 64.1096 +            outRect->left = renderer->viewport.w - sdlRect->x - sdlRect->w;
 64.1097 +            outRect->right = renderer->viewport.w - sdlRect->x;
 64.1098 +            outRect->top = renderer->viewport.h - sdlRect->y - sdlRect->h;
 64.1099 +            outRect->bottom = renderer->viewport.h - sdlRect->y;
 64.1100 +            break;
 64.1101 +        case DXGI_MODE_ROTATION_ROTATE90:
 64.1102 +            outRect->left = renderer->viewport.h - sdlRect->y - sdlRect->h;
 64.1103 +            outRect->right = renderer->viewport.h - sdlRect->y;
 64.1104 +            outRect->top = sdlRect->x;
 64.1105 +            outRect->bottom = sdlRect->x + sdlRect->h;
 64.1106 +            break;
 64.1107 +        default:
 64.1108 +            return SDL_SetError("The physical display is in an unknown or unsupported orientation");
 64.1109 +    }
 64.1110 +    return 0;
 64.1111 +}
 64.1112 +
 64.1113 +
 64.1114 +// Initialize all resources that change when the window's size changes.
 64.1115 +// TODO, WinRT: get D3D11_CreateWindowSizeDependentResources working on Win32
 64.1116 +HRESULT
 64.1117 +D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer)
 64.1118 +{
 64.1119 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
 64.1120 +    HRESULT result = S_OK;
 64.1121 +    ABI::Windows::UI::Core::ICoreWindow * coreWindow = D3D11_GetCoreWindowFromSDLRenderer(renderer);
 64.1122 +
 64.1123 +    // Store the window bounds so the next time we get a SizeChanged event we can
 64.1124 +    // avoid rebuilding everything if the size is identical.
 64.1125 +    ABI::Windows::Foundation::Rect nativeWindowBounds;
 64.1126 +    if (coreWindow) {
 64.1127 +        result = coreWindow->get_Bounds(&nativeWindowBounds);
 64.1128 +        if (FAILED(result)) {
 64.1129 +            WIN_SetErrorFromHRESULT(__FUNCTION__", ICoreWindow::get_Bounds [get native-window bounds]", result);
 64.1130 +            return result;
 64.1131 +        }
 64.1132 +    } else {
 64.1133 +        // TODO, WinRT, XAML: clean up window-bounds code in D3D11_CreateWindowSizeDependentResources
 64.1134 +        SDL_DisplayMode displayMode;
 64.1135 +        if (SDL_GetDesktopDisplayMode(0, &displayMode) < 0) {
 64.1136 +            SDL_SetError(__FUNCTION__", Get Window Bounds (XAML): Unable to retrieve the native window's size");
 64.1137 +            return E_FAIL;
 64.1138 +        }
 64.1139 +
 64.1140 +        nativeWindowBounds.Width = (FLOAT) displayMode.w;
 64.1141 +        nativeWindowBounds.Height = (FLOAT) displayMode.h;
 64.1142 +    }
 64.1143 +
 64.1144 +    // TODO, WinRT, XAML: see if window/control sizes are in DIPs, or something else.  If something else, then adjust renderer size tracking accordingly.
 64.1145 +    data->windowSizeInDIPs.x = nativeWindowBounds.Width;
 64.1146 +    data->windowSizeInDIPs.y = nativeWindowBounds.Height;
 64.1147 +
 64.1148 +    // Calculate the necessary swap chain and render target size in pixels.
 64.1149 +    float windowWidth = D3D11_ConvertDipsToPixels(data->windowSizeInDIPs.x);
 64.1150 +    float windowHeight = D3D11_ConvertDipsToPixels(data->windowSizeInDIPs.y);
 64.1151 +
 64.1152 +    // The width and height of the swap chain must be based on the window's
 64.1153 +    // landscape-oriented width and height. If the window is in a portrait
 64.1154 +    // orientation, the dimensions must be reversed.
 64.1155 +    data->orientation = DisplayProperties::CurrentOrientation;
 64.1156 +
 64.1157 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
 64.1158 +    const bool swapDimensions = false;
 64.1159 +#else
 64.1160 +    const bool swapDimensions = D3D11_IsDisplayRotated90Degrees(data->orientation);
 64.1161 +#endif
 64.1162 +    data->renderTargetSize.x = swapDimensions ? windowHeight : windowWidth;
 64.1163 +    data->renderTargetSize.y = swapDimensions ? windowWidth : windowHeight;
 64.1164 +
 64.1165 +    if(data->swapChain != nullptr)
 64.1166 +    {
 64.1167 +        // If the swap chain already exists, resize it.
 64.1168 +        result = data->swapChain->ResizeBuffers(
 64.1169 +            2, // Double-buffered swap chain.
 64.1170 +            static_cast<UINT>(data->renderTargetSize.x),
 64.1171 +            static_cast<UINT>(data->renderTargetSize.y),
 64.1172 +            DXGI_FORMAT_B8G8R8A8_UNORM,
 64.1173 +            0
 64.1174 +            );
 64.1175 +        if (FAILED(result)) {
 64.1176 +            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain1::ResizeBuffers", result);
 64.1177 +            return result;
 64.1178 +        }
 64.1179 +    }
 64.1180 +    else
 64.1181 +    {
 64.1182 +        const bool usingXAML = (coreWindow == nullptr);
 64.1183 +
 64.1184 +        // Otherwise, create a new one using the same adapter as the existing Direct3D device.
 64.1185 +        DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};
 64.1186 +        swapChainDesc.Width = static_cast<UINT>(data->renderTargetSize.x); // Match the size of the window.
 64.1187 +        swapChainDesc.Height = static_cast<UINT>(data->renderTargetSize.y);
 64.1188 +        swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // This is the most common swap chain format.
 64.1189 +        swapChainDesc.Stereo = false;
 64.1190 +        swapChainDesc.SampleDesc.Count = 1; // Don't use multi-sampling.
 64.1191 +        swapChainDesc.SampleDesc.Quality = 0;
 64.1192 +        swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
 64.1193 +        swapChainDesc.BufferCount = 2; // Use double-buffering to minimize latency.
 64.1194 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
 64.1195 +        swapChainDesc.Scaling = DXGI_SCALING_STRETCH; // On phone, only stretch and aspect-ratio stretch scaling are allowed.
 64.1196 +        swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; // On phone, no swap effects are supported.
 64.1197 +#else
 64.1198 +        if (usingXAML) {
 64.1199 +            swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
 64.1200 +        } else {
 64.1201 +            swapChainDesc.Scaling = DXGI_SCALING_NONE;
 64.1202 +        }
 64.1203 +        swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // All Windows Store apps must use this SwapEffect.
 64.1204 +#endif
 64.1205 +        swapChainDesc.Flags = 0;
 64.1206 +
 64.1207 +        ComPtr<IDXGIDevice1> dxgiDevice;
 64.1208 +        result = data->d3dDevice.As(&dxgiDevice);
 64.1209 +        if (FAILED(result)) {
 64.1210 +            WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1 to IDXGIDevice1", result);
 64.1211 +            return result;
 64.1212 +        }
 64.1213 +
 64.1214 +        ComPtr<IDXGIAdapter> dxgiAdapter;
 64.1215 +        result = dxgiDevice->GetAdapter(&dxgiAdapter);
 64.1216 +        if (FAILED(result)) {
 64.1217 +            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIDevice1::GetAdapter", result);
 64.1218 +            return result;
 64.1219 +        }
 64.1220 +
 64.1221 +        ComPtr<IDXGIFactory2> dxgiFactory;
 64.1222 +        result = dxgiAdapter->GetParent(
 64.1223 +            __uuidof(IDXGIFactory2), 
 64.1224 +            &dxgiFactory
 64.1225 +            );
 64.1226 +        if (FAILED(result)) {
 64.1227 +            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIAdapter::GetParent", result);
 64.1228 +            return result;
 64.1229 +        }
 64.1230 +
 64.1231 +        if (usingXAML) {
 64.1232 +            result = dxgiFactory->CreateSwapChainForComposition(
 64.1233 +                data->d3dDevice.Get(),
 64.1234 +                &swapChainDesc,
 64.1235 +                nullptr,
 64.1236 +                &data->swapChain);
 64.1237 +            if (FAILED(result)) {
 64.1238 +                WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory2::CreateSwapChainForComposition", result);
 64.1239 +                return result;
 64.1240 +            }
 64.1241 +
 64.1242 +#if WINAPI_FAMILY == WINAPI_FAMILY_APP
 64.1243 +            result = WINRT_GlobalSwapChainBackgroundPanelNative->SetSwapChain(data->swapChain.Get());
 64.1244 +            if (FAILED(result)) {
 64.1245 +                WIN_SetErrorFromHRESULT(__FUNCTION__ ", ISwapChainBackgroundPanelNative::SetSwapChain", result);
 64.1246 +                return result;
 64.1247 +            }
 64.1248 +#else
 64.1249 +            SDL_SetError(__FUNCTION__ ", XAML support is not yet available for Windows Phone");
 64.1250 +            return E_FAIL;
 64.1251 +#endif
 64.1252 +        } else {
 64.1253 +            IUnknown * coreWindowAsIUnknown = nullptr;
 64.1254 +            result = coreWindow->QueryInterface(&coreWindowAsIUnknown);
 64.1255 +            if (FAILED(result)) {
 64.1256 +                WIN_SetErrorFromHRESULT(__FUNCTION__ ", ICoreWindow to IUnknown", result);
 64.1257 +                return result;
 64.1258 +            }
 64.1259 +
 64.1260 +            result = dxgiFactory->CreateSwapChainForCoreWindow(
 64.1261 +                data->d3dDevice.Get(),
 64.1262 +                coreWindowAsIUnknown,
 64.1263 +                &swapChainDesc,
 64.1264 +                nullptr, // Allow on all displays.
 64.1265 +                &data->swapChain
 64.1266 +                );
 64.1267 +            if (FAILED(result)) {
 64.1268 +                WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIFactory2::CreateSwapChainForCoreWindow", result);
 64.1269 +                return result;
 64.1270 +            }
 64.1271 +        }
 64.1272 +        
 64.1273 +        // Ensure that DXGI does not queue more than one frame at a time. This both reduces latency and
 64.1274 +        // ensures that the application will only render after each VSync, minimizing power consumption.
 64.1275 +        result = dxgiDevice->SetMaximumFrameLatency(1);
 64.1276 +        if (FAILED(result)) {
 64.1277 +            WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGIDevice1::SetMaximumFrameLatency", result);
 64.1278 +            return result;
 64.1279 +        }
 64.1280 +    }
 64.1281 +    
 64.1282 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
 64.1283 +    // Set the proper orientation for the swap chain, and generate the
 64.1284 +    // 3D matrix transformation for rendering to the rotated swap chain.
 64.1285 +    //
 64.1286 +    // To note, the call for this, IDXGISwapChain1::SetRotation, is not necessary
 64.1287 +    // on Windows Phone, nor is it supported there.  It's only needed in Windows 8/RT.
 64.1288 +    DXGI_MODE_ROTATION rotation = D3D11_GetRotationForOrientation(data->orientation);
 64.1289 +    result = data->swapChain->SetRotation(rotation);
 64.1290 +    if (FAILED(result)) {
 64.1291 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain1::SetRotation" , result);
 64.1292 +        return result;
 64.1293 +    }
 64.1294 +#endif
 64.1295 +
 64.1296 +    // Create a render target view of the swap chain back buffer.
 64.1297 +    ComPtr<ID3D11Texture2D> backBuffer;
 64.1298 +    result = data->swapChain->GetBuffer(
 64.1299 +        0,
 64.1300 +        __uuidof(ID3D11Texture2D),
 64.1301 +        &backBuffer
 64.1302 +        );
 64.1303 +    if (FAILED(result)) {
 64.1304 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", IDXGISwapChain1::GetBuffer [back-buffer]", result);
 64.1305 +        return result;
 64.1306 +    }
 64.1307 +
 64.1308 +    result = data->d3dDevice->CreateRenderTargetView(
 64.1309 +        backBuffer.Get(),
 64.1310 +        nullptr,
 64.1311 +        &data->mainRenderTargetView
 64.1312 +        );
 64.1313 +    if (FAILED(result)) {
 64.1314 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRenderTargetView", result);
 64.1315 +        return result;
 64.1316 +    }
 64.1317 +
 64.1318 +    if (D3D11_UpdateViewport(renderer) != 0) {
 64.1319 +        // D3D11_UpdateViewport will set the SDL error if it fails.
 64.1320 +        return E_FAIL;
 64.1321 +    }
 64.1322 +
 64.1323 +    return S_OK;
 64.1324 +}
 64.1325 +
 64.1326 +// This method is called when the window's size changes.
 64.1327 +HRESULT
 64.1328 +D3D11_UpdateForWindowSizeChange(SDL_Renderer * renderer)
 64.1329 +{
 64.1330 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
 64.1331 +    HRESULT result = S_OK;
 64.1332 +    ABI::Windows::UI::Core::ICoreWindow * coreWindow = D3D11_GetCoreWindowFromSDLRenderer(renderer);
 64.1333 +    ABI::Windows::Foundation::Rect coreWindowBounds;
 64.1334 +
 64.1335 +    result = coreWindow->get_Bounds(&coreWindowBounds);
 64.1336 +    if (FAILED(result)) {
 64.1337 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ICoreWindow::get_Bounds [get window bounds]", result);
 64.1338 +        return result;
 64.1339 +    }
 64.1340 +
 64.1341 +    if (coreWindowBounds.Width  != data->windowSizeInDIPs.x ||
 64.1342 +        coreWindowBounds.Height != data->windowSizeInDIPs.y ||
 64.1343 +        data->orientation != DisplayProperties::CurrentOrientation)
 64.1344 +    {
 64.1345 +        ID3D11RenderTargetView* nullViews[] = {nullptr};
 64.1346 +        data->d3dContext->OMSetRenderTargets(ARRAYSIZE(nullViews), nullViews, nullptr);
 64.1347 +        data->mainRenderTargetView = nullptr;
 64.1348 +        data->d3dContext->Flush();
 64.1349 +        result = D3D11_CreateWindowSizeDependentResources(renderer);
 64.1350 +        if (FAILED(result)) {
 64.1351 +            /* D3D11_CreateWindowSizeDependentResources will set the SDL error */
 64.1352 +            return result;
 64.1353 +        }
 64.1354 +    }
 64.1355 +
 64.1356 +    return S_OK;
 64.1357 +}
 64.1358 +
 64.1359 +HRESULT
 64.1360 +D3D11_HandleDeviceLost(SDL_Renderer * renderer)
 64.1361 +{
 64.1362 +    D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
 64.1363 +    HRESULT result = S_OK;
 64.1364 +
 64.1365 +    // Reset these member variables to ensure that D3D11_UpdateForWindowSizeChange recreates all resources.
 64.1366 +    data->windowSizeInDIPs.x = 0;
 64.1367 +    data->windowSizeInDIPs.y = 0;
 64.1368 +    data->swapChain = nullptr;
 64.1369 +
 64.1370 +    result = D3D11_CreateDeviceResources(renderer);
 64.1371 +    if (FAILED(result)) {
 64.1372 +        /* D3D11_CreateDeviceResources will set the SDL error */
 64.1373 +        return result;
 64.1374 +    }
 64.1375 +
 64.1376 +    result = D3D11_UpdateForWindowSizeChange(renderer);
 64.1377 +    if (FAILED(result)) {
 64.1378 +        /* D3D11_UpdateForWindowSizeChange will set the SDL error */
 64.1379 +        return result;
 64.1380 +    }
 64.1381 +
 64.1382 +    return S_OK;
 64.1383 +}
 64.1384 +
 64.1385 +static void
 64.1386 +D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
 64.1387 +{
 64.1388 +    //D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
 64.1389 +
 64.1390 +    if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
 64.1391 +        D3D11_UpdateForWindowSizeChange(renderer);
 64.1392 +    }
 64.1393 +}
 64.1394 +
 64.1395 +static D3D11_FILTER
 64.1396 +GetScaleQuality(void)
 64.1397 +{
 64.1398 +    const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
 64.1399 +    if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
 64.1400 +        return SDL_D3D11_NEAREST_PIXEL_FILTER;
 64.1401 +    } else /* if (*hint == '1' || SDL_strcasecmp(hint, "linear") == 0) */ {
 64.1402 +        return SDL_D3D11_LINEAR_FILTER;
 64.1403 +    }
 64.1404 +}
 64.1405 +
 64.1406 +static int
 64.1407 +D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
 64.1408 +{
 64.1409 +    D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
 64.1410 +    D3D11_TextureData *textureData;
 64.1411 +    HRESULT result;
 64.1412 +    DXGI_FORMAT textureFormat = SDLPixelFormatToDXGIFormat(texture->format);
 64.1413 +    if (textureFormat == SDL_PIXELFORMAT_UNKNOWN) {
 64.1414 +        return SDL_SetError("%s, An unsupported SDL pixel format (0x%x) was specified",
 64.1415 +            __FUNCTION__, texture->format);
 64.1416 +    }
 64.1417 +
 64.1418 +    textureData = new D3D11_TextureData;
 64.1419 +    if (!textureData) {
 64.1420 +        SDL_OutOfMemory();
 64.1421 +        return -1;
 64.1422 +    }
 64.1423 +    textureData->pixelFormat = SDL_AllocFormat(texture->format);
 64.1424 +    textureData->lockedTexturePosition = XMINT2(0, 0);
 64.1425 +    textureData->scaleMode = GetScaleQuality();
 64.1426 +
 64.1427 +    texture->driverdata = textureData;
 64.1428 +
 64.1429 +    D3D11_TEXTURE2D_DESC textureDesc = {0};
 64.1430 +    textureDesc.Width = texture->w;
 64.1431 +    textureDesc.Height = texture->h;
 64.1432 +    textureDesc.MipLevels = 1;
 64.1433 +    textureDesc.ArraySize = 1;
 64.1434 +    textureDesc.Format = textureFormat;
 64.1435 +    textureDesc.SampleDesc.Count = 1;
 64.1436 +    textureDesc.SampleDesc.Quality = 0;
 64.1437 +    textureDesc.MiscFlags = 0;
 64.1438 +
 64.1439 +    if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
 64.1440 +        textureDesc.Usage = D3D11_USAGE_DYNAMIC;
 64.1441 +        textureDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
 64.1442 +    } else {
 64.1443 +        textureDesc.Usage = D3D11_USAGE_DEFAULT;
 64.1444 +        textureDesc.CPUAccessFlags = 0;
 64.1445 +    }
 64.1446 +
 64.1447 +    if (texture->access == SDL_TEXTUREACCESS_TARGET) {
 64.1448 +        textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
 64.1449 +    } else {
 64.1450 +        textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
 64.1451 +    }
 64.1452 +
 64.1453 +#if 0
 64.1454 +    // Fill the texture with a non-black color, for debugging purposes:
 64.1455 +    const int numPixels = textureDesc.Width * textureDesc.Height;
 64.1456 +    const int pixelSizeInBytes = textureData->pixelFormat->BytesPerPixel;
 64.1457 +    std::vector<uint8> initialTexturePixels(numPixels * pixelSizeInBytes, 0x00);
 64.1458 +    for (int i = 0; i < (numPixels * pixelSizeInBytes); i += pixelSizeInBytes) {
 64.1459 +        initialTexturePixels[i+0] = 0xff;
 64.1460 +        initialTexturePixels[i+1] = 0xff;
 64.1461 +        initialTexturePixels[i+2] = 0x00;
 64.1462 +        initialTexturePixels[i+3] = 0xff;
 64.1463 +    }
 64.1464 +    D3D11_SUBRESOURCE_DATA initialTextureData = {0};
 64.1465 +    initialTextureData.pSysMem = (void *)&(initialTexturePixels[0]);
 64.1466 +    initialTextureData.SysMemPitch = textureDesc.Width * pixelSizeInBytes;
 64.1467 +    initialTextureData.SysMemSlicePitch = numPixels * pixelSizeInBytes;
 64.1468 +#endif
 64.1469 +
 64.1470 +    result = rendererData->d3dDevice->CreateTexture2D(
 64.1471 +        &textureDesc,
 64.1472 +        NULL,   // &initialTextureData,
 64.1473 +        &textureData->mainTexture
 64.1474 +        );
 64.1475 +    if (FAILED(result)) {
 64.1476 +        D3D11_DestroyTexture(renderer, texture);
 64.1477 +        WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateTexture2D", result);
 64.1478 +        return -1;
 64.1479 +    }
 64.1480 +
 64.1481 +    if (texture->access & SDL_TEXTUREACCESS_TARGET) {
 64.1482 +        D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc;
 64.1483 +        renderTargetViewDesc.Format = textureDesc.Format;
 64.1484 +        renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
 64.1485 +        renderTargetViewDesc.Texture2D.MipSlice = 0;
 64.1486 +
 64.1487 +        result = rendererData->d3dDevice->CreateRenderTargetView(
 64.1488 +            textureData->mainTexture.Get(),
 64.1489 +            &renderTargetViewDesc,
 64.1490 +            &textureData->mainTextureRenderTargetView);
 64.1491 +        if (FAILED(result)) {
 64.1492 +            D3D11_DestroyTexture(renderer, texture);
 64.1493 +            WIN_SetErrorFromHRESULT(__FUNCTION__ ", ID3D11Device1::CreateRenderTargetView", result);
 64.1494 +            return -1;
 64.1495 +        }
 64.1496 +    }
 64.1497 +
 64.1498 +    D3D11_SHADER_RESOURCE_VIEW_DESC resourceViewDesc;
 64.1499 +    resourceViewDesc.Format = textureDesc.Format;
 64.1500 +    resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
 64.1501 +    resourceViewDesc.Texture2D.MostDetailedMip = 0;
 64.1502 +    resourceViewDesc.Texture2D.MipLevels = textureDesc.MipLevels;
 64.1503 +    result = rendererData->d3dDevice->CreateShaderResourceView(
 64.1504 +        textureData->mainTexture.Get(),