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

Re: Xlib problems (Lol. I've only been programming in it for 10days...)



Keith Lucas wrote:

> >Currently I'm working on an RTS engine, writing the GUI code; in Xlib.
> >It's all working fine, etc. and now I'm stuck with a problem none of the
> >books I have seem to address. How do I draw a coloured image to the
> >screen?
>
> Use MITSHM: Basically an area of memory is mapped into your process and X11s.
> Only works if X11 and the process are on the same machine.

Never heard of it. Got a reference I can look up?


> Colour allocation is for 8bit displays: you want to find out what the current

....but how do you get your color then under a say, 24bit display? You'd still need
to use XAllocColor right?


> display is at. If it's 8 bit, I'd recommend establishing either a 6x6x6 RGB
> palette or an optimised 256 colour palette and producing a 4096 entry colour
> mapping table. That way, a truecolour->palette entry translation is quite fast.
>
>      colour = table[((red&15)<<8)((green&15)<<4)((blue&15))]
>
> And then remap all the GFX as they're loaded.

An interesting possibility. I'll look into it.

> The other, and probably better alternative, is to go look at some of the
> libraries that will remove some of this aggro - writing an RTS is a big job
> anyway..

*nods thoughtfully* I thought 'bout that before, but the problem is, any shared lib
I use is _another_ thing to download when compiling the game. It really annoys me
that before I build one of these games I have to goto and redownload an extra 40
Meg of junk each time, which'll be obsolete by the time I need it next time.  I'd
prefer to avoid it.

But anyway. Thanks for your help!
Cheers!
Shadow Mint.