Jump to content
  • Advertisement
Sign in to follow this  
Somebody Else

Configuring DirectX properly

This topic is 4840 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

Here's hoping someone can help me with this silly problem. It's got to be something with my configuration but I just don't know what. I'm trying to modify and rebuild a tile sample from the book "Programming RPGs using DirectX (2nd ed.)" The code I'm using seems to be good, however, I'm getting errors related to the DirectX itself. I'm using Visual Studio 2002 (V.7) and my DirectX SDK is 9.0c (from July, which is newer than the book.) The old EXE from the book's disc runs great but when I try to rebuild it, I get: Core_Graphics.cpp(368): error C2660: 'ID3DXSprite::Begin' : function does not take 0 parameters Core_Graphics.cpp(989): error C2664: 'D3DXCreateFontIndirectA' : cannot convert parameter 2 from 'LOGFONT *' to 'const D3DXFONT_DESCA *' Core_Graphics.cpp(1004): error C2039: 'Begin' : is not a member of 'ID3DXFont' Core_Graphics.cpp(1013): error C2039: 'End' : is not a member of 'ID3DXFont' Core_Graphics.cpp(1034): error C2660: 'ID3DXFont::DrawTextA' : function does not take 5 parameters Core_Graphics.cpp(2391): error C2660: 'ID3DXSprite::Draw' : function does not take 7 parameters I've set my Libs, Includes, and Utilities properly in the environment itself. It looks like it's finding these files but they j ust don't jive up with what it expects. Any advice?

Share this post


Link to post
Share on other sites
Advertisement
Thats because you're using a newer version of Direct3D. The newer version of Direct3D has different versions of D3DX. ID3DXSprite::Begin() requires a single input variable (of D3DXSPRITE type. i.e. D3DXSPRITE_ALPHABLEND, D3DXSPRITE_DONOTMODIFY, 0, etc)
ID3DXFont doesn't have a Begin()/End() function. They require a ID3DXSprite.

All of the new stuff should be in your documents.

Share this post


Link to post
Share on other sites
Quote:
Original post by Somebody Else
So, just edit these to match the new declarations?

Thanks for the quick response!


No problem! If you need any help, I'll respond tomorrow (its taking like 5 minutes for my pages to load for some reason).

Share this post


Link to post
Share on other sites
Had a couple questions about converting some of these:

#1:
'Begin' : is not a member of 'ID3DXFont' (and the related "end is not a member")

I'm just really not sure about the new procedure for using fonts. What should I be doing instead of calling begins and ends?

Here's the code in question: (Identical for End())

BOOL cFont::Begin()
{
if(m_Font == NULL)
return FALSE;
if(FAILED(m_Font->Begin()))
return FALSE;
return TRUE;
}

#2:
'ID3DXSprite::Draw' : function does not take 7 parameters

I've trimmed it as appropriate, but the new version takes Vector3's instead of Vector2's - I already have my X and Y from the old code, but I'm clueless what I should be putting as the Z.

Share this post


Link to post
Share on other sites
Quote:
Original post by Somebody Else
Had a couple questions about converting some of these:

#1:
'Begin' : is not a member of 'ID3DXFont' (and the related "end is not a member")

I'm just really not sure about the new procedure for using fonts. What should I be doing instead of calling begins and ends?

Here's the code in question: (Identical for End())

BOOL cFont::Begin()
{
if(m_Font == NULL)
return FALSE;
if(FAILED(m_Font->Begin()))
return FALSE;
return TRUE;
}

#2:
'ID3DXSprite::Draw' : function does not take 7 parameters

I've trimmed it as appropriate, but the new version takes Vector3's instead of Vector2's - I already have my X and Y from the old code, but I'm clueless what I should be putting as the Z.


Ok, you just need to remove cFont::Begin() and cFont::End(). You need to call the DrawText() inside of the ID3DXSprite's Begin() and End().

As for the vector, instead of '&YourVector2', do '&D3DXVECTOR3(YourVector2.x, YourVector2.y, 0.0f)'.

I'll give you a better reply for the Begin/End problem when I get DirectX reinstalled.

Share this post


Link to post
Share on other sites
Now that's going the extra mile.

Gotten everything resolved on that front, and commented out the begin & end. I think I see now how to use the new DrawText commands now.

The build succeeds now, but, pardon my newbishness, it doesn't seem to spit out an exe file. The source code was originally a VC++6 file, that my Visual Studio converted into a solution file.

When I build, it says "1 succeeded" but I can't find an exe file in the directory, or with Find Files, and if I try to use the Run command, it comes up with a prompt asking for what exe file.

Have I forgotten to config something in my VS?

Share this post


Link to post
Share on other sites
Quote:
Original post by Somebody Else
Now that's going the extra mile.

Gotten everything resolved on that front, and commented out the begin & end. I think I see now how to use the new DrawText commands now.

The build succeeds now, but, pardon my newbishness, it doesn't seem to spit out an exe file. The source code was originally a VC++6 file, that my Visual Studio converted into a solution file.

When I build, it says "1 succeeded" but I can't find an exe file in the directory, or with Find Files, and if I try to use the Run command, it comes up with a prompt asking for what exe file.

Have I forgotten to config something in my VS?


I don't have VS 2002, but I do have a friend that uses it. I'll ask him, and get back to you.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!