Programming Source Code Help!!!!

Recommended Posts

This has to do with the source code from Programming Role playing games with DirectX9 second edition. Anyone with that book would know the problem I am talking about but maybe someone could help me who doesnt. Anyways the code i am having trouble with is in Chapter 16 "The Tower". Windows.cpp cGraphics *Graphics; m_Height = m_Font->GetFontCOM()->DrawText(&Graphics, m_Text,sizeof(m_Text), &Rect, DT_CALCRECT | DT_WORDBREAK, 0xFFFFFFFF); They had Drawtext there with another format which is outdated and does not work with DX9. So I updated it with the new DrawText function and it asks for a &Sprite in the first parameter. Now I just defined a sprite to see if it would go but that did not work, I tried NULL as well. Now what I mean by it does not work is the game runs but you don't see the menu, text, and the sprites drag across the screen. In other terms its useless. My question can anyone help me fix this because this line is located Windows.cpp yet anything declared as a sprite is in Graphics.cpp which leaves me with a unidentified sprite if I was to try to call it from the other cpp. Any help would be appreciated!!! Contacts: AIM:LedLoaf Email:LedLoaf@comcast.net PS: If you own the book and have edited the source code yourself please send me it or explain how it could be fixed! Thanks!

Share on other sites
Try using "ID3DXSprite::Begin()" and "End()" when using that sprite... If "cGraphics" is a D3DX Sprite...

MSDN.

Share on other sites
Yes but see I just made a sprite to see if it would work because I am assuming I need to some how get a defined ID3DXSprite from graphics.cpp to Windows.cpp and put it in that function. In graphics.cpp there is ID3DXSprite assigned too m_Sprite but I can't access that from Windows.cpp

Share on other sites
Use a get function, such as "ID3DXSprite* cGraphic::SpriteGet()", or create a simple inline wrapper for "Begin()" and "End()" in your sprite.
Also, are you using headers, or just source files???

Share on other sites
this is what my source looks like

    m_Height = m_Font->GetFontCOM()->DrawText(NULL,m_Text, -1,                     &Rect, DT_CALCRECT | DT_WORDBREAK,                            0xFFFFFFFF) + 12;

Create an account

Register a new account

• Forum Statistics

• Total Topics
627701
• Total Posts
2978702

• 21
• 14
• 12
• 10
• 12