Skip to main content
gamedev.net
🔒 Locked

Sprite-Draw parameters

Started by Roverturbo 3 replies 700+ views
Original Post
Roverturbo
Roverturbo
Hi, I am trying to draw a sprite but when i come to sprite->Draw it says that it doesnt take 5 parameters even tho the example i was using uses 5. My code is basically like this:

      LPDIRECT3DTEXTURE9 menu;

      D3DXCreateTextureFromFile(m_pD3Ddev, "menu.png", &menu);

      D3DXVECTOR3 pos;

      pos.x = 10.0f;
      pos.y = 20.0f;
      pos.z = 0.0f;	
		
      LPD3DXSPRITE sprite = NULL;

      if(SUCCEEDED(D3DXCreateSprite(m_pD3Ddev, &sprite)))
      {
        sprite->Begin();
        sprite->Draw(menu, NULL, NULL, &pos, 0xFFFFFFFF);
        sprite->End();
      }



But the Draw function errors with "function does not take 5 parameters" and i cant find a reference to the parameters it takes. Any help into these parameters would be appreciated alot. Thanks. [Edited by - Roverturbo on November 10, 2005 2:49:13 PM]
Armadon
Armadon
ID3DXSprite::Draw()
Parameters:
HRESULT Draw(
LPDIRECT3DTEXTURE9 pTexture,
CONST RECT * pSrcRect,
CONST D3DXVECTOR3 * pCenter,
CONST D3DXVECTOR3 * pPosition,
D3DCOLOR Color
);

It's best to always follow the SDK docs rather than the tutorial as the tutorial could have been written in a previous SDK update and a new parameter or so added.

I hope this helps.
Take care.
circlesoft
circlesoft
The D3DX interfaces change from time to time, so that article was probably written for a different version for sprite. What version of the SDK do you have? If you can't tell, fire up the docs and it should be on the top of every page, in the right-hand corner.

Plus, if you are already in the docs, just enter 'ID3XSprite' into the Index. You should be able to find the Draw() documentation from there.
Roverturbo
Roverturbo
Thankyou for you help, Problem fixed.

:)
Madprog
Madprog
im having the same problem how did u fix it aparrextly i have an older version but i WANT to use it so how can i fix it??

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.