Skip to content
Chuck Walbourn edited this page Aug 19, 2024 · 95 revisions

GitHub Release Date

GitHub last commit

Install the latest with this link for VS 2019 / VS 2022. If you already have an older version installed, you can uninstall it from Visual Studio via Tools -> Extensions and Updates...

The last VS 2013 version of the VSIX was July 2017. The last VS 2015 version was October 2019. The last VS 2017 version was March 2022.

Direct3D Game VS project templates

This repo contains Visual C++ project templates for game programming with DirectX. They are primarily intended for developer education, samples, and tutorials.

There are two versions of each template. The standard version is described in the Basic game loop tutorial lesson (DX11 or DX12). The DR version adds a DeviceResources (DX11 or DX12) abstraction to isolate the device and swapchain code into it's own helper class.

See this blog post and this one.

Visual Studio 2019 / 2022

  • From the drop-down menu, select File and then New -> Project... or on the startup dialog select Create a new project
  • Select "Games" on the project types filter. You can optionally type "Win32" or "UWP" in the search box as well.

New Project

Uninstalling

Extensions and Updates

You can also remove all instances from a Visual Studio Developer Command Prompt:

VSIXInstaller.exe /q /u:Direct3DUWPGame-1

d3d11game_win32, d3d12game_win32

Contains the Visual Studio 2019 and 2022 version of the Direct3D Win32 Game Visual Studio templates for Direct3D 11 and Direct3D 12.

Install this using VSIX\Direct3DUWPGame.vsix

The d3d12game_win32 template requires that the Windows Tools be installed as Direct3D 12 requires the Windows 10 SDK. See the Visual Studio Team blog for details.

d3d11game_uwp, d3d12game_uwp

Contains the Direct3D UWP Game Visual Studio template for VS 2019 and 2022 for the universal Windows platform for Windows 10 for Direct3D 11 and Direct3D 12.

Install this using VSIX\Direct3DUWPGame.vsix

d3d11game_win32_dr, d3d12game_win32_dr, d3d11game_uwp_dr, d3d12game_uwp_dr

DeviceResources variants of the templates.

d3d11game_uwp_cppwinrt, d3d12game_uwp_cppwinrt, d3d11game_uwp_cppwinrt_dr, d3d12game_uwp_cppwinrt_dr

Contains a Direct3D UWP Game Visual Studio template for VS 2019 and 2022 that makes use of the C++/WinRT language projections rather than C++/CX (/ZW).

 These templates make use of Microsoft::WRL::ComPtr rather than winrt::com_ptr so the code is more consistent between the various version. When using C++/WinRT and WRL together, you may have to use explicit winrt:: name resolution for the Windows and Windows::Foundation namespaces as WRL declares a few templates in those namespaces that you can't avoid when using WRL.

VSIX

VS Express editions do not support the extensibility features needed to install a VSIX package. Use VS Community or Pro+ editions instead.

The source for the Direct3DUWPGame.vsix is on GitHub. This requires VS 2019 with the .NET desktop development workload (Microsoft.VisualStudio.Workload.ManagedDesktop) and the Visual Studio extension development workload (Microsoft.VisualStudio.Workload.VisualStudioExtension).

Windows 10 SDK Usage

When you create a UWP project you will be prompted with a dialog to select which version of the Windows 10 SDK to use which will set the <WindowsTargetPlatformVersion> and <WindowsTargetPlatformMinVersion> values.

New Universal Windows Project

Release notes

  • The latest version of d3dx12.h requires the Windows 10 SDK 19041 or later.

  • VS 2019 users should apply the 16.11 update.

CMake projects

There are CMake files available for the Win32 and C++/WinRT UWP templates here:

d3d11game_win32 CMakeLists.txt CMakePresets.json
d3d11game_win32_dr CMakeLists.txt CMakePresets.json
d3d11game_uwp_cppwinrt CMakeLists.txt CMakePresets.json
d3d11game_uwp_cppwinrt_dr CMakeLists.txt CMakePresets.json
d3d12game_win32 CMakeLists.txt CMakePresets.json
d3d12game_win32_dr CMakeLists.txt CMakePresets.json
d3d12game_uwp_cppwinrt CMakeLists.txt CMakePresets.json
d3d12game_uwp_cppwinrt_dr CMakeLists.txt CMakePresets.json

To create a new template instance without the use of Visual Studio, you can use the createcmake.ps1 PowerShell script. For the UWP templates, this also substitutes values into the Package.appxmanifest needed to use it as a config file in CMake.

Change to VSIX:

.\createcmake.ps1 d3d11game_win32 Direct3DGame $Env:USERPROFILE\source
.\createcmake.ps1 d3d11game_win32_dr Direct3DGameDR $Env:USERPROFILE\source
.\createcmake.ps1 d3d12game_win32 Direct3D12Game $Env:USERPROFILE\source
.\createcmake.ps1 d3d12game_win32_dr Direct3D12GameDR $Env:USERPROFILE\source
.\createcmake.ps1 d3d11game_uwp_cppwinrt Direct3DUWPGame $Env:USERPROFILE\source
.\createcmake.ps1 d3d11game_uwp_cppwinrt_dr Direct3DUWPGameDR $Env:USERPROFILE\source
.\createcmake.ps1 d3d12game_uwp_cppwinrt Direct3DUWP12Game $Env:USERPROFILE\source
.\createcmake.ps1 d3d12game_uwp_cppwinrt_dr Direct3DUWP12GameDR $Env:USERPROFILE\source

To use the latest versions of DirectXMath and the Direct3D 12 headers, install them via vcpkg and then add cmakeToolchain set to D:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake. The CMakeLists.txt will automatically use the vcpkg libraries. The CMakePresets.json for -VCPKG use the VCPKG_ROOT environment variable.

Tool Kit Integration

In the DirectX 11 and 12 versions of the templates with CMake support, there is commented out references to the VCPKG version of the tool kit.

In the DirectX 12 versions of the templates, there are commented out place in Game.cpp in Present, device resource creation, and device-lost handling. Using these also requires uncommenting the #include <GraphicsMemory.h> in the pch.h.

For Use

  • Universal Windows Platform apps
  • Windows desktop apps
  • Windows 11
  • Windows 10
  • Windows 8.1
  • Windows 7 Service Pack 1

For Development

  • Visual Studio 2022
  • Visual Studio 2019
  • clang/LLVM v12 - v16
  • GCC/MinGW 12.2
  • CMake 3.20

Related Projects

DirectX Tool Kit for DirectX 11

DirectX Tool Kit for DirectX 12

DirectXMath

Clone this wiki locally