Re: Graphical ideas for *bands
- From: Kenneth 'Bessarion' Boyd <zaimoni@xxxxxxxxxxx>
- Date: Sat, 28 Apr 2007 03:19:54 +0000 (UTC)
On 2007-04-28 01:57:51, Leon Marrick <none@xxxxxxxxxxx> wrote:
Kenneth 'Bessarion' Boyd wrote:
On 2007-04-25 22:45:02, Leon Marrick wrote:
1. Colored ASCII artwork using customized extended fonts
2. The existing 2D bitmapped graphics, presented more intelligently
3. Any of several diffent kinds of isometric views
Customized extended fonts (and UNICODE) are interesting...as long as you can
work with at most two colors/cell. Some facilities for "color arithmetic" are
also in order. [E.g...being able to use the background color of the floor
against the foreground color of the monster; cf. Crawl Stone Soup for similar
ideas.]
Hmm. I'm embarrassed to say that this reply is totally Greek to me.
:-/ Can you point to a picture or two so I can understand what you
mean? Or, failing that, post some test code so I can look at what it
does? Or, failing both, explain in more detail?
The XOpen curses specification (at this time, the only extant one that even
admits being UNICODE-aware) only allows two colors to be specified for a color
pair via the init_pair function: foreground and background. In turn, when
formatting a character, the color of the character is specified with a color
pair. E.g. (code examples pulled from from my internal library with typedef
stripped; Boost-licensed should that matter to anyone):
inline chtype
format_char(unsigned short x,chtype flags,unsigned char color)
{ return (chtype)x | flags | COLOR_PAIR(color); }
I like the following as a clean "bootstrap" of the color pairs when starting up
a curses application:
if (COLORS*COLORS<=COLOR_PAIRS)
{ // full enumeration possible, go for it
// white on black hard-coded as 0, this dictates ordering
unsigned int Idx = COLOR_PAIRS;
do {
--Idx;
init_pair(Idx,(COLORS-1)-(Idx%COLORS),Idx/COLORS);
}
while(1<Idx);
}
This permits directly extracting both the foreground and background color
indexes from a color pair (by modulo arithmetic) without going through the
curses library.
Now, assuming a UNICODE-aware implementation of curses, and the availability of
a reasonable font, it would be possible to render the not-equal sign
(hexadecimal coding 2260h, HTML numeric entity ≠ character entity ≠) in
any supported foreground/background color choice.
What is not possible, is to superimpose the virgule and equals sign (using
combining characters) to create a trichromatic not-equal sign. Only one color
pair is allowed per logical character.
Simple application, say for a Z-style casino:
* observe that the six-sided die faces have their own UNICODE characters (on the
Misc Symbols code page, 2680h-2685h). Once we have a suitable font loaded, we
can show the actual dice results "graphically" -- in a curses console.
.
- References:
- Graphical ideas for *bands
- From: Leon Marrick
- Re: Graphical ideas for *bands
- From: Kenneth 'Bessarion' Boyd
- Re: Graphical ideas for *bands
- From: Leon Marrick
- Graphical ideas for *bands
- Prev by Date: Re: [FA] 0.2.3 Display Questions, [S] and [Un] bugs
- Next by Date: Re: Graphical ideas for *bands
- Previous by thread: Re: Graphical ideas for *bands
- Next by thread: Re: Graphical ideas for *bands
- Index(es):
Relevant Pages
|