Get it here: DirectXTK.zip
Supported operating systems:
- Windows 8 Consumer Preview (both Metro and Desktop)
- Windows 7
- Windows Vista with DirectX 11 update
Supported compilers:- Visual Studio 11 (currently in beta)
- Visual Studio 2010 plus the standalone Windows 8.0 SDK (you need the SDK to get the latest version of DirectXMath, which this code depends on)
How to use it:- Unzip, load the solution into Visual Studio, and build it
- Link your program with the resulting static lib
- Add the Inc folder to your include path
To draw sprites: #include "SpriteBatch.h"
#include using namespace DirectX; std::unique_ptr spriteBatch(new SpriteBatch(deviceContext)); spriteBatch->Begin(); spriteBatch->Draw(texture, XMFLOAT2(x, y)); spriteBatch->End();
To draw geometry using BasicEffect: #include "BasicEffect.h"
#include using namespace DirectX; std::unique_ptr effect(new BasicEffect(device)); effect->SetWorld(world); effect->SetView(view); effect->SetProjection(projection); effect->SetTexture(cat); effect->SetTextureEnabled(true); effect->EnableDefaultLighting(); effect->Apply(deviceContext); deviceContext->IASetInputLayout(...); deviceContext->IASetVertexBuffers(...); deviceContext->IASetIndexBuffer(...); deviceContext->IASetPrimitiveTopology(...); deviceContext->DrawIndexed(...);
To draw geometric primitives: #include "GeometricPrimitive.h"
#include using namespace DirectX; std::unique_ptr teapot(GeometricPrimitive::CreateTeapot(deviceContext)); teapot->Draw(world, view, projection, Colors::CornflowerBlue);
See the readme inside the zip for more info.
Source
- Unzip, load the solution into Visual Studio, and build it
- Visual Studio 11 (currently in beta)