Hello,
Currently I'm thinking about developing 2D game on Direct3D, I'm thinking about using ID3DXSprite and ID3DXFont to draw 2D stuffs and text.
In DirectX document stated that the usage of ID3DXSprite is :-
pSprite->Begin();
pSprite->Draw();
...
pSprite->Draw();
pSprite->End();
pDevice->Present();
But there are nowhere state that, should I use only 1 ID3DXSprite object, or use separate many objects to each jobs.
Assume that there are 3 layers of screen - background, foreground, and text, each layer may contains several objects. And below is my current choice:-
1. Use 1 ID3DXSprite object to the whole thing :
pSprite->Begin();
//render background objects
//render foreground objects
//render text objects
pSprite->End();
pDevice->Present();
2. Use 1 ID3DXSprite object for each layer :
pSpriteBackground->Begin();
//render background objects
pSpriteBackground->End();
pSpriteForeground->Begin();
//render foreground objects
pSpriteForeground->End();
pFont1->DrawText(pSpriteText,...);
pFont1->DrawText(pSpriteText,...);
...
pDevice->Present();
3. Use 1 ID3DXSDSprite object for each object.
Or, maybe there will be another way that you prefer, please discuss.
Regards,
Wutipong