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 / Fullscreen "alt+tab" problem. :)

Author
Message
AlecG
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 7th Feb 2010 12:31 Edited at: 7th Feb 2010 12:33
Hello everyone
Now i can go to fullscreen and back -everythihg is fine. When the program is in the fullscreen mode and i hit "alt+tab" it goes back to the desktop, everything works well, but when i try to maximize the window by clicking the mouse left button on it - the program is crashing.

How can i fix that? Can somebody help?
Thank for help!


I am using default 2d project with simple modification..


Dark GDK IS THE BEST!!!!
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 7th Feb 2010 12:50
Your signature text is incorrect because GDK wipes all media when the device is lost, this would be fine if it restored it, but it doesn't! You no doubt discovered this when changing to and from fullscreen, that you must reload all media. When you tab out you still have to do this, but it's not as easy to trap it.

One very bad method I've used in the past is to create a dummy object I always keep in memory, I then check if it exists after I call dbSync(), if at any time I find the object doesn't exist, then I know the device was lost and then trigger code to reload everything. I'm sure there's a far better method to do this by actually listening for the message from D3D about the flush but this works.

Oh, and although there is the 'dbScreenInvalid()', it returns -1 even when the device wasn't lost, like if you tab between windowed tabs making it completely useless.

AlecG
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 7th Feb 2010 15:49
Hm.... very strange.. so powerfull software and such problem with so simple things... Well your "bad" method is no so bad as you said. Because it will work anytime we need... But i still think there must be another way to fix this problems. What do you think about
"void dbRestoreLostDevice (void)" in "DarkSDKDisplay.h" did you use this function? I did not find any function to check if the divece is lost. I am sure i can`t put this function into main loop....

Dark GDK IS THE BEST!!!!
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 7th Feb 2010 16:35
Restoring the device itself is handled, just not anything the device handles, i.e. objects, images, etc. Though sounds and music should remain.

AlecG
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 7th Feb 2010 17:00
I see... thanks very much! You helped me a lot!
Could you show me the example of the code for using dummy object?
What object did you use? Simple box?

Dark GDK IS THE BEST!!!!
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 7th Feb 2010 18:45
I used a cube yes, there's not really much code to it, just a few lines to create, hide, and check if it exists and recreating the cube then the hard part: remaking all the media. I can't show simple code to do that because in my case my whole library is OO and wraps GDK so it's rather trivial to reload meshes and images(though reassigning textures and stuff is annoying).

AlecG
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 7th Feb 2010 18:59
Ok i will try to code this.. and show my variant.. if it will be wrong could you tell me where?

Dark GDK IS THE BEST!!!!
AlecG
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 14th Feb 2010 20:26
Hello again Yes it is working with dummy objects and everything is very simple. But i have another problem - when the window goes to the windowed mode after fullscreen mode the window border disappear.
I am useing "dbSetWindowLayout ( 3, 0, 0 );" after changing the window mode but it not work.
Here is my code:



Dark GDK IS THE BEST!!!!

Login to post a reply

Server time is: 2024-10-02 01:39:54
Your offset time is: 2024-10-02 01:39:54