Hi All,
I am confused about the game 'camera' for a 2d sprite based game
I have some code that initializes a win32 window and then a directX device. The code to initialize the directX window consists of the following major DirectX11 calls (the arrows just indicate the order of these calls):
D3D11CreateDevice -> CreateSwapChain -> CreateRenderTargetView -> OMSetRenderTargets -> RSSetViewports
I then load the textures I want to use using DirectxTK's CreateDDSTextureFromFile()
To draw my .dds texture I call
graphics->drawAsset(spriteData);
where spriteData is a structure that contains my textures shader resource view.
The drawSprite function uses the DirectXTK to draw my sprite as per their documentation:"
void Graphics::drawAsset(const SpriteData &spriteData)
{
g_Sprites->Begin(SpriteSortMode_Deferred);
g_Sprites->Draw(spriteData.srv, XMFLOAT2(spriteData.x, spriteData.y), nullptr, Colors::White);
g_Sprites->End();
}
Somehow in all of this my sprite appears on screen with its top left pixel location at (spriteData.x, spriteData.y).
What I want to do now is zoom the camera out quite a bit, to enter kind of a 'debug' mode, where I can see the location of sprites and objects off screen.
If I was dealing with 3d objects I have a feeling I could do this quite easily by modifying the view matrix. The directX tool kit has a nice example "SimpleSample_Desktop_2012_Win8" where they draw some models and a sprite. Even in their example though, when I modify the view matrix only the 3d objects move, the 2d sprite stays exactly where it is e.g. changing -6.0f to -20.0f in the line...
XMVECTOR Eye = XMVectorSet( 0.0f, 3.0f, -6.0f, 0.0f );
So I am a bit confused in the view matrix's role when dealing just with 2d sprites like I am,
And also how to include an easy zoom function similar to the way the view matrix works in 3d.
Thanks