-
Notifications
You must be signed in to change notification settings - Fork 56
Home
Install the latest with this link for VS 2017 / 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.
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.
- From the drop-down menu, select File and then New -> Project...
- Select "Visual C++" on the left-hand tree-view.
- 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.
You can also remove all instances from a Visual Studio Developer Command Prompt:
VSIXInstaller.exe /q /u:Direct3DUWPGame-1
Contains the Visual Studio 2017, 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.
Contains the Direct3D UWP Game Visual Studio template for VS 2017, 2019, and 2022 for the universal Windows platform for Windows 10 for Direct3D 11 and Direct3D 12.
Install this using VSIX\Direct3DUWPGame.vsix
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 2017, 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 thanwinrt::com_ptr
so the code is more consistent between the various version. When using C++/WinRT and WRL together, you may have to use explicitwinrt::
name resolution for theWindows
andWindows::Foundation
namespaces as WRL declares a few templates in those namespaces that you can't avoid when using WRL.
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 2017 with the .NET desktop development workload (Microsoft.VisualStudio.Workload.ManagedDesktop
) and the Visual Studio extension development workload (Microsoft.VisualStudio.Workload.VisualStudioExtension
).
With VS 2017, when you create a 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.
The Win32 VS templates use the same wizard, so will trigger the same dialog with the same title "New Universal Windows Project". DirectX 12 APIs are only in the Windows 10 SDK and the dialog lets you select the Target Version to build against. With VS 2017, the Windows 8.1 SDK is not installed by default, so these templates encourage using the Windows 10 SDK for all project types. Note that the Minimum Version value is not used by Win32 projects.
-
The latest version of
d3dx12.h
requires the Windows 10 SDK Anniversary Update SDK 14393 or later. -
When using C++/WinRT with the Windows 10 Fall Creators Update SDK (16299), use NuGet package 2017.10.13
-
When using C++/WinRT with the Windows 10 April 2018 Update SDK (17134) or later, use of the NuGet package is not required. See this blog post.
-
VS 2019 users wanting to make use of C++/WinRT should upgrade to the Windows 10 SDK (19041) or utilize the Microsoft.Windows.CppWinRT NuGet package.
-
VS 2017 users should apply the 15.5 update or later.
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.
To use the latest versions of DirectXMath and the Direct3D 12 headers, install them via vcpkg and then add
cmakeToolchain
set toD:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake
. TheCMakeLists.txt
will automatically use the vcpkg libraries. The CMakePresets.json for -VCPKG use theVCPKG_ROOT
environment variable.
All content and source code for this package are subject to the terms of the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
- Universal Windows Platform apps
- Windows desktop apps
- Windows 11
- Windows 10
- Windows 8.1
- Windows 7 Service Pack 1
- Visual Studio 2022
- Visual Studio 2019
- clang/LLVM v12 - v16
- GCC/MinGW 12.2
- CMake 3.20
DirectX Tool Kit for DirectX 11