# error C2065 : D3DXSPRITE_ALPHABLEND

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

## Recommended Posts

The Opening and the Greeting : Greetings all, my name is John and I am new to the GameDev forums. Now that I have introduced myself and greeted everyone, I shall get to my issue[s] at hand. Thanks to all in Advance. First, to the point, then some background info. The Effort : I am trying to animate a transparent 2D sprite on a background image. The Code : Here is the exact [snippet of] code that I am using :

//start rendering
if (d3ddev->BeginScene())
{
//erase the entire background
d3ddev->StretchRect(back, NULL, backbuffer, NULL, D3DTEXF_NONE);

//start sprite handler
sprite_handler->Begin(D3DXSPRITE_ALPHABLEND);

//create vector to update sprite position
D3DXVECTOR3 position((float)kitty.x, (float)kitty.y, 0);

//draw the sprite
sprite_handler->Draw(
kitty_image[kitty.curframe],
NULL,
NULL,
&position,
D3DCOLOR_XRGB(255,255,255));

//stop drawing
sprite_handler->End();

//stop rendering
d3ddev->EndScene();
}


The Issue[s] : These are the errors I get with ANY code using D3DXSPRITE_ALPHABLEND :
Quote:
 Deleting intermediate files and output files for project 'trans_sprite - Win32 Debug'. --------------------Configuration: trans_sprite - Win32 Debug-------------------- Compiling... dxgraphics.cpp game.cpp c:\gamebook\trans_sprite\game.cpp(120) : error C2065: 'D3DXSPRITE_ALPHABLEND' : undeclared identifier c:\gamebook\trans_sprite\game.cpp(131) : error C2660: 'Draw' : function does not take 5 parameters winmain.cpp Error executing cl.exe. trans_sprite.exe - 2 error(s), 0 warning(s)
The Confusion : It seems that no matter what header and / or library that I #include / add to my project / settings, VC6 just throws a fit when I try to use code with D3DXSPRITE_ALPHABLEND. All DirectX / Direct3D and other samples compile and run flawlessly in my current environment. The Question[s] : Can someone please tell me where D3DXSPRITE_ALPHABLEND is defined ? [header or library, please?]. It seems that everone else's code using this works fine. Did Microsoft just 'drop' D3DXSPRITE_ALPHABLEND between Dx 9.0b and Dx 9.0c? The Gripe : Oh and last time I checked, the entire God-Blessed internet sems to say that not only does the 'Draw' function take 5 parameters, it WILL NOT work with any other number of parameters. So who is right and who is wrong? Is / are my configuration[s] wrong, or is MicroSoft just being 'difficult' again ? The Background Info : I bought the book "BEGINNIG GAME PROGRAMMING" by Jonathan S. Harbour. It looks promising, but comes with headaches; asprin not included. The book uses DirectX 9.0b I believe [9.x something anyway]. So I install DirectX 9.0c [closest I had] then go go to MicroSoft and download The latest SDK [November 2007 maybe ?]. I still get the above mentioned errors. The Development Environment : Operating System .... Windows XP Home Edition ]5.1, Build 2600] OS Add-Ons ........... Service Pack 2 Installed Compiler / IDE ......... Microsoft Visual C++ 6.0 Standard Edition DirectX Runtime[s] ... DirectX 9.0c [4.09.0000.0904] DirectX SDK ............ DirectX 9.0 SDK [November 2007] CPU ....................... Celeron 2.60 GHz [no over-clocking] System Memory ....... 2.00 Gb [2048 Mb] Graphics Card .......... ATI Radeon 9550 AGP Video Memory .......... 256 Mb DDR The Closing and The Pleading : Please help, as this is starting to get on my nerves. Thank You all, so much. Apologies for the long post. Sincerely, Mr. John Hardeman.

##### Share on other sites
Looks like you're using an out of date SDK. The older SDKs didn't take as many parameters to Draw(), and didn't have the D3DXSPRITE_ALPHABLEND flag (Or if they did, it had a different name).

VC6 is not a supported compiler, it's over 10 years old, and it's not even a standard C++ compiler (It breaks the standard in many ways, can produce corrupt code, and produces sub-optimal code for a start). I can't remember what DX SDK was the last supported one for VC6 (December 2004 maybe?).

You'll need (pretty much) the exact SDK version as was used to compile the code originally (It usually comes on a CD with the book), since the D3DX interfaces have changed a fair bit. However, I'd recommend grabbing the latest SDK and then trying to port the code over. The interfaces haven't changed in a while now, and I don't see them changing much at all again.

##### Share on other sites

Greets,

Thanks for the help, Evil Steve. You were right about the
SDK being outdated. It wasn't *supposed* to be, though. The
book "Beginning Game Programming" by Jonathan S. Harbour states
that it uses DirectX 9.0b. I believe that *may* be a misprint,
although the DirectX 9.0b SDK with Run-Time files and updates
are all on the CD, nothing worked right until I re-installed the
DirectX 9.0c SDK. It seems that I had *part* of DirectX 9.0c
lingering about from a previous install. It would seem that D3DXSPRITE_ALPHABLEND didn't exist until DirectX 9.0c? Who knows?
Anyway I wanted to share the solution with others.

While we're at it,
if anyone knows how to switch to 320 x 240 x 256 color [8-bit] video mode
it would be much appreciated. I'll repost as a separate question when I
have more time.

Thank you again for the help.

Sincerely, Mr. John Hardeman

1. 1
Rutin
32
2. 2
3. 3
4. 4
5. 5

• 13
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633325
• Total Posts
3011370
• ### Who's Online (See full list)

There are no registered users currently online

×