multithreaded strategy boardgame
- From: Adrien Treuille <treuilla gusun georgetown edu>
- To: gtk-list gnome org
- Subject: multithreaded strategy boardgame
- Date: Fri, 26 May 2000 14:52:20 -0400 (EDT)
Hi all,
Two quick questions:
1 - Is there a way of finding out the width and height of a GdkPixmap? I'm
reading the .xpm off the hard disk. I know I could just do an fscanf on
the file and parse it myself, but I was hoping for a more elegant solution
(i.e. have Gtk load the pixmap for me (via gdk_pixmap_create_from_xpm) and
then ask gdk itself for the width and height).
2 - How would one implement multithreading in gtk? (I'm a java programmer,
and new to threads in c/linux.) One solution seems to be LinuxThreads
(i.e. #include <pthreads.h>), and another seems to be gdk threads... Are
these two the same or not? If not which one would you recommend? Perhaps
something else? I'd like to be able to accomplish interthread
communication without using global variables. Also, where can I find good
sample code to learn how to do all this stuff.
Thanks,
Adrien
Regarding the second question: I'm writing a strategy board game like
chess called Lines of Action
(http://www.andromeda.com/people/ddyer/loa/loa.html). I'm hoping to
implement the AI module as a seperate thread. The thread would evaluate
positions the whole time. When the user makes a move the AI thread would
be given a time limit before which it has to make a response move. The AI
module's move would affect how the board looks, so the AI thread has to
interact safely with the GUI thread. Hope that helps.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]