Jump to content


Photo

Dialogs, Etc.


  • Please log in to reply
12 replies to this topic

#1 rincewind

rincewind

    Programming Department

  • Xenocide Programming Department
  • 541 posts

Posted 14 February 2005 - 05:39 AM

Hi,

I just checked in some major code changes.
First the XNet is now opened from Planetscape's XNet-Button. That's what you see in the frontend, the interesting thing in the backend is, that now, you can open the XNet from everywhere and once you close it, you return to the exact same state, you opened it from (very nice if you open the XNet from an intercept craft dialog, etc).

Since this works through boost::fsm, the state being restored after xnet closes has to be in terms of fsm-states. (e.g. a dialog being shown must be a substate of the screen, etc).

Related to this, I moved the optionsdialog out from the planetscape and made it a separate class (it's really a template from which you have to derive your specialized options-dialog for your screen. Sounds worse than it is, just look at planetscape for how it's done).
This allows options-dialog to be shown from all screens and also automatically hides it when the screen is exited (hierarchical state machines rule).

Also in the code is a preliminary fadingmanager that "hopefully" will allow crossfading between screens sometime in the future. Currently it's not working though.

Thats it for now, if you have any critizism or questions, post them here please.

Rincewind

P.S: For the future, all dialogs should at least be put into separate substates. They don't have to be templated if it's sure that they will only be shown in one screen (e.g. intercept dialog, etc). If you don't template them, there's also no need to have all that separate internal fsm stuff currently in OptionsDialog.
Posted Image

I love boost!!! The next best thing since the invention of C++.

#2 SupSuper

SupSuper

    Programming Department

  • Xenocide Programming Department
  • 2,418 posts

Posted 15 February 2005 - 10:22 AM

hmmm... the code does seem like a bigger mess now, but i'll eventually figure it out.

edit:
now i can't figure out how to add events to widgets in the Options dialog. the more i look at the code, the more confusing it looks :blink:

Edited by SupSuper, 15 February 2005 - 10:58 AM.

too bad, now you will never know the ancient secrets of supsupers long gone avatar ;)

Posted Image


#3 rincewind

rincewind

    Programming Department

  • Xenocide Programming Department
  • 541 posts

Posted 15 February 2005 - 11:07 AM

hmmm... the code does seem like a bigger mess now, but i'll eventually figure it out.

edit:
now i can't figure out how to add events to widgets in the Options dialog. the more i look at the code, the more confusing it looks :blink:

<{POST_SNAPBACK}>


Hi,

I always knew that C++ templates were the work of the Devil,and now Iím sure :-)
-Cliff Click


The templates are a bit confusing in the beginning but once you get used to it, it's actually pretty nice.

I'll be back in about two hours. If you want to, contact me on icq then. I can try to explain it there.

Rincewind
Posted Image

I love boost!!! The next best thing since the invention of C++.

#4 rincewind

rincewind

    Programming Department

  • Xenocide Programming Department
  • 541 posts

Posted 16 February 2005 - 11:25 AM

Ok, I cleaned up the options-dialog a little.
The code is a lot cleaner now that I was able to get rid of the entire internal state machine stuff.
Also, I got rid of the back button in the sound page. Clicking the X in the corner now brings you back to the main page.

Rincewind
Posted Image

I love boost!!! The next best thing since the invention of C++.

#5 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 17 February 2005 - 06:15 AM

Hi
Should i also use fsm::event or something like this to use widgets on sound options ?? Or rather add some normal functions to OptionsDialog class?

Beetle
Posted Image

#6 rincewind

rincewind

    Programming Department

  • Xenocide Programming Department
  • 541 posts

Posted 17 February 2005 - 07:01 AM

Hi
Should i also use fsm::event or something like this to use widgets on sound options ?? Or rather add some normal functions to OptionsDialog class?

Beetle

<{POST_SNAPBACK}>


Using fsm::event makes it more standardizes, so I would go with this. You should probably add custom_reactions to them in the SoundDialog class that call methods on the AudioSystem. This way, it's all nicely encapsulated inside the SoundOptionsDialog.

Rincewind
Posted Image

I love boost!!! The next best thing since the invention of C++.

#7 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 17 February 2005 - 07:51 AM

OK i have done handling functions ;) Now i have to find how can i add to them fsm::event state :P

One more: when i quit from options dialog Planetview::publish() is called. Is this right? Since in fact palnetview is still rendering in background.

Beetle
Posted Image

#8 rincewind

rincewind

    Programming Department

  • Xenocide Programming Department
  • 541 posts

Posted 17 February 2005 - 08:52 AM

OK i have done handling functions ;) Now i have to find how can i add to them fsm::event state :P

One more: when i quit from options dialog Planetview::publish() is called. Is this right? Since in fact palnetview is still rendering in background.

Beetle

<{POST_SNAPBACK}>


Concerning the handling functions: You have to define a new Event (look where there's struct EvExitOptions, etc).
Then you have to add them to the reactions of the SoundOptionsState (look at the definition of SoundOptionsState and the custom_reactions therein) and add a react(...) function for it to SoundOptionsState.

About publish:
No this definitly should NOT happen. Very weird. I'll take a look at it once I get home.

Greetings,

Rincewind
Posted Image

I love boost!!! The next best thing since the invention of C++.

#9 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 17 February 2005 - 02:03 PM

I'm confused :Brickwall: :Brickwall: :Brickwall: :Brickwall: :freak3: OMG

Can you add one empty example? Please?

Beetle
Posted Image

#10 rincewind

rincewind

    Programming Department

  • Xenocide Programming Department
  • 541 posts

Posted 01 March 2005 - 08:49 AM

OK i have done handling functions ;) Now i have to find how can i add to them fsm::event state :P

One more: when i quit from options dialog Planetview::publish() is called. Is this right? Since in fact palnetview is still rendering in background.

Beetle

<{POST_SNAPBACK}>


Finally managed to get something done. In optionsdialog.h there's now an example event together with handling, just search for example and you should find all the places that relate to it together with some comments.
Contact me on icq or by pm if you want assistance.

About the publish, I just posted to the boost-mailinglist to see whats wrong with my code there. I think it's a bug in boost::fsm.

Rincewind
Posted Image

I love boost!!! The next best thing since the invention of C++.

#11 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 01 March 2005 - 04:05 PM

I still have problems :Brickwall: :Brickwall: :Brickwall: :Tantrum: :Tantrum: :Tantrum:

Now with compiling.

d:\Programming\Projekty\Xenocide\xenocide\src\client\ui\planetview\../optionsdialog\optionsdialog.h(57) : error C2976: 'Xenocide::Client::UI::NoOpInnerInitial' : too few template arguments
        ..\..\..\xenocide\src\client\ui\uimanager.h(109) : see declaration of 'Xenocide::Client::UI::NoOpInnerInitial'
        d:\Programming\Projekty\Xenocide\xenocide\src\client\ui\planetview\../optionsdialog\optionsdialog.h(202) : see reference to class template instantiation 'Xenocide::Client::UI::Common::OptionsDialog<ParentState,ReturnState>' being compiled
d:\Programming\Projekty\Xenocide\xenocide\src\client\ui\planetview\../optionsdialog\optionsdialog.h(59) : error C3203: 'NoOpInnerInitial' : class template invalid as template argument for template parameter 'ReturnState', expected a real type
d:\Programming\Projekty\Xenocide\xenocide\src\client\ui\planetview\../optionsdialog\optionsdialog.h(57) : error C2976: 'Xenocide::Client::UI::NoOpInnerInitial' : too few template arguments
        ..\..\..\xenocide\src\client\ui\uimanager.h(109) : see declaration of 'Xenocide::Client::UI::NoOpInnerInitial'
        d:\Programming\Projekty\Xenocide\xenocide\src\client\ui\planetview\../optionsdialog\optionsdialog.h(72) : see reference to class template instantiation 'Xenocide::Client::UI::Common::OptionsDialog<ParentState,ReturnState>::OptionsSoundState' being compiled


maybe we have diffrent uimanager.h ??

Beetle
Posted Image

#12 rincewind

rincewind

    Programming Department

  • Xenocide Programming Department
  • 541 posts

Posted 01 March 2005 - 05:33 PM

I still have problems  :Brickwall:  :Brickwall:  :Brickwall:  :Tantrum:  :Tantrum:  :Tantrum:

Now with compiling.

d:\Programming\Projekty\Xenocide\xenocide\src\client\ui\planetview\../optionsdialog\optionsdialog.h(57) : error C2976: 'Xenocide::Client::UI::NoOpInnerInitial' : too few template arguments
        ..\..\..\xenocide\src\client\ui\uimanager.h(109) : see declaration of 'Xenocide::Client::UI::NoOpInnerInitial'
        d:\Programming\Projekty\Xenocide\xenocide\src\client\ui\planetview\../optionsdialog\optionsdialog.h(202) : see reference to class template instantiation 'Xenocide::Client::UI::Common::OptionsDialog<ParentState,ReturnState>' being compiled
d:\Programming\Projekty\Xenocide\xenocide\src\client\ui\planetview\../optionsdialog\optionsdialog.h(59) : error C3203: 'NoOpInnerInitial' : class template invalid as template argument for template parameter 'ReturnState', expected a real type
d:\Programming\Projekty\Xenocide\xenocide\src\client\ui\planetview\../optionsdialog\optionsdialog.h(57) : error C2976: 'Xenocide::Client::UI::NoOpInnerInitial' : too few template arguments
        ..\..\..\xenocide\src\client\ui\uimanager.h(109) : see declaration of 'Xenocide::Client::UI::NoOpInnerInitial'
        d:\Programming\Projekty\Xenocide\xenocide\src\client\ui\planetview\../optionsdialog\optionsdialog.h(72) : see reference to class template instantiation 'Xenocide::Client::UI::Common::OptionsDialog<ParentState,ReturnState>::OptionsSoundState' being compiled


maybe we have diffrent uimanager.h ??

Beetle

<{POST_SNAPBACK}>


Yes, I forgot that one. Thats the problem if you work on too many problems at the same time. Should work now.

Rincewind
Posted Image

I love boost!!! The next best thing since the invention of C++.

#13 Beetle

Beetle

    Programming Department

  • Xenocide Inactive
  • 350 posts

Posted 02 March 2005 - 03:34 PM

ok i have done it :) thank you rincewind for an example, and also for a great comments :master: :master: :master:

Beetle
Posted Image