microsoft/DirectXTK
C++
Captured source
source ↗microsoft/DirectXTK
Description: The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++
Language: C++
License: MIT
Stars: 2816
Forks: 531
Open issues: 33
Created: 2015-04-09T19:38:28Z
Pushed: 2026-06-10T06:49:56Z
Default branch: main
Fork: no
Archived: no
README: !DirectX Logo
DirectX Tool Kit for DirectX 11
https://go.microsoft.com/fwlink/?LinkId=248929
Copyright (c) Microsoft Corporation.
May 7, 2026
This package contains the "DirectX Tool Kit", a collection of helper classes for writing Direct3D 11 C++ code for Win32 desktop applications for Windows 8.1 or later, Xbox One, and Universal Windows Platform (UWP) apps for Windows 10 and Windows 11.
This code is designed to build with Visual Studio 2022, Visual Studio 2026, clang for Windows v12 or later, or MinGW 12.2. Use of the Windows 10 May 2020 Update SDK (19041) or later is required for Visual Studio.
These components are designed to work without requiring any content from the legacy DirectX SDK. For details, see Where is the DirectX SDK?.
Directory Layout
Inc\
- Public Header Files (in the DirectX C++ namespace):
- Audio.h - low-level audio API using XAudio2 (DirectXTK for Audio public header)
- BufferHelpers.h - C++ helpers for creating D3D resources from CPU data
- CommonStates.h - factory providing commonly used D3D state objects
- DDSTextureLoader.h - light-weight DDS file texture loader
- DirectXHelpers.h - misc C++ helpers for D3D programming
- Effects.h - set of built-in shaders for common rendering tasks
- GamePad.h - gamepad controller helper using XInput, Windows.Gaming.Input, or GameInput
- GeometricPrimitive.h - draws basic shapes such as cubes and spheres
- GraphicsMemory.h - helper for managing dynamic graphics memory allocation
- Keyboard.h - keyboard state tracking helper
- Model.h - draws meshes loaded from .CMO, .SDKMESH, or .VBO files
- Mouse.h - mouse helper
- PostProcess.h - set of built-in shaders for common post-processing operations
- PrimitiveBatch.h - simple and efficient way to draw user primitives
- ScreenGrab.h - light-weight screen shot saver
- SimpleMath.h - simplified C++ wrapper for DirectXMath
- SpriteBatch.h - simple & efficient 2D sprite rendering
- SpriteFont.h - bitmap based text rendering
- VertexTypes.h - structures for commonly used vertex data formats
- WICTextureLoader.h - WIC-based image file texture loader
- XboxDDSTextureLoader.h - Xbox One exclusive apps variant of DDSTextureLoader
Src\
- DirectXTK source files and internal implementation headers
Audio\
- DirectXTK for Audio source files and internal implementation headers
MakeSpriteFont\
- Command line tool used to generate binary resources for use with SpriteFont
XWBTool\
- Command line tool for building XACT-style wave banks for use with DirectXTK for Audio's WaveBank class
build\
- Contains miscellaneous build files and scripts.
skills\
- Contains published CoPilot skills for use by developers.
Documentation
Documentation is available on the GitHub wiki.
CoPilot Usage
For CoPilot CLI assistance with using DirectX Tool Kit, try:
winget install GitHub.Copilot winget install GitHub.cli gh skill install microsoft/directxtk copilot /skills list
Notices
All content and source code for this package are subject to the terms of the MIT License.
For the latest version of DirectXTK, bug reports, etc. please visit the project site on GitHub.
Release Notes
FOR SECURITY ADVISORIES, see GitHub.
For a full change history, see CHANGELOG.md.
- The CMake projects require 3.21 or later.
- Starting with the March 2025 release, Windows 7 and Windows 8.0 support has been retired. For _DirectX ToolKit for Audio_ this means that
DirectXTKAudio_Desktop_*_Win7has been removed, andDirectXTKAudio_Desktop_*_Win8has been integrated into theDirectXTK_Desktop_*vcxproj which uses XAudio 2.8 for Windows 8.1 compatibility.
- Remove any References to or use of
DirectXTKAudio_Desktop_*_Win8.vcxprojorDirectXTKAudio_Desktop_*_Win7. If usingDirectXTK_Desktop_*.vcxprojyou will be using XAudio 2.8 as before. Client code will need to build with_WIN32_WINNT=0x0603.
- If you want to use XAudio2Redist with Windows 8.1, the CMake project supports this with the build option
BUILD_XAUDIO_REDIST. The CMake build optionBUILD_XAUDIO_WIN7was renamed.
- When using XAudio 2.8 for Windows 8.1, there is no xWMA format support. This is available when using XAudio 2.9 or XAudio2Redist.
- Starting with the February 2023 release, the Mouse class implementation of relative mouse movement was updated to accumulate changes between calls to `
GetState. By default, each time you callGetStatethe deltas are reset which works for scenarios where you use relative movement but only call the method once per frame. If you call it more than once per frame, then add an explicit call toEndOfInputFrame` to use an explicit reset model instead.
- As of the September 2022 release, the library makes use of C++11 inline namespaces for differing types that have the same names in the DirectX 11 and DirectX 12 version of the _DirectX Tool Kit_. This provides a link-unique name such as `
DirectX::DX11::SpriteBatchthat will appear in linker output messages. In most use cases, however, there is no need to add explicitDX11` namespace resolution in client code.
- Starting with the July 2022 release, the `
bool forceSRGBparameter for DDSTextureLoaderExfunctions is now aDDS_LOADER_FLAGStyped enum bitmask flag parameter. This may have a _breaking change_ impact to client code. ReplacetruewithDDS_LOADER_FORCE_SRGBandfalsewithDDS_LOADER_DEFAULT`.
- As of the October 2021 release, the DGSLEffect no longer directly supports skinning. Instead, make use of SkinnedDGSLEffect which is derived from DGSLEffect.
- Starting with the June 2020 release, this library makes use of [typed enum bitmask…
Excerpt shown — open the source for the full document.