Sign in to follow this  
uggibuggi

Problem with minimizing my game

Recommended Posts

Hi, I'm working on a small Pong clone using Delphi and my own small 2D engine that's using directx. It may be a dumb question, but I just don't know what this could be... When I'm in fullscreen mode and I minimize the game, the DirectX device seems just to render nothing more when I go back to the game - the only thing I see is the window of my Game. I guess that I did something totally wrong, but I just can't imagine what it is... Do I have to reinitialize the device when going back to the game? As you see, I'm an absolute noob in this stuff, but I hope you can help me. Thanks for any help and sorry for my bad english

Share this post


Link to post
Share on other sites
If it's Direct3D, then it could be a lost device.

If it's DirectDraw, then it could be a lost surface (which is a similar thing except a single resource is in a 'lost' state rather than the whole device).

It's been so long since I did any DirectDraw that I can't remember the full procedure for recovering lost resources!, IIRC there is a Restore() call on the resource interface.


For Direct3D, take a look at the following part of the (C++) SDK documentation:

DirectX Graphics ->
Direct3D 9 ->
Programming Guide ->
Getting Started ->
Direct3D Devices ->
Lost Devices

That details what you need to do to recover from a lost device.

Share this post


Link to post
Share on other sites
Umm...

I tried to call the Reset() method of the device when the device is lost, but it always fails... I allocated all resources with D3DPOOL_MANAGED, and the SDK tells me that I don't have to reinitialize those resources...

Any idea what this could be? Do I have to deallocate all the resources first?

Share this post


Link to post
Share on other sites
What error does it return? If you're using any D3DX sprites or fonts or anything, you need to call their OnLostDevice() member functions (That's the C++ name, not sure what the Delphi name will be)

Share this post


Link to post
Share on other sites
I'm using both, D3DX sprites and fonts...

Directx does not support Delphi directly, I'm working with a wrapper - so the function should be exactly the same.

The Reset() function returns D3DERR_DEVICELOST.

So I'll try to release all the video memory resources using the OnLostDevice() functions of the font and sprite Interfaces... thanks for you help!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this