Re: [gtk-list] Re: Large pixmap strategy needed



Owen Taylor wrote:
> 
> 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.
> 

I suggested the tiles because I thought he would see re-use.
Warcraft and similar games draw maps with tiles and get pretty
good results. You don't have to create as much content. Just make
sure all the tiles line up when placed next to each other. This
way people who can't draw (like me ;) can still create maps.

> 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.
> 

For a static pixmap I agree. He mentioned doing fills.  I assumed
he ment that he would be filling irregular shapes, possibly 
reading pixels from the pixmap to find the edge. I don't
know how to do an efficient fill of a pixmap, is it possible?

I didn't understand what he would be doing with the fill. My
recomendation
for a game like Warcraft would be to generate the map or playing
area out of tiled pixmaps and make all of the objects on the playing
are also out of pixmaps. All of the pixmaps should be static. This way
the game should play well over a network once you have created all of 
the pixmaps.

The thing that made me suggest images was when he said he was going to
be doing fills.

Todd.

> 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.
> ]
> 
> 
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

-- 
-----------------------------------------
Todd & Lisa Dukes
tjdukes@flash.net



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