Jump to content
  • Advertisement
Sign in to follow this  

Sprites: Issues with Sample Code

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I apologize in advance since I know this topic has already come up, but I did not find a solution in the previous threads. I recently started game programming and have purchased several books one of which is "Beginning Game Programming" I have been working my way through the projects and I am currently receiving errors related to two lines of code. sprite_handler->Begin(D3DXSPRITE_ALPHABLEND); and sprite_handler->Draw(kitty_image[kitty.curframe], NULL,NULL,&position, D3DCOLOR_XRGB(255,255,255)); The first returns the error saying that D3DXSPRITE_ALPHABLEND is an undeclared identifier, and the second says that Draw does not take five arguments (actually its more like 7 when I looked at the function definition) I attempted to compile the source code that came with the book and I still receive these two errors. I installed DirectX9.0c and that did not change anything either. d3d9.lib and d3d9x.lib have both been included in my project settings. I have tried to compile both with Visual Studio.net and DevC++. If someone has a solution it would greatly be appreciated. Thanks, Ermac

Share this post


Link to post
Share on other sites
Advertisement
It looks like the version of the SDK your compiler is pointing at doesn't match the version used by the book. In the latest SDK (June 2005), The Draw method does take 5 parameters. As for the D3DXSPRITE_ALPHABLEND, that is definitely defined in d3dx9.h.

I would recommend that you check your compiler settings and make sure that the include and lib directories are pointing at the correct version of the SDK and that they appear at the top of the list of directories.

Share this post


Link to post
Share on other sites
Okay thank you,

I installed the SDK that came with the book which looks like just 9.0. What is the most recent SDK and where might I find that?

Or is it possible that I messed up on an installation or something. The book did not cover this but I sort of jerry-rigged it on my own, I copied the .libs and .h files into the lib and include folders respectively for Visual Studio .NET\Platform SDK etc when compiling wasn't recognizing the .h files. Was this the proper way to do this or was there something that I missed?

Share this post


Link to post
Share on other sites
You can get the latest DirectX SDK from here.

If you have VS .NET, then the install should automatically integrate the directories into your VS .NET configuration. If not, then you will have to configure the directories in your compiler options.

Manually copying the libs/headers is definitely not the way to go about it. It will cause you no end of grief whenever you update the SDK.

Share this post


Link to post
Share on other sites
Rock On,
Thank you for the help. Once I got the new SDK and compiled it worked. I think I missed the option to directly install for VS.net on the previous version of the SDK anyway.

Thanks,
Ermac

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!