Re: Large pixmap strategy needed




Dave Swegen <dave@recursive.prestel.co.uk> writes:

> On Sat, Dec 05, 1998 at 16:06 +0000, Todd Dukes wrote:
> > You might try a tiled approach. You could have a library of tiles. Each
> > tile would be a small portion of the map. A map would be a list or array
> > of the tiles to use.
> > 
> > If you need to edit, you probably want to use an XImage instead of a
> > pixmap.
> > You can use shared memory if you need to display the images quickly
> > after
> > changing them. 
> 
> Is GdkImage a wrapper for XImage? That is what it looks like to me...

I'd advise against using GdkImages in this circumstance.
They are fairly complicated to use, and not really necessary
unless you are writing a game where you really need to
blast pixels to the screen at maximum speed.

A 1500x500 map isn't really that big from the current perspective-
(only 2 meg at 24bpp), so I think your best bet is to
load it as a single image on the server.

A good way to go about this is to save it as a PNG file and
then use gdk_imlib to load it and store it into a pixmap.

Once you have your map as a pixmap on the server, you can
write any portion to your GtkDrawingArea, using gdk_draw_pixmap().
You can also use gdk_draw_pixmap() to copy regions of
the window to itself implement scrolling.

Regards,
                                        Owen

[ 
  There are other options available. The GnomeCanvas widget
  should make doing "objects on a map" games really trivial.
  Unfortunately, getting the wrapping behavior you desire
  with GnomeCanvas would require some trickery, and might
  hurt the performance of the end result.
]
  



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