Jump to content
  • Advertisement
Sign in to follow this  
angelmu88

Win32 dialog boxes and Directx

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

Hi!
I'm working on a 3d engine with directx and I would like to add real time control of my shader. For instance, I would like to set the velocity of my Day/Night cycle effect during the execution of the engine.I don't have enough time to build my own GUI engine so I decided to use win32 and simple dialog boxes, the problem is that when the dialog box pops up, the rendering of the main window stops, but the game logic continues. I mean, back to the Day/Night cycle example, if the sun was rising when the dialog box emerged, then when I return to the main window it't already night.

Is there anyway of solving this problem using Win32 api, or maybe a simple gui framework (I've heard something about wxwidgets)?

Share this post


Link to post
Share on other sites
Advertisement
How are you creating the dialog box? If you're using the DialogBox or DialogBoxParam functions, these functions create a modal dialog box, so execution doesn't return until the dialog is closed. Your main window will still receieve window messages like WM_TIMER though, so if you update your game logic as a result of that, it would explain your game updating but the renderer not.

Share this post


Link to post
Share on other sites

How are you creating the dialog box? If you're using the DialogBox or DialogBoxParam functions, these functions create a modal dialog box, so execution doesn't return until the dialog is closed. Your main window will still receieve window messages like WM_TIMER though, so if you update your game logic as a result of that, it would explain your game updating but the renderer not.

That was the problem, I was using a modal dialog box instead a modeless one. In addition when I closed the dialog box the timer was updated this way: "dt += TimeElapsed since previous frame", that's why I thought the game logic had been updated.
I'm going to change the code in order not to update the timer in this situation.
In the other hand I thought about using modeless dialog box and continue updating and rendering, but if I moved the dialog box to another position, the execution was stopped (I suppose Windows was dispatching some kind of message triggered when moving the dialog box), so I think I will go for the modal dialog box.
Thanks!!


Share this post


Link to post
Share on other sites

I'm going to change the code in order not to update the timer in this situation.
In the other hand I thought about using modeless dialog box and continue updating and rendering, but if I moved the dialog box to another position, the execution was stopped (I suppose Windows was dispatching some kind of message triggered when moving the dialog box), so I think I will go for the modal dialog box.
This is a problem with the main window as well. Windows goes into a modal loop as soon as you drag the title bar of a window, which is a bit annoying. You can get around it by starting a timer (SetTimer()) when you get the WM_ENTERSIZEMOVE message, and stopping it (KillTimer()) when you get WM_EXITSIZEMOVE, but it's a bit of a pain to deal with.

Also, if you're not rendering your scene in WM_PAINT, you could try doing that (Perhaps only when the modal dialog is open, depending on how expensive your render is) to get around any issues where the main window doesn't draw areas uncovered by your dialog (I don't think this is an issue on Windows 7 / Vista, but it is on XP).

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!