Welcome to GameHourz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

init_color() in PDCurses

 
   Game Forums (Home) -> Roguelike -> Development RSS
Next:  CS is bullshit  
Author Message
William McBrine

External


Since: Apr 02, 2006
Posts: 12



(Msg. 1) Posted: Sun Oct 08, 2006 9:55 pm
Post subject: init_color() in PDCurses
Archived from groups: rec>games>roguelike>development (more info?)

OK, along with the X11 and DOS ports, the Win32 port of PDCurses now has a
working init_color() and color_content(). You can try it out now via
anonymous CVS; otherwise you'll have to wait for the next release.

Limitations in the Win32 port: 1) Works only on NT family. 2) Works only
in windowed mode, and if called in full-screen mode, switches to windowed
(I could get around this with XP-only APIs); however, colors set in
windowed mode hold in full-screen. 3) Resets the font to the Default
settings, overriding any per-window (Properties) settings. 4) Cannot read
current palette -- only the registry settings. Calling init_color() will
reset to registry values + any mods made by PDCurses since initscr(). Some
of these might be fixable.

Limitations in general: as per my previous post. You can set colors 0-15;
0-7 are plain COLOR_WHITE through COLOR_BLACK, while 8-15 are the A_BOLD
versions of them. Remember, init_color() takes 0-1000 for each of its
color parameters, rather than 0-255 as you might expect.

examples:

init_color(15, 1000, 1000, 1000); /* white, full brightness */
init_color(COLOR_YELLOW, 667, 333, 0); /* classic "brown" */

Also, the palette is not reset on program exit, so you may want to
preserve it yourself (record the values at startup via color_content(),
and restore them via init_color() when you're done). Doesn't matter for
X11 of course.

And, I haven't forgotten OS/2, but for the moment it's not supported.

 >> Stay informed about: init_color() in PDCurses 
Back to top
Login to vote
Paul

External


Since: Sep 17, 2006
Posts: 26



(Msg. 2) Posted: Mon Oct 09, 2006 6:12 pm
Post subject: Re: init_color() in PDCurses [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Any chance you could add some kind of SIGWINCH / KEY_RESIZE "support"
for Windows?

Even if it did nothing, it would be nice if the symbols were defined,
to make it easier to compile programs that use them.

 >> Stay informed about: init_color() in PDCurses 
Back to top
Login to vote
William McBrine

External


Since: Apr 02, 2006
Posts: 12



(Msg. 3) Posted: Tue Oct 10, 2006 4:18 am
Post subject: KEY_RESIZE in PDCurses [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Mon, 09 Oct 2006 18:12:02 -0700, Paul wrote:

> Any chance you could add some kind of SIGWINCH / KEY_RESIZE "support"
> for Windows?

I was thinking about that the other day. It might be possible.

> Even if it did nothing, it would be nice if the symbols were defined,
> to make it easier to compile programs that use them.

KEY_RESIZE is already defined, for all platforms. SIGWINCH is normally
defined in <signal.h>, and is outside the scope of curses. If you don't
care whether it works, you may as well #define it yourself. Programs
that reference SIGWINCH should be checking whether it's defined, anyway.

On platforms where PDCurses has working KEY_RESIZE support (namely X11,
for now), you don't need and shouldn't try to hook SIGWINCH yourself. For
that matter, even in ncurses, you don't need to hook SIGWINCH since about
5.0, unless SIGWINCH support was explicitly disabled when building it.

Just check for KEY_RESIZE on input, and if found, call "resize_term(0,0)";
then repaint your windows. It's the same in ncurses, except you don't call
resize_term() there. See rain.c, worm.c and testcurs.c in PDCurses' demos
directory for some simple examples. (And for a complex example, you could
try MultiMail.)
 >> Stay informed about: init_color() in PDCurses 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
curses trouble no. 21390: resizeterm / init_color - The (N)curses functions resizeterm / init_color do not seem to work. I have tried multiple vterms (xterm, gnome-terminal, rxvt) and the Linux console : all of them ignored the resizeterm command. When running in a vterm the output works IF you resize....

Problems with PDcurses - I'd like to preface this by saying that I am VERY new to the roguelike development scene, so I'm trying to learn most of this as I go. I just picked up a copy of PDcurses, and I've been experimenting with it. addch() , addstr() and getch() seem to be..

PDcurses incompatibility with fstream.h? - Okay, this is probably more reflective of my lack of understanding of C++ than anything else, but here goes. I'm writing a roguelike, I've gotten it to the point where the player can move around, look, and open/close doors, and I was gearing towards..

7DRL: Invader - Well, I've talked myself into attempting a game for the 7DRL challenge. :-) Invader will be a sci-fi RL where the player is the planet's only hope of stopping a dread alien invasion ship. The character's base of operations will be their docked ship. ....

7DRL: TBA! :P - I'm going to throw my hat into the 7drl arena by taking on a project I've wanted to do for ages. I think it will get me past the mental block of actually getting started. My concept is based around the remains of a post apocalyptic world with gang..
   Game Forums (Home) -> Roguelike -> Development All times are: Ekaterinburg, Islamabad, Karachi, Tashkent (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]