directxtk-usage
Skill2.9k starsChanged 4 months agoMITView on GitHub
Guide for integrating DirectX Tool Kit for DirectX 11 into new projects and understanding the API surface. Use this skill when asked about how to use DirectX Tool Kit, integrate it into a project, or get an overview of its classes and functionality.
Trending
Quiet since August.about the whole repository
Who's talking about microsoft/DirectXTK
- @wonsorang.com“Direct3D 11 C++ 코드를 작성하기 위한 헬퍼 클래스 모음인 <DirectX Tool Kit for DirectX 11> github.com/microsoft/Di... 내부 구현체 …”Bluesky · Sep 13, 2023 · 3 likes
- A Hacker News story“DirectX 11 Tutorial by Microsoft”Hacker News · Jan 5, 2026 · 2 points
- espeak-ng/pcaudiolib“Feat/build with cmake”GitHub · Jan 24, 2025 · 1 reactions
- microsoft/vcpkg“[xaudio2redist, directxtk] updated XAudio2 port to 1.2.8 and added cmake find”GitHub · Oct 16, 2021 · 1 reactions
- kosua20/herebedragons“Add DirectX Toolkit version”GitHub · Jul 26, 2017 · 1 reactions
The biggest 5 of 15 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 15
Talked about on GitHub, Hacker News and Bluesky (15 times).
On GitHub · 13
- Jan 24, 2025Feat/build with cmake — espeak-ng/pcaudiolib1 reaction · 1 comment
- Oct 16, 2021[xaudio2redist, directxtk] updated XAudio2 port to 1.2.8 and added cmake find — microsoft/vcpkg1 reaction · 18 comments
- Jul 26, 2017Add DirectX Toolkit version — kosua20/herebedragons1 reaction · 2 comments
- Aug 19, 2026Validate seek table bounds in WaveBankReader — microsoft/DirectXTK120 reactions · 1 comment
- Aug 19, 2026Fetch DirectXTK from GitHub at configure time instead of vendoring it — XxRagulxX/Stand0 reactions
8 more on GitHub
- Apr 1, 2026[directxtk, directxtk12, directxtex, directxmesh] March 2026 release — microsoft/vcpkg0 reactions · 1 comment
- Dec 20, 2025Update declared license for git:directxtk 38f1e61fcb058da39b1ee55f6eceb5aa92bd443e — clearlydefined/curated-data0 reactions · 2 comments
- Nov 21, 2025feat: add additional dds fourCC values for bc4 and bc5 — Laupetin/OpenAssetTools0 reactions
- May 23, 2025New Project Proposal - VUE and PlantFactory — AcademySoftwareFoundation/tac0 reactions · 14 comments
- Sep 6, 2023HDR and wide color range output setup. — Kode/Kore0 reactions
- Apr 21, 2022Completely broken — microsoft/xbox-live-samples0 reactions · 5 comments
- Dec 5, 2017Support for Xbox One DDS files. — GerbilSoft/rom-properties0 reactions
- Sep 7, 2017Platonic solids in GeometryGenerator — vilbeyli/VQEngine-Legacy0 reactions
On Hacker News · 1
- Jan 5, 2026DirectX 11 Tutorial by Microsoft2 points
On Bluesky · 1
- Sep 13, 2023Direct3D 11 C++ 코드를 작성하기 위한 헬퍼 클래스 모음인 <DirectX Tool Kit for DirectX 11> github.com/microsoft/Di... 내부 구현체 내용 참조할 거리가 많군요. — @wonsorang.com3 likes and reposts · 1 reply
In this repository3 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- releaseSkill
- directxtk-tutorialSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 40
If using GameInput for the game input functionality, add the following:
- Distinctive: line 58
If using DirectX Tool Kit for Audio and GameInput, add the following:
- Very specific: line 98
Use directxtk_desktop_win10 for Win32 desktop applications or directxtk_uwp for UWP apps.
- Very specific: line 102
Add the appropriate .vcxproj from the DirectXTK/ folder to your solution and add a project reference.
- Very specific: line 106
Every DirectXTK application needs:
- Very specific: line 136
All classes and functions reside in the DirectX namespace.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
DirectX Tool Kit for DirectX 11 — Usage Guide
Overview
The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++. It is designed to be used as a shared source project, NuGet package, or vcpkg port integrated into your game or graphics application.
- Repository: https://github.com/microsoft/DirectXTK
- Documentation: https://github.com/microsoft/DirectXTK/wiki
- NuGet Packages:
directxtk_desktop_win10,directxtk_uwp - vcpkg Port:
directxtk
Integration Methods
vcpkg manifest-mode (Recommended)
In your vcpkg.json file, add the following:
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"dependencies": [
"directxmath",
"directxtk"
]
}If using GameInput for the game input functionality, add the following:
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"dependencies": [
"directxmath",
{
"name": "directxtk",
"default-features": false,
"features": [
"gameinput"
]
}
]
}If using DirectX Tool Kit for Audio and GameInput, add the following:
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"dependencies": [
"directxmath",
{
"name": "directxtk",
"default-features": false,
"features": [
"gameinput",
"xaudio2-9"
]
}
]
}vcpkg (classic)
vcpkg install directxtkFeatures: xaudio2-9 (DirectX Tool Kit for Audio using XAudio 2.9), gameinput (Using GameInput for gamepad, keyboard, and mouse), tools (command-line tools). Triplets: x64-windows, arm64-windows, etc.
For DLL usage (x64-windows default triplet), define DIRECTX_TOOLKIT_IMPORT in your consuming project. For static library usage, use -static-md triplet variants.
CMakeLists.txt:
find_package(directxtk CONFIG REQUIRED)
target_link_libraries(your_target PRIVATE Microsoft::DirectXTK)See the d3d11game_vcpkg template for a complete example.
NuGet
Use directxtk_desktop_win10 for Win32 desktop applications or directxtk_uwp for UWP apps.
Project Reference
Add the appropriate .vcxproj from the DirectXTK/ folder to your solution and add a project reference. Add the DirectXTK\Inc directory to your Additional Include Directories.
Minimum Setup
Every DirectXTK application needs:
- A Direct3D 11 device
- A Direct3D immediate device context
- The application is responsible for the rendering, SwapChain management, and Present loop
API Reference
The public API is defined in the header files in the Inc/ directory. See the reference overview for a categorized summary of all classes and helpers.
Full documentation for each class is available on the GitHub wiki.
API signatures are defined in the public headers under the Inc/ directory. Always consult those headers for the authoritative function signatures, parameters, and SAL annotations.
Key Concepts
Resource Ownership
DirectXTK classes follow RAII principles. Most objects are created with std::make_unique and destroyed automatically. COM resources are managed with Microsoft::WRL::ComPtr.
Device-Dependent vs Device-Independent
Most DirectXTK objects are device-dependent — they are created with a ID3D11Device* and must be recreated if the device is lost. Plan your resource management accordingly.
Thread Safety
DirectXTK rendering classes (SpriteBatch, Effects, PrimitiveBatch, etc.) are not thread-safe. Use one instance per thread, or synchronize access externally. Resource creation (texture loading, model loading) can be done from any thread.
Namespace
All classes and functions reside in the DirectX namespace. Headers that contain Direct3D 11-specific types use inline namespace DX11 to avoid conflicts when both DX11 and DX12 toolkits are linked together.
#include "SpriteBatch.h"
// Usage:
auto spriteBatch = std::make_unique<DirectX::SpriteBatch>(context);Common Patterns
Drawing Sprites
#include "SpriteBatch.h"
#include "WICTextureLoader.h"
// Create
auto spriteBatch = std::make_unique<DirectX::SpriteBatch>(context);
ComPtr<ID3D11ShaderResourceView> texture;
DirectX::CreateWICTextureFromFile(device, L"cat.png", nullptr, texture.GetAddressOf());
// Draw
spriteBatch->Begin();
spriteBatch->Draw(texture.Get(), DirectX::XMFLOAT2(100, 100));
spriteBatch->End();Loading and Drawing a 3D Model
#include "Model.h"
#include "CommonStates.h"
#include "Effects.h"
// Create
auto states = std::make_unique<DirectX::CommonStates>(device);
auto fxFactory = std::make_unique<DirectX::EffectFactory>(device);
auto model = DirectX::Model::CreateFromSDKMESH(device, L"ship.sdkmesh", *fxFactory);
// Draw
model->Draw(context, *states, world, view, projection);Drawing Geometric Primitives
#include "GeometricPrimitive.h"
auto sphere = DirectX::GeometricPrimitive::CreateSphere(context);
sphere->Draw(world, view, projection);Using Effects
#include "Effects.h"
auto effect = std::make_unique<DirectX::BasicEffect>(device);
effect->SetWorld(world);
effect->SetView(view);
effect->SetProjection(projection);
effect->SetTexture(textureSRV.Get());
effect->Apply(context);Input Handling
#include "Keyboard.h"
#include "Mouse.h"
#include "GamePad.h"
auto keyboard = std::make_unique<DirectX::Keyboard>();
auto mouse = std::make_unique<DirectX::Mouse>();
auto gamePad = std::make_unique<DirectX::GamePad>();
// In update loop
auto kb = keyboard->GetState();
if (kb.Escape)
PostQuitMessage(0);
auto pad = gamePad->GetState(0);
if (pad.IsConnected())
{
if (pad.IsAPressed())
/* jump */;
}Audio
#include "Audio.h"
// Create audio engine
auto audioEngine = std::make_unique<DirectX::AudioEngine>();
// Load and play a sound
auto soundEffect = std::make_unique<DirectX::SoundEffect>(audioEngine.get(), L"explosion.wav");
soundEffect->Play();
// Per-frame update
audioEngine->Update();Getting Started Tutorial
For a full step-by-step walkthrough, see the Getting Started tutorial on the wiki.
Further Reading
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

