Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Minimize = death

Author
Message
TGN
17
Years of Service
User Offline
Joined: 18th Dec 2006
Location: USA
Posted: 9th Jul 2007 02:53
Every time I minimize my windowed app, I always get an exception whenever my program comes upon an object, image, sprite, sync command or basically ANY command that has to deal with the display, and throws an exception and my program stops working. I've created a set of commands that automatically reloads whatever my app has loaded when it's minimized and restored if needed, but I can't stop it from coming upon these commands in the background. I tried putting a Try Catch and just letting the program ignore it but it causes the program to stop responding entirely, shouldn't there be some safeguarding code for this kinda stuff built into DarkGDK / .NET? I even put a check around every command I call from DarkGDK to make sure the window isn't minimized, but when I try to restore the window it just stops responding... What the hell am I supposed to do here?
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 9th Jul 2007 03:07
Some possible solutions to this, but I've not tried it:

1. Make sure that you're using the SyncOn function so that you are responsible for refreshing the display during your game loop.

2. When your app is minimized, make sure that sync isn't called so that display textures and resources don't break the app.

3. When you catch the window activate message, or your window is restored, actually re-execute the SetDisplayMode function so that the video board is reset and that you then reload and recreate all of the assets such as objects, textures and such as if your program had just started. See if this helps

Paul.

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 10th Jul 2007 02:10
Ouch - That's Pretty Harsh.

In other windows applications I've written, I usually put a error trapping wrapper around all my "screen" stuff - so that the code still "behaves" automatically regardless of screen metrics.

I hope I don't run into this with C++ version. If I do - I'll make a full window only kinda game - and not look for or make any attempt to handle "ALT+ENTER" or whatever - to switch between. Switching would be nice though. I find it useful to see how the game reacts in "Slow Mo" - because (at least for me) Windowed Mode is much Slower than full screen. And that way I can kinda see how my timing routines behave etc on a "Slower machine".

Best Regards,
Jason P Sage

Know way too many languages - Master of none
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 10th Jul 2007 02:36
I ought to point out that I'm not entirely sure why an exception would be thrown just by minimizing an application. In that situation, the video rendering surface isn't actually freed by DX, but merely skipped on rendering. The video change method would only need to be instigated if you actually have a full screen application which is then minimized, resulting in the usual windows desktop from appearing. This sometimes forces a video mode change and releasing all DX resources in the process.

DirectX does deal with resources that are lost during such an event, and both DGDK and DGDK.NET have a function to tell you that a screen switch had occurred. It's still the responsibility of the engineer to reload resources back into memory after a window switch event. How you handle this event is entirely up to you. Hell I've seen some programs that don't even bother with resource recovery, and they just shut down entirely. I'm sure some of you have seen commercial games do this when a screen switch has occurred.

Paul.

CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 10th Jul 2007 03:44
btw, I can minimize running dgdk.net exe's and they have never crashed.

My DBP plugins page is now hosted [href]here[/href]
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 10th Jul 2007 04:07
I personally haven't had a problem yet either using the C++ version.

...I don't see it posted here - and I may have my threads crossed - but I got an email saying this hasn't happened since the person did a windows update.

If I have my threads crossed, forgive me. (I've seen responses come in my email that haven't shown in the forum when I looked in the past so I'm not sure).

I've only been in exprimentation mode - and making classes I hope to reuse in my "whatever" project But I've done the minimize thing in a windowed screen and restored and maximized without trouble. However, as Paul wrote in another thread - You might run into issues going from full to windowed and back. I haven't tried this yet, so I don't know.

Know way too many languages - Master of none

Login to post a reply

Server time is: 2024-09-29 01:22:55
Your offset time is: 2024-09-29 01:22:55