Archived

This topic is now archived and is closed to further replies.

drewslater

ID3DXSprite MSDN Reference is Wrong?

Recommended Posts

I''m trying to use the ID3DXSprite interface to render a particle system. I''m using DX9 without the summer update (which only affects managed DX right?). According to MSDN ID3DXSprite.Begin() accepts a number of flags as parameters. When I tried to compile I got an error that Begin does not take 1 parameter. I searched for the function definition and according to the headers Begin takes 0 parameters. Also there are only 5 parameters listed for ID3DXSprite.Draw on the MSDN page:
HRESULT Draw(          LPDIRECT3DTEXTURE9 pTexture,
    CONST RECT *pSrcRect,
    CONST D3DXVECTOR3 *pCenter,
    CONST D3DXVECTOR3 *pPosition,
    D3DCOLOR Color
);
But in my headers Draw takes more(7) and different parameters. Of most concern is that the position in my headers is a 2d vector while on MSDN it is listed as a 3d vector. Anyone know why this is happening? Oh yeah, here is what my headers say is expected for Draw:
STDMETHOD(Draw)(THIS_ LPDIRECT3DTEXTURE9  pSrcTexture, 
        CONST RECT* pSrcRect, CONST D3DXVECTOR2* pScaling, 
        CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation, 
        CONST D3DXVECTOR2* pTranslation, D3DCOLOR Color) PURE;
Thanks for any help. This hasn''t changed by the Summer Update has it? ATS

Share this post


Link to post
Share on other sites
dont know what u did but i made a class for it...
dx9...

class D3DSprite {
private:
LPD3DXSPRITE lp_Sprite;
public:
D3DSprite()
{
lp_Sprite = NULL;
}

~D3DSprite()
{
if( lp_Sprite != NULL )
lp_Sprite->Release();
}

void init()
{
D3DXCreateSprite(lp_Device, &lp_Sprite );
}

void draw(LPDIRECT3DTEXTURE9 texture, float x, float y, int width, int height, int frame, float scaleX, float scaleY)
{
RECT abcRect;
abcRect.top = 0;
abcRect.left = frame * width;
abcRect.bottom = abcRect.top + height;
abcRect.right = abcRect.left + width;
D3DXVECTOR2 dScaling(scaleX, scaleY);
D3DXVECTOR2 dCoords(x, y);
lp_Sprite->Draw( texture, &abcRect, &dScaling, NULL, 0.0f, &dCoords, D3DCOLOR_XRGB(255,255,255) );
}
};

Share this post


Link to post
Share on other sites
The summer update changes the ID3DXFont and ID3DXSprite interfaces so they are faster. There are a few minor changes to other parts of the SDK as well.

Share this post


Link to post
Share on other sites