Games for Windows and the DirectX SDK blog

Technical tips, tricks, and news about game development for Microsoft platforms including desktop, Xbox, and UWP

Project maintained by walbourn Hosted on GitHub Pages — Theme by mattgraham
Home | Posts by Tag | Posts by Month

DirectX Tool Kit and C++/WinRT

uwp, visualc, xbox

Originally posted to Chuck Walbourn's Blog on MSDN,

The February 2017 releases of DirectX Tool Kit for DirectX 11 and DirectX 12 are now available on GitHub. In addition to various bug-fixes and a few minor improvements to the input classes (Mouse, Keyboard, and GamePad), the libraries now also support C++/WinRT applications for UWP and Xbox One. C++/WinRT language projections allow you to use Windows Runtime APIs without using the C++/CX language extensions (i.e. the libraries will work with applications built with or without /ZW).

For more on C++/WinRT, see:

C++ - Introducing C++/WinRT (MSDN Magazine)

cppwinrt on GitHub

Migrating C++/CX source code to C++/WinRT

Embracing Standard C++ for the Windows Runtime” (CppCon 2016)

Putting Coroutines to Work with the Windows Runtime” (CppCon 2016)

VS Templates: I’ve added C++/WinRT variants of my Direct3D UWP templates for DirectX 11 and DirectX 12 to directx-vs-templates and the VS 2015/2017/2019 VSIX.

Samples: In addition to the samples on the cppwinrt GitHub, there’s a C++/WinRT version of some samples on Xbox-ATG-Samples.

NuGet: You can use  C++/WinRT on NuGet as an easy way to add the C++/WinRT headers for the Windows 10 Anniversary Update (14393) to the templates above or your own project.. The NuGet cppwinrt header package has been retired. Please use the Windows 10 SDK (17134) or later which includes WinRT/C++ headers. There is also a Microsoft.Windows.CppWinRT NuGet package that includes templates, debug visualization, and other tools.

Compiler: To use C++/WinRT, you must be use using Visual Studio 2015 Update 3, Visual Studio 2017, or Visual Studio 2019 and build with the /std:c++17 (/std:c++latest for VS 2015) switch. The use of /await is also recommended.

DirectXMath, DirectXTex, DirectXMesh: These libraries are also compatible with both C++/WinRT and C++/CX applications.

Related: DirectX Tool Kit for DirectX 12, Direct3D Game Visual Studio templates (Redux)