This topic is 4728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hello all! I am trying to do a very simple tutorial but i cant compile it. THis is the code:
LPD3DXSPRITE sprite=NULL;

If (SUCCEEDED(D3DXCreateSprite(device,&sprite))
{
// created OK
}

m_sprite->Begin(0);

// Build our matrix to rotate, scale and position our sprite
D3DXMATRIX mat;
// out, scaling centre, scaling rotation, scaling, rotation centre, rotation, translation
D3DXMatrixTransformation2D(&mat,NULL,0.0,&scaling,&spriteCentre,rotation,&trans);

// Tell the sprite about the matrix
m_sprite->SetTransform(&mat);

// Draw the sprite
m_sprite->Draw(m_texture,NULL,NULL,NULL,0xFFFFFFFF));

// Thats it
m_sprite->End();

I get 4 Compiler errors out of this even though my book and an online tutorial has the code exactly like this The errors are: SetTransform is no element of ID3DXSprite ID3DXSprite::Begin function does not accept 1 Arguments ID3DXSprite::Draw function does not accept 5 Arguments Could not find D3DXMatrixTransformation2D My includes are: d3d9.h d3dx9.h d3d9.lib d3dx9.lib If anyone has a clue on what i am doing wrong pleas elet me know! I tried to read up for 2 days now and all i can find tells me that my code is correct. Thx in advance! Rozik

Share on other sites
A few important questions:

1. What book is this from? more importantly how old, and what SDK is on the CD?

2. What SDK are you using? ID3DXSprite and/or D3DX has changed a lot since some of the common books were published.

3. Which compiler are you using? you should, ideally, be using VC++ 2002, 2003 or 2005.

D3DXMatrixTransformation2D() does exist it seems, although no particular information on which SDK it was introduced in... which is odd [oh]

Jack

Share on other sites
Thx for the response:)

The Book is called DirectX 9 User Interfaces Design and Implementation
It has DirectX 9.0 SDK on the CD which i am useing too.
And i am useing Microsoft Visual Studio .NET 2003

Share on other sites
Well nm i got it:)
I installed the SDK on the CD and now it works even though mine said it was 9.0 too

no clue what the diffrence is

Thx for the efford:)

Share on other sites
Quote:
 Original post by RozikI installed the SDK on the CD and now it works even though mine said it was 9.0 toono clue what the diffrence isThx for the efford:)

Off the top of my head there have been 8 versions/revisions/refreshes of the DirectX 9.0 SDK. All of them carry the basic "DirectX 9.0 SDK" title, but usually have (in brackets) the release name after them.

Jack

• 10
• 16
• 9
• 13
• 41