d04f710fcda230c28e212f5f2dcdb55658d91b1a
[platform/upstream/SDL.git] / docs / README-winrt.md
1 WinRT\r
2 =====\r
3 \r
4 This port allows SDL applications to run on Microsoft's platforms that require\r
5 use of "Windows Runtime", aka. "WinRT", APIs.  Microsoft may, in some cases,\r
6 refer to them as either "Windows Store", or for Windows 10, "UWP" apps.\r
7 \r
8 Some of the operating systems that include WinRT, are:\r
9 \r
10 * Windows 10, via its Universal Windows Platform (UWP) APIs\r
11 * Windows 8.x\r
12 * Windows RT 8.x (aka. Windows 8.x for ARM processors)\r
13 * Windows Phone 8.x\r
14 \r
15 \r
16 Requirements\r
17 ------------\r
18 \r
19 * Microsoft Visual C++ (aka Visual Studio), either 2017, 2015, 2013, or 2012\r
20   - Free, "Community" or "Express" editions may be used, so long as they\r
21     include  support for either "Windows Store" or "Windows Phone" apps.\r
22     "Express" versions marked as supporting "Windows Desktop" development\r
23     typically do not include support for creating WinRT apps, to note.\r
24     (The "Community" editions of Visual C++ do, however, support both\r
25     desktop/Win32 and WinRT development).\r
26   - Visual Studio 2017 can be used, however it is recommended that you install\r
27     the Visual C++ 2015 build tools.  These build tools can be installed\r
28     using VS 2017's installer.  Be sure to also install the workload for\r
29     "Universal Windows Platform development", its optional component, the\r
30     "C++ Universal Windows Platform tools", and for UWP / Windows 10\r
31     development, the "Windows 10 SDK (10.0.10240.0)".  Please note that\r
32     targeting UWP / Windows 10 apps from development machine(s) running\r
33     earlier versions of Windows, such as Windows 7, is not always supported\r
34     by Visual Studio, and you may get error(s) when attempting to do so.\r
35   - Visual C++ 2012 can only build apps that target versions 8.0 of Windows,\r
36     or  Windows Phone.  8.0-targeted apps will run on devices running 8.1\r
37     editions of Windows, however they will not be able to take advantage of\r
38     8.1-specific features.\r
39   - Visual C++ 2013 cannot create app projects that target Windows 8.0.\r
40     Visual C++ 2013 Update 4, can create app projects for Windows Phone 8.0,\r
41     Windows Phone 8.1, and Windows 8.1, but not Windows 8.0.  An optional\r
42     Visual Studio add-in, "Tools for Maintaining Store apps for Windows 8",\r
43     allows Visual C++ 2013 to load and build Windows 8.0 projects that were\r
44     created with Visual C++ 2012, so long as Visual C++ 2012 is installed\r
45     on the same machine.  More details on targeting different versions of\r
46     Windows can found at the following web pages:\r
47       - [Develop apps by using Visual Studio 2013](http://msdn.microsoft.com/en-us/library/windows/apps/br211384.aspx)\r
48       - [To add the Tools for Maintaining Store apps for Windows 8](http://msdn.microsoft.com/en-us/library/windows/apps/dn263114.aspx#AddMaintenanceTools)\r
49 * A valid Microsoft account - This requirement is not imposed by SDL, but\r
50   rather by Microsoft's Visual C++ toolchain.  This is required to launch or \r
51   debug apps.\r
52 \r
53 \r
54 Status\r
55 ------\r
56 \r
57 Here is a rough list of what works, and what doesn't:\r
58 \r
59 * What works:\r
60   * compilation via Visual C++ 2012 through 2015\r
61   * compile-time platform detection for SDL programs.  The C/C++ #define,\r
62     `__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT.\r
63   * GPU-accelerated 2D rendering, via SDL_Renderer.\r
64   * OpenGL ES 2, via the ANGLE library (included separately from SDL)\r
65   * software rendering, via either SDL_Surface (optionally in conjunction with\r
66     SDL_GetWindowSurface() and SDL_UpdateWindowSurface()) or via the\r
67     SDL_Renderer APIs\r
68   * threads\r
69   * timers (via SDL_GetTicks(), SDL_AddTimer(), SDL_GetPerformanceCounter(),\r
70     SDL_GetPerformanceFrequency(), etc.)\r
71   * file I/O via SDL_RWops\r
72   * mouse input  (unsupported on Windows Phone)\r
73   * audio, via SDL's WASAPI backend (if you want to record, your app must \r
74     have "Microphone" capabilities enabled in its manifest, and the user must \r
75     not have blocked access. Otherwise, capture devices will fail to work,\r
76     presenting as a device disconnect shortly after opening it.)\r
77   * .DLL file loading.  Libraries *MUST* be packaged inside applications.  Loading\r
78     anything outside of the app is not supported.\r
79   * system path retrieval via SDL's filesystem APIs\r
80   * game controllers.  Support is provided via the SDL_Joystick and\r
81     SDL_GameController APIs, and is backed by Microsoft's XInput API.  Please\r
82     note, however, that Windows limits game-controller support in UWP apps to,\r
83     "Xbox compatible controllers" (many controllers that work in Win32 apps,\r
84     do not work in UWP, due to restrictions in UWP itself.) \r
85   * multi-touch input\r
86   * app events.  SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events get sent out as\r
87     appropriate.\r
88   * window events\r
89   * using Direct3D 11.x APIs outside of SDL.  Non-XAML / Direct3D-only apps can\r
90     choose to render content directly via Direct3D, using SDL to manage the\r
91     internal WinRT window, as well as input and audio.  (Use\r
92     SDL_GetWindowWMInfo() to get the WinRT 'CoreWindow', and pass it into\r
93     IDXGIFactory2::CreateSwapChainForCoreWindow() as appropriate.)\r
94 \r
95 * What partially works:\r
96   * keyboard input.  Most of WinRT's documented virtual keys are supported, as\r
97     well as many keys with documented hardware scancodes.  Converting\r
98     SDL_Scancodes to or from SDL_Keycodes may not work, due to missing APIs\r
99     (MapVirtualKey()) in Microsoft's Windows Store / UWP APIs.\r
100   * SDLmain.  WinRT uses a different signature for each app's main() function.\r
101     SDL-based apps that use this port must compile in SDL_winrt_main_NonXAML.cpp\r
102     (in `SDL\src\main\winrt\`) directly in order for their C-style main()\r
103     functions to be called.\r
104 \r
105 * What doesn't work:\r
106   * compilation with anything other than Visual C++\r
107   * programmatically-created custom cursors.  These don't appear to be supported\r
108     by WinRT.  Different OS-provided cursors can, however, be created via\r
109     SDL_CreateSystemCursor() (unsupported on Windows Phone)\r
110   * SDL_WarpMouseInWindow() or SDL_WarpMouseGlobal().  This are not currently\r
111     supported by WinRT itself.\r
112   * joysticks and game controllers that either are not supported by\r
113     Microsoft's XInput API, or are not supported within UWP apps (many\r
114     controllers that work in Win32, do not work in UWP, due to restrictions in\r
115     UWP itself).\r
116   * turning off VSync when rendering on Windows Phone.  Attempts to turn VSync\r
117     off on Windows Phone result either in Direct3D not drawing anything, or it\r
118     forcing VSync back on.  As such, SDL_RENDERER_PRESENTVSYNC will always get\r
119     turned-on on Windows Phone.  This limitation is not present in non-Phone\r
120     WinRT (such as Windows 8.x), where turning off VSync appears to work.\r
121   * probably anything else that's not listed as supported\r
122 \r
123 \r
124 \r
125 Upgrade Notes\r
126 -------------\r
127 \r
128 #### SDL_GetPrefPath() usage when upgrading WinRT apps from SDL 2.0.3\r
129 \r
130 SDL 2.0.4 fixes two bugs found in the WinRT version of SDL_GetPrefPath().\r
131 The fixes may affect older, SDL 2.0.3-based apps' save data.  Please note\r
132 that these changes only apply to SDL-based WinRT apps, and not to apps for\r
133 any other platform.\r
134 \r
135 1. SDL_GetPrefPath() would return an invalid path, one in which the path's\r
136    directory had not been created.  Attempts to create files there\r
137    (via fopen(), for example), would fail, unless that directory was\r
138    explicitly created beforehand.\r
139 \r
140 2. SDL_GetPrefPath(), for non-WinPhone-based apps, would return a path inside\r
141    a WinRT 'Roaming' folder, the contents of which get automatically\r
142    synchronized across multiple devices.  This process can occur while an\r
143    application runs, and can cause existing save-data to be overwritten\r
144    at unexpected times, with data from other devices.  (Windows Phone apps\r
145    written with SDL 2.0.3 did not utilize a Roaming folder, due to API\r
146    restrictions in Windows Phone 8.0).\r
147 \r
148 \r
149 SDL_GetPrefPath(), starting with SDL 2.0.4, addresses these by:\r
150 \r
151 1. making sure that SDL_GetPrefPath() returns a directory in which data\r
152    can be written to immediately, without first needing to create directories.\r
153 \r
154 2. basing SDL_GetPrefPath() off of a different, non-Roaming folder, the\r
155    contents of which do not automatically get synchronized across devices\r
156    (and which require less work to use safely, in terms of data integrity).\r
157 \r
158 Apps that wish to get their Roaming folder's path can do so either by using\r
159 SDL_WinRTGetFSPathUTF8(), SDL_WinRTGetFSPathUNICODE() (which returns a\r
160 UCS-2/wide-char string), or directly through the WinRT class,\r
161 Windows.Storage.ApplicationData.\r
162 \r
163 \r
164 \r
165 Setup, High-Level Steps\r
166 -----------------------\r
167 \r
168 The steps for setting up a project for an SDL/WinRT app looks like the\r
169 following, at a high-level:\r
170 \r
171 1. create a new Visual C++ project using Microsoft's template for a,\r
172    "Direct3D App".\r
173 2. remove most of the files from the project.\r
174 3. make your app's project directly reference SDL/WinRT's own Visual C++\r
175    project file, via use of Visual C++'s "References" dialog.  This will setup\r
176    the linker, and will copy SDL's .dll files to your app's final output.\r
177 4. adjust your app's build settings, at minimum, telling it where to find SDL's\r
178    header files.\r
179 5. add files that contains a WinRT-appropriate main function, along with some\r
180    data to make sure mouse-cursor-hiding (via SDL_ShowCursor(SDL_DISABLE) calls)\r
181    work properly.\r
182 6. add SDL-specific app code.\r
183 7. build and run your app.\r
184 \r
185 \r
186 Setup, Detailed Steps\r
187 ---------------------\r
188 \r
189 ### 1. Create a new project ###\r
190 \r
191 Create a new project using one of Visual C++'s templates for a plain, non-XAML,\r
192 "Direct3D App" (XAML support for SDL/WinRT is not yet ready for use).  If you\r
193 don't see one of these templates, in Visual C++'s 'New Project' dialog, try\r
194 using the textbox titled, 'Search Installed Templates' to look for one.\r
195 \r
196 \r
197 ### 2. Remove unneeded files from the project ###\r
198 \r
199 In the new project, delete any file that has one of the following extensions:\r
200 \r
201 - .cpp\r
202 - .h\r
203 - .hlsl\r
204 \r
205 When you are done, you should be left with a few files, each of which will be a\r
206 necessary part of your app's project.  These files will consist of:\r
207 \r
208 - an .appxmanifest file, which contains metadata on your WinRT app.  This is\r
209   similar to an Info.plist file on iOS, or an AndroidManifest.xml on Android.\r
210 - a few .png files, one of which is a splash screen (displayed when your app\r
211   launches), others are app icons.\r
212 - a .pfx file, used for code signing purposes.\r
213 \r
214 \r
215 ### 3. Add references to SDL's project files ###\r
216 \r
217 SDL/WinRT can be built in multiple variations, spanning across three different\r
218 CPU architectures (x86, x64, and ARM) and two different configurations\r
219 (Debug and Release).  WinRT and Visual C++ do not currently provide a means\r
220 for combining multiple variations of one library into a single file.\r
221 Furthermore, it does not provide an easy means for copying pre-built .dll files\r
222 into your app's final output (via Post-Build steps, for example).  It does,\r
223 however, provide a system whereby an app can reference the MSVC projects of\r
224 libraries such that, when the app is built:\r
225 \r
226 1. each library gets built for the appropriate CPU architecture(s) and WinRT\r
227    platform(s).\r
228 2. each library's output, such as .dll files, get copied to the app's build \r
229    output.\r
230 \r
231 To set this up for SDL/WinRT, you'll need to run through the following steps:\r
232 \r
233 1. open up the Solution Explorer inside Visual C++ (under the "View" menu, then\r
234    "Solution Explorer")\r
235 2. right click on your app's solution.\r
236 3. navigate to "Add", then to "Existing Project..."\r
237 4. find SDL/WinRT's Visual C++ project file and open it.  Different project\r
238    files exist for different WinRT platforms.  All of them are in SDL's\r
239    source distribution, in the following directories:\r
240     * `VisualC-WinRT/UWP_VS2015/`        - for Windows 10 / UWP apps\r
241     * `VisualC-WinRT/WinPhone81_VS2013/` - for Windows Phone 8.1 apps\r
242     * `VisualC-WinRT/WinRT80_VS2012/`    - for Windows 8.0 apps\r
243     * `VisualC-WinRT/WinRT81_VS2013/`    - for Windows 8.1 apps\r
244 5. once the project has been added, right-click on your app's project and\r
245    select, "References..."\r
246 6. click on the button titled, "Add New Reference..."\r
247 7. check the box next to SDL\r
248 8. click OK to close the dialog\r
249 9. SDL will now show up in the list of references.  Click OK to close that\r
250    dialog.\r
251 \r
252 Your project is now linked to SDL's project, insofar that when the app is\r
253 built, SDL will be built as well, with its build output getting included with\r
254 your app.\r
255 \r
256 \r
257 ### 4. Adjust Your App's Build Settings ###\r
258 \r
259 Some build settings need to be changed in your app's project.  This guide will\r
260 outline the following:\r
261 \r
262 - making sure that the compiler knows where to find SDL's header files\r
263 - **Optional for C++, but NECESSARY for compiling C code:** telling the\r
264   compiler not to use Microsoft's C++ extensions for WinRT development.\r
265 - **Optional:** telling the compiler not generate errors due to missing\r
266   precompiled header files.\r
267 \r
268 To change these settings:\r
269 \r
270 1. right-click on the project\r
271 2. choose "Properties"\r
272 3. in the drop-down box next to "Configuration", choose, "All Configurations"\r
273 4. in the drop-down box next to "Platform", choose, "All Platforms"\r
274 5. in the left-hand list, expand the "C/C++" section\r
275 6. select "General"\r
276 7. edit the "Additional Include Directories" setting, and add a path to SDL's\r
277    "include" directory\r
278 8. **Optional: to enable compilation of C code:** change the setting for\r
279    "Consume Windows Runtime Extension" from "Yes (/ZW)" to "No".  If you're \r
280    working with a completely C++ based project, this step can usually be \r
281    omitted.\r
282 9. **Optional: to disable precompiled headers (which can produce \r
283    'stdafx.h'-related build errors, if setup incorrectly:** in the left-hand \r
284    list, select "Precompiled Headers", then change the setting for "Precompiled \r
285    Header" from "Use (/Yu)" to "Not Using Precompiled Headers".\r
286 10. close the dialog, saving settings, by clicking the "OK" button\r
287 \r
288 \r
289 ### 5. Add a WinRT-appropriate main function, and a blank-cursor image, to the app. ###\r
290 \r
291 A few files should be included directly in your app's MSVC project, specifically:\r
292 1. a WinRT-appropriate main function (which is different than main() functions on\r
293    other platforms)\r
294 2. a Win32-style cursor resource, used by SDL_ShowCursor() to hide the mouse cursor\r
295    (if and when the app needs to do so).  *If this cursor resource is not\r
296    included, mouse-position reporting may fail if and when the cursor is\r
297    hidden, due to possible bugs/design-oddities in Windows itself.*\r
298 \r
299 To include these files:\r
300 \r
301 1. right-click on your project (again, in Visual C++'s Solution Explorer), \r
302    navigate to "Add", then choose "Existing Item...".\r
303 2. navigate to the directory containing SDL's source code, then into its\r
304    subdirectory, 'src/main/winrt/'.  Select, then add, the following files:\r
305    - `SDL_winrt_main_NonXAML.cpp`\r
306    - `SDL2-WinRTResources.rc`\r
307    - `SDL2-WinRTResource_BlankCursor.cur`\r
308 3. right-click on the file `SDL_winrt_main_NonXAML.cpp` (as listed in your\r
309    project), then click on "Properties...".\r
310 4. in the drop-down box next to "Configuration", choose, "All Configurations"\r
311 5. in the drop-down box next to "Platform", choose, "All Platforms"\r
312 6. in the left-hand list, click on "C/C++"\r
313 7. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)".\r
314 8. click the OK button.  This will close the dialog.\r
315 \r
316 \r
317 **NOTE: C++/CX compilation is currently required in at least one file of your \r
318 app's project.  This is to make sure that Visual C++'s linker builds a 'Windows \r
319 Metadata' file (.winmd) for your app.  Not doing so can lead to build errors.**\r
320 \r
321 \r
322 ### 6. Add app code and assets ###\r
323 \r
324 At this point, you can add in SDL-specific source code.  Be sure to include a \r
325 C-style main function (ie: `int main(int argc, char *argv[])`).  From there you \r
326 should be able to create a single `SDL_Window` (WinRT apps can only have one \r
327 window, at present), as well as an `SDL_Renderer`.  Direct3D will be used to \r
328 draw content.  Events are received via SDL's usual event functions \r
329 (`SDL_PollEvent`, etc.)  If you have a set of existing source files and assets, \r
330 you can start adding them to the project now.  If not, or if you would like to \r
331 make sure that you're setup correctly, some short and simple sample code is \r
332 provided below.\r
333 \r
334 \r
335 #### 6.A. ... when creating a new app ####\r
336 \r
337 If you are creating a new app (rather than porting an existing SDL-based app), \r
338 or if you would just like a simple app to test SDL/WinRT with before trying to \r
339 get existing code working, some working SDL/WinRT code is provided below.  To \r
340 set this up:\r
341 \r
342 1. right click on your app's project\r
343 2. select Add, then New Item.  An "Add New Item" dialog will show up.\r
344 3. from the left-hand list, choose "Visual C++"\r
345 4. from the middle/main list, choose "C++ File (.cpp)"\r
346 5. near the bottom of the dialog, next to "Name:", type in a name for your \r
347 source file, such as, "main.cpp".\r
348 6. click on the Add button.  This will close the dialog, add the new file to \r
349 your project, and open the file in Visual C++'s text editor.\r
350 7. Copy and paste the following code into the new file, then save it.\r
351 \r
352 \r
353     #include <SDL.h>\r
354     \r
355     int main(int argc, char **argv)\r
356     {\r
357         SDL_DisplayMode mode;\r
358         SDL_Window * window = NULL;\r
359         SDL_Renderer * renderer = NULL;\r
360         SDL_Event evt;\r
361     \r
362         if (SDL_Init(SDL_INIT_VIDEO) != 0) {\r
363             return 1;\r
364         }\r
365     \r
366         if (SDL_GetCurrentDisplayMode(0, &mode) != 0) {\r
367             return 1;\r
368         }\r
369     \r
370         if (SDL_CreateWindowAndRenderer(mode.w, mode.h, SDL_WINDOW_FULLSCREEN, &window, &renderer) != 0) {\r
371             return 1;\r
372         }\r
373     \r
374         while (1) {\r
375             while (SDL_PollEvent(&evt)) {\r
376             }\r
377     \r
378             SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);\r
379             SDL_RenderClear(renderer);\r
380             SDL_RenderPresent(renderer);\r
381         }\r
382     }\r
383 \r
384 \r
385 #### 6.B. Adding code and assets ####\r
386 \r
387 If you have existing code and assets that you'd like to add, you should be able \r
388 to add them now.  The process for adding a set of files is as such.\r
389 \r
390 1. right click on the app's project\r
391 2. select Add, then click on "New Item..."\r
392 3. open any source, header, or asset files as appropriate.  Support for C and \r
393 C++ is available.\r
394 \r
395 Do note that WinRT only supports a subset of the APIs that are available to \r
396 Win32-based apps.  Many portions of the Win32 API and the C runtime are not \r
397 available.\r
398 \r
399 A list of unsupported C APIs can be found at \r
400 <http://msdn.microsoft.com/en-us/library/windows/apps/jj606124.aspx>\r
401 \r
402 General information on using the C runtime in WinRT can be found at \r
403 <https://msdn.microsoft.com/en-us/library/hh972425.aspx>\r
404 \r
405 A list of supported Win32 APIs for WinRT apps can be found at \r
406 <http://msdn.microsoft.com/en-us/library/windows/apps/br205757.aspx>.  To note, \r
407 the list of supported Win32 APIs for Windows Phone 8.0 is different.  \r
408 That list can be found at \r
409 <http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662956(v=vs.105).aspx>\r
410 \r
411 \r
412 ### 7. Build and run your app ###\r
413 \r
414 Your app project should now be setup, and you should be ready to build your app.  \r
415 To run it on the local machine, open the Debug menu and choose "Start \r
416 Debugging".  This will build your app, then run your app full-screen.  To switch \r
417 out of your app, press the Windows key.  Alternatively, you can choose to run \r
418 your app in a window.  To do this, before building and running your app, find \r
419 the drop-down menu in Visual C++'s toolbar that says, "Local Machine".  Expand \r
420 this by clicking on the arrow on the right side of the list, then click on \r
421 Simulator.  Once you do that, any time you build and run the app, the app will \r
422 launch in window, rather than full-screen.\r
423 \r
424 \r
425 #### 7.A. Running apps on older, ARM-based, "Windows RT" devices ####\r
426 \r
427 **These instructions do not include Windows Phone, despite Windows Phone\r
428 typically running on ARM processors.**  They are specifically for devices\r
429 that use the "Windows RT" operating system, which was a modified version of\r
430 Windows 8.x that ran primarily on ARM-based tablet computers.\r
431 \r
432 To build and run the app on ARM-based, "Windows RT" devices, you'll need to:\r
433 \r
434 - install Microsoft's "Remote Debugger" on the device.  Visual C++ installs and \r
435   debugs ARM-based apps via IP networks.\r
436 - change a few options on the development machine, both to make sure it builds \r
437   for ARM (rather than x86 or x64), and to make sure it knows how to find the \r
438   Windows RT device (on the network).\r
439 \r
440 Microsoft's Remote Debugger can be found at \r
441 <https://msdn.microsoft.com/en-us/library/hh441469.aspx>.  Please note \r
442 that separate versions of this debugger exist for different versions of Visual \r
443 C++, one each for MSVC 2015, 2013, and 2012.\r
444 \r
445 To setup Visual C++ to launch your app on an ARM device:\r
446 \r
447 1. make sure the Remote Debugger is running on your ARM device, and that it's on \r
448    the same IP network as your development machine.\r
449 2. from Visual C++'s toolbar, find a drop-down menu that says, "Win32".  Click \r
450    it, then change the value to "ARM".\r
451 3. make sure Visual C++ knows the hostname or IP address of the ARM device.  To \r
452    do this:\r
453     1. open the app project's properties\r
454     2. select "Debugging"\r
455     3. next to "Machine Name", enter the hostname or IP address of the ARM \r
456        device\r
457     4. if, and only if, you've turned off authentication in the Remote Debugger,\r
458        then change the setting for "Require Authentication" to No\r
459     5. click "OK"\r
460 4. build and run the app (from Visual C++).  The first time you do this, a \r
461    prompt will show up on the ARM device, asking for a Microsoft Account.  You \r
462    do, unfortunately, need to log in here, and will need to follow the \r
463    subsequent registration steps in order to launch the app.  After you do so, \r
464    if the app didn't already launch, try relaunching it again from within Visual \r
465    C++.\r
466 \r
467 \r
468 Troubleshooting\r
469 ---------------\r
470 \r
471 #### Build fails with message, "error LNK2038: mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker'"\r
472 \r
473 Try adding the following to your linker flags.  In MSVC, this can be done by\r
474 right-clicking on the app project, navigating to Configuration Properties ->\r
475 Linker -> Command Line, then adding them to the Additional Options\r
476 section.\r
477 \r
478 * For Release builds / MSVC-Configurations, add:\r
479 \r
480     /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib\r
481 \r
482 * For Debug builds / MSVC-Configurations, add:\r
483 \r
484     /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib\r
485 \r
486 \r
487 #### Mouse-motion events fail to get sent, or SDL_GetMouseState() fails to return updated values\r
488 \r
489 This may be caused by a bug in Windows itself, whereby hiding the mouse\r
490 cursor can cause mouse-position reporting to fail.\r
491 \r
492 SDL provides a workaround for this, but it requires that an app links to a\r
493 set of Win32-style cursor image-resource files.  A copy of suitable resource\r
494 files can be found in `src/main/winrt/`.  Adding them to an app's Visual C++\r
495 project file should be sufficient to get the app to use them.\r
496 \r
497 \r
498 #### SDL's Visual Studio project file fails to open, with message, "The system can't find the file specified."\r
499 \r
500 This can be caused for any one of a few reasons, which Visual Studio can\r
501 report, but won't always do so in an up-front manner.\r
502 \r
503 To help determine why this error comes up:\r
504 \r
505 1. open a copy of Visual Studio without opening a project file.  This can be\r
506    accomplished via Windows' Start Menu, among other means.\r
507 2. show Visual Studio's Output window.  This can be done by going to VS'\r
508    menu bar, then to View, and then to Output.\r
509 3. try opening the SDL project file directly by going to VS' menu bar, then\r
510    to File, then to Open, then to Project/Solution.  When a File-Open dialog\r
511    appears, open the SDL project (such as the one in SDL's source code, in its\r
512    directory, VisualC-WinRT/UWP_VS2015/).\r
513 4. after attempting to open SDL's Visual Studio project file, additional error\r
514    information will be output to the Output window.\r
515 \r
516 If Visual Studio reports (via its Output window) that the project:\r
517 \r
518 "could not be loaded because it's missing install components. To fix this launch Visual Studio setup with the following selections:\r
519 Microsoft.VisualStudio.ComponentGroup.UWP.VC"\r
520 \r
521 ... then you will need to re-launch Visual Studio's installer, and make sure that\r
522 the workflow for "Universal Windows Platform development" is checked, and that its\r
523 optional component, "C++ Universal Windows Platform tools" is also checked.  While\r
524 you are there, if you are planning on targeting UWP / Windows 10, also make sure\r
525 that you check the optional component, "Windows 10 SDK (10.0.10240.0)".  After\r
526 making sure these items are checked as-appropriate, install them.\r
527 \r
528 Once you install these components, try re-launching Visual Studio, and re-opening\r
529 the SDL project file.  If you still get the error dialog, try using the Output\r
530 window, again, seeing what Visual Studio says about it.\r
531 \r
532 \r
533 #### Game controllers / joysticks aren't working!\r
534 \r
535 Windows only permits certain game controllers and joysticks to work within\r
536 WinRT / UWP apps.  Even if a game controller or joystick works in a Win32\r
537 app, that device is not guaranteed to work inside a WinRT / UWP app.\r
538 \r
539 According to Microsoft, "Xbox compatible controllers" should work inside\r
540 UWP apps, potentially with more working in the future.  This includes, but\r
541 may not be limited to, Microsoft-made Xbox controllers and USB adapters.\r
542 (Source: https://social.msdn.microsoft.com/Forums/en-US/9064838b-e8c3-4c18-8a83-19bf0dfe150d/xinput-fails-to-detect-game-controllers?forum=wpdevelop)\r
543 \r
544 \r