Re: [gtk-list] Large pixmap strategy needed



Dave Swegen wrote:
> 
> The game I'm writing has a map that is 1500x500 in size, and I was hoping
> someone might be able to suggest how to tackle a few issues that I have
> regarding it:
> 
> 1) What format to save the map as: xpms are easy to load and display, but
> it would turn out quite large (just under 700k), so #including it is out
> of the question (unless I store it RLE encoded somehow).
> 

Look into using Gdk_Imlib. It should make it almost as easy to load a 
variety of formats. You could use ImageMagick to convert your images
between the formats Gdk_Imlib supports to find the format that
works best for you.


> 2) Do I convert the whole map to a pixmap at once, or, as one approach I
> had which was to split it up into vertical strips and only display the
> strips I need, which would also solve another problem:
> 

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.

Only displaying some may help for X servers that have limited memory,
but it will probably be harder to write the code. It will also make if
easy to allow
the map to be a loop in both the horizontal and vertical directions.

> 3) The map needs to wrap around horizontally. How (apart from the method
> mentioned above) could this be handled?
> 
> 4) How are pixmaps stored? I will need to flood-fill regions, and
> depending on what approach I take I might have to work on the pixmap
> directly (or is this inadvisable?)
> 

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. 

The  O'Reilly XLib programming manual goes into manipulating XImages.


> Any thoughts on the matter would be much appreciated.
> 
> Cheers
>         Dave
> 
> --
> Dave Swegen <dave@recursive.prestel.co.uk>
> .plan: To find a job working with Linux
> 

Todd

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



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