Re: window is not shown
- From: "Paul Davis" <pjdavis engineering uiowa edu>
- To: gtkmm-list gnome org
- Subject: Re: window is not shown
- Date: Tue, 5 Sep 2006 22:29:11 -0500
Oh, and when I said, 250,000 ms, I meant 250 ms, or .25 s.
4 minutes would be quite a while to wait for the gui. Along with making the game a real bore to play. :D
Paul
On 9/5/06, Paul Davis <pjdavis engineering uiowa edu> wrote:
Diether,
Like you say, its mostly a design decision. If you look in the
list archives, there was a rather large discussion on how to have
a progress bar remain responsive while a computationaly expensive
calculation of some sort was being performed. I don't believe the
answer was to use Main::iteration(), but something about processing all
the events in the event queue.
Personally, my two cents were always to isolate the the complex
calculation from the gui thread and communicate using either shared
memory, or IPC. IMHO, shared memory is the easier of the two.
And another thing to consider, how long will it actually take you to
calculate the AI move? If its less than say 250,000 ms, you might
as well do it inline with the gui and not worry about it. IIRC,
most gui's are rated acceptable of GUI updates are kept to less than a
1/3 of a second or so.
Cheers,
Paul
Hello,
> I'm curious. What is the reason that you're calling Main::iteration()
> instead of Main::run()?
In the example I could have used 'Main::run()' but I have not thought of it.
In my project I want to have the control in the program flow, not in the gui.
There
I have a class 'UI' which gets events from the program flow. The ui
itself contains all gtkmm parts. If I would use 'Main::run()' instead
of 'Main::iteration()' I have to let the UI take over the control.
Example:
game starts
+- player 1 has to play a card (AI)
| `- calculates, calls 'Main::iteration()'
+- player 2 has to play a card (human)
+- ask UI to return a card
`- trick full
`- wait for UI
With the UI in control it would be something like this (or a mix of both)
Window
+- game starts -- tell 'Game' to start itself
+- ask player 1 for a card, give it to the game
| `- calculates, calls 'Main::iteration()'
+- ask human (by graphical interface) for a card, give it to the game
+- tell the game to close the trick
So there is no way to get rid of calls of 'Main::iteration()' while the computer is calculating as far as I know.
I
prefer the first version, it is simplier in my opinion, and it is less
work to change the user interface (I plan to add a text based one).
Greetings
Diether Knof
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iD8DBQFE+GcMWhZKqhP/l4gRAiCYAKCi5EFvSsz7Cdeq85m57oOzTvP/6gCeMLmv
0815tPBT0igJ53B6bqWOuqk=
=/gj8
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]