In DirectX 11 with C++, how do I animate a sprite with a spritesheet and present movement across the screen? D3DXSprite is not supported in 11, apparently. I've only been using DirectX for a few days, and yes it's for school, but I'm not looking for someone to do my homework. I just need books, websites, or any kind of resource to help me out. I have tried to find specific tutorials or some kind of documentation on how to do what I'm asking, with no luck. Thank you.
In D3D you would basically create a vertex buffer which contains a unit quad and then scale and move it in a vertex shader to the appropriate size and position. In the pixel shader you would modify the texture coordinate to jump to the right sprite in your sprite sheet and finally fetch the color.
You can check out some of the samples in the DirectX SDK.
Tutorial03 would be a good starting point. It already creates a triangle. First, you would have to extend this a little to a quad. So, simply place two triangles in your vertex buffer. Don’t forget to adapt the ByteWidth of the buffer and the vertex count in the draw call. As vertex positions I would suggest for the bottom left corner (-0.5,-0.5) and for the top right corner (0.5, 0.5). (The z-component is your choice. It encodes the depth and must be in [0,1].)
If you got this you can start moving your quad around. Therefore you can pass a scale and translation vector to your shader and the scale / translate your vertex. The viewport goes from [-1,-1] to [1,1]. For the beginning you can hardcode a scale and translation in the vertex shader.
Finally you need some texture coordinates. You could either extend your vertex buffer to also contain them or you compute them from your position. Texture coordinates are in [0,1]. So, all you have to do would simply be adding a 0.5 to the vertex position the vertex shader received. You pass this texture coordinate on to the pixel shader and do a texture lookup. Tutorial 7 shows you how to do that. (You need to load a texture, get a shader resource view on it, bind that view to the pixel shader stage and you have to declare the texture in the shader.)
At the moment you would display the whole sprite sheet at once. So, last but not least, you’d have to scale and translate your texture coordinate to fit on the right sprite in your sprite sheet.
Feel free to ask if you’d like to have more help.
I always like to see and help people starting with graphics programming very soon.