Jump to content
  • Advertisement
Sign in to follow this  

Help with basic problem in DX9 SDK Sample Project

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

I'm using the Sample Project as a foundation for developing a bigger game. I'm drawing some interface elements and am successfully drawing buttons, statics, checkboxes and what not. For some reason, I'm totally struggling with CDXUTDialog::DrawRect. I'd like to Draw a couple Rect's on the screen to use as indicator meters and a few other things. Everytime I try to use DrawRect() using the following code, or variations of it, it crashes.
	RECT *r;
        //Alternatively, I've tried RECT *r = new RECT();
	r->bottom = 0;
	r->top = 15;
	r->right = 20;
	r->bottom = 10;
	//Alternatively, I've tried using SetRect(&r, 0, 12, 20, 10);
        g_SelectedWindow.DrawRect(r, GREEN);

As the DrawRect is going through, it crashes in dxutgui.cpp, CDXUTDialog::DrawRect(...) at the following line:
At this point, I believe m_pSprite is null, which explains the crash, but I still dont know what m_pSprite is or where to initialize it. Can anyone give me some help on what m_pSprite is and where/how/when to initialize it? Thanks ahead of time for any help. [Edited by - EEder on May 11, 2005 8:14:47 PM]

Share this post

Link to post
Share on other sites
m_pSprite is a utility to draw 2D services in 3D.
You must make your draw rect calls while m_pSprite is valid and between calls to Begin and End.

search for "Sprite" in the directx docs. Look to the billboard sample or a partical sample to see examples of use within the sample framework.

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!