Re: Game loop with Gtk.



Does anyone have any advice on using GTK to write a
game style loop using Gtk?

What is the best type of widget to use for images?
Canvas items? Pixmaps? Pixbufs?

How do I achieve double buffering? How do I move
images around the screen as smoothly and fast as
possible?

Yes, and unless you are writing `board game', GTK+ or any widget set would
really slow things down.

If you are writing a board game you can design things the typical way, if
performance is an issue ou should use either gtk_timeout_add(0 to add a
timeout to a function which updates yer game every so often.

Or use gtk_main_iteration() instead of gtk_main(). Since
gtk_main_iteration() does not block input and `manages' gtk for one
cycle.

Look into the GTK+ GLArea widget for drawing, even 2D games would benifit
from OpenGL design with gtk.

--
Sincerely,                  ,"-_                         \|/
-Capt. Taura M.             ,   O=__                    --X--
..__                         ,_JNMNNEO=_                 /|\
OMNOUMmnne.                  {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
                  http://furry.ao.net/~learfox/






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]