Original Post
I'm just starting to become familiar with Direct3D 10. I'm trying to do a simple 2D app. To load the various images in the game, I use D3DX10CreateTextureFromFile(), which gives me an ID3D10Resource* which is ultimately an ID3D10Texture2D. I want to draw this texture at position (x,y) on the screen, but I'm not clear on the correct approach to do so. I've already created my shader resource views and filled in a D3DX10_SPRITE structure with the relevant info. I'm using the sequence of sprite->Begin() foreach (texture) sprite->DrawSpritesBuffered(texture) sprite->Flush() sprite->End() and this gets an image drawing on the screen, but the size is completely wrong, and it doesn't put it at the position x,y I want. Essentially I'd like a function: that I can invoke as follows: and draws the sprite at device coordinates (e.pos.x, e.pos.y) with no scaling. Thanks
void draw_texture(ID3D10Texture2D* texture, ID3DX10Sprite* sprite, D3DXVECTOR2 pos)
{
}
sprite->Begin();
foreach (Entity e in entities)
draw_texture(e.texture, sprite, e.pos);
sprite->Flush();
sprite->End();