General GDK cluelessness (on my part)



I've been fiddling with GTK+/GDK for about a month now, and I have most of
the GTK stuff down enough that I'm able to write simple apps with it and
be fairly pleased with the result.  The GDK stuff is a bit harder, mostly
because it is not as well documented.  I bought the Harlow book (which I
have mixed feelings about) and it has been somewhat helpful, but there are
a few things I just don't grok.

I started working on a simple roleplaying game in the style of Ultima4
using it.  Right now I'mw working on the map editor.  As long as I had the
drawing for the map and such in the main module, everything was OK, but
when I moved to an approach that seemed better from a software engineering
perspective, things went down hill quickly.  I now am declaring my backing
pixmap and my array of tile types in the main module and passing them into
my drawing functions which are in my map.c module, but now it no longer
draws the he tile s properly.  Running it in gdb, it looks like everything
is doing whatit should.  I'll do everyone the favour of not posting all 12
files of my source to the list :), but I can think of the following
questions that might get me back on track if I can understand them:

1)What are some opinions as to where one should declare their backing
pixmap, their configure and expose events, etc.  Should the pixmap be
global or should it get passed around as a parameter?

2)The Harlow book uses a GdkRectangle called update_rectangle in the
functions he uses for drawing.  He assigns it position , widht and height,
but never does anything with it other than pass it into the
gtk_widget_draw function.  Just guessing, the GdkREctangle is the area of
the widget that needs to be redrawn?  Is this in the docs somewhere?  Did
I just overlook it?

3)Does anyone have some sample code that uses GDK that isn't a huge
application like GIMP?

Lastly, if anyone wants to have a look at what I've done so far, you can
download it from :

www.bagpipe.com/comp/rpg/builder.tgz - this is an older version that's
less featureful but more workful

www.bagpipe.com/comp/rpg/badbuilder.tgz - the current version.  It's got
more stuff, but it doesn't work.

Thanks for putting up with my stupid questions!

  +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  =   Rob Huffstedtler          |     We now return to our regularly     +
  +   (931) 596-3560            |        scheduled programming           =
  =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+



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