locked
Directx Sample Framework GUI RRS feed

  • Question

  • Hi,

    I've been coding using the managed directx sample framework and have been trying to use the sample gui. I have created a dialog for my main menu screen which has an options button. I have created another dialog for my options screen and I want to be able to switch between the two screens.

    The way I am trying to do this is by having a gamestate variable which changes when the options button is clicked. I then have switch statements in both my OnRender event and my OnMsgProc event to switch between the code for rendering and receiving messages for the different dialogs. I pretty much followed the method in the third section Tom Millers "beginning 3d Game Programming" book.

    The first screen works fine howver when I switch to the second screen the dialog doesn't respond to mouseover. I can still click the buttons but they don't change colour when I hover over them. When I go back to the first screen (via another button) everything is fine again.

    Is this something to do with focus? how can I get around this?

    As a further test I added a third dialog which is present on both screens and it too has its mouseover suspended while on the second screen.

    I'm assuming that there's some other code that I have to include when switching screens or I have to display and hide the dialogs a different way.

    I notice that the ShowSettingsDialog method from the framework doesn't suffer from this problem but I can't worl out what it does differently.

    Any help would be much appreciated.
    Thursday, September 29, 2005 7:06 AM

Answers

  • Well I seem to have fixed this problem. The fix was to place the following code in my OnClick method after the change to my currentState variable:

    Dialog.SetRefreshTime((float)FrameworkTimer.GetTime());

    I'm not sure if that's the best place for it or why I haven't had to call it in my OnClick method going back to the original dialog so if anyone can clear me up on this I'd still appreciate the help.

    I worked this out by looking at the SettingsDialog.Refresh() method.

    Thursday, September 29, 2005 8:39 AM