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

curses trouble no. 21390: resizeterm / init_color

 
   Game Forums (Home) -> Roguelike -> Development RSS
Next:  Stuff about Quicken (Intuit) from both sides  
Author Message
copx

External


Since: Mar 26, 2005
Posts: 138



(Msg. 1) Posted: Mon Feb 27, 2006 5:55 pm
Post subject: curses trouble no. 21390: resizeterm / init_color
Archived from groups: rec>games>roguelike>development (more info?)

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 the window yourself before running the program.
init_color() never worked - either nothing changes or the colors are set to
black. I have tried to run the only curses-based roguelike I know that
attempts to use a non-standard resolution - Xenocide: same result. The
screen does not resize and the display is totally messed up because of this.
I am using Ubuntu 5.10 if that matters.
Has anyone managed to make the resizeterm / init_color stuff work?
If so please tell me how!

 >> Stay informed about: curses trouble no. 21390: resizeterm / init_color 
Back to top
Login to vote
Jim Strathmeyer

External


Since: Nov 27, 2005
Posts: 38



(Msg. 2) Posted: Mon Feb 27, 2006 5:55 pm
Post subject: Re: curses trouble no. 21390: resizeterm / init_color [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

copx <invalid.RemoveThis@invalid.com> schrieb:
> The (N)curses functions resizeterm / init_color do not seem to work. I have

What do you want to use resizeterm for? Seems iffy.

I remember when I first tried color in ncurses my experience was that it
just didn't seem to work, but I forget what the problem was. Everything
about ncurses seems to be counter-intuitive.

If you don't include your code (or somehow describe exactly what you're
doing), nobody wil be able to help you.

bool Term::Init() {
initscr();
if( has_colors() == FALSE ) {
endwin();
return false;
}

cbreak(); /* disables input line buffering */
// keypad(stdscr,TRUE); // will need this to
// get function and arrow keys
noecho(); /* user input not echoed to screen */
nonl(); /* no newline; "faster" ~ 'man nonl' */
// curs_set(2); /* set cursor to 'very visible' */

/* colors! */
start_color();
init_pair(1,COLOR_WHITE,COLOR_BLACK);
....
}

And to draw a character:

wattron(level_window,COLOR_PAIR(tile.color);
mvwaddch(level_window,j,i,tile.view);
watteroff(level_window,COLOR_PAIR(tile.color);

Here level_window is a WINDOW *, tile.view is a char, and tile.color is
an int.


--
Jim Strathmeyer

 >> Stay informed about: curses trouble no. 21390: resizeterm / init_color 
Back to top
Login to vote
Jan Nordholz

External


Since: Feb 28, 2006
Posts: 1



(Msg. 3) Posted: Mon Feb 27, 2006 8:55 pm
Post subject: Re: curses trouble no. 21390: resizeterm / init_color [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

copx <invalid.RemoveThis@invalid.com> wrote:
>
> "Jim Strathmeyer" <strathWHATEVERIGETENOUGHSPAMANYWAYS.RemoveThis@ipass.net> schrieb im
> Newsbeitrag news:stOdnWENvbp64Z7ZnZ2dnUVZ_t2dnZ2d@adelphia.com...
>> copx <invalid.RemoveThis@invalid.com> schrieb:
>>> The (N)curses functions resizeterm / init_color do not seem to work. I
>>> have
>>
>> What do you want to use resizeterm for? Seems iffy.
>
> I need a specific resolution for my game 33x89 to be exact. If the
> resolution of the terminal is smaller than that everything will look messed
> up.

If I understand the ncurses library correctly (it's been awhile since I last used it),
resizeterm() and wresize() do nothing more than adapting the memory allocation size
for the window to the new dimensions; they can't change the actual size.

From ncurses' source:

] /*
] * This function reallocates NCURSES window structures. It is invoked in
] * response to a SIGWINCH interrupt. Other user-defined windows may also need
] * to be reallocated.
] *
] * Because this performs memory allocation, it should not (in general) be
] * invoked directly from the signal handler.
] */
] NCURSES_EXPORT(int)
] resizeterm(int ToLines, int ToCols)
] {

That means, if the xterm/vterm/terminal emulator is resized, a WINCH signal
is generated, and resizeterm() is called - but you can't do that the other
way round (unless you interface with the appropriate system directly, i.e.
X11 in the case of graphical emulators, or the tty ioctl() code for dealing
with the Linux console ttys).


HTH,

Jan (another rgrd perma-lurker)
 >> Stay informed about: curses trouble no. 21390: resizeterm / init_color 
Back to top
Login to vote
copx

External


Since: Mar 26, 2005
Posts: 138



(Msg. 4) Posted: Mon Feb 27, 2006 9:55 pm
Post subject: Re: curses trouble no. 21390: resizeterm / init_color [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Jan Nordholz" <jckn RemoveThis @gmx.net> schrieb im Newsbeitrag
news:v5gcd3-87b.ln1@hejre.minidns.net...
> copx <invalid RemoveThis @invalid.com> wrote:
>>
>> "Jim Strathmeyer" <strathWHATEVERIGETENOUGHSPAMANYWAYS RemoveThis @ipass.net> schrieb
>> im
>> Newsbeitrag news:stOdnWENvbp64Z7ZnZ2dnUVZ_t2dnZ2d@adelphia.com...
>>> copx <invalid RemoveThis @invalid.com> schrieb:
>>>> The (N)curses functions resizeterm / init_color do not seem to work. I
>>>> have
>>>
>>> What do you want to use resizeterm for? Seems iffy.
>>
>> I need a specific resolution for my game 33x89 to be exact. If the
>> resolution of the terminal is smaller than that everything will look
>> messed
>> up.
>
> If I understand the ncurses library correctly (it's been awhile since I
> last used it),
> resizeterm() and wresize() do nothing more than adapting the memory
> allocation size
> for the window to the new dimensions; they can't change the actual size.
>
> From ncurses' source:
>
> ] /*
> ] * This function reallocates NCURSES window structures. It is invoked
> in
> ] * response to a SIGWINCH interrupt. Other user-defined windows may
> also need
> ] * to be reallocated.
> ] *
> ] * Because this performs memory allocation, it should not (in general)
> be
> ] * invoked directly from the signal handler.
> ] */
> ] NCURSES_EXPORT(int)
> ] resizeterm(int ToLines, int ToCols)
> ] {
>
> That means, if the xterm/vterm/terminal emulator is resized, a WINCH
> signal
> is generated, and resizeterm() is called - but you can't do that the other
> way round (unless you interface with the appropriate system directly, i.e.
> X11 in the case of graphical emulators, or the tty ioctl() code for
> dealing
> with the Linux console ttys).
>
>
> HTH,

It does. So "resizing the window" only means resizing an internal data
structure of curses - gotta love UNIX man pages! I was thinking of the
window I see on my screen of course.
 >> Stay informed about: curses trouble no. 21390: resizeterm / init_color 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
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..

7DRL : Commander - It is 13.40 in my time zone (GMT +100). Time to start my 7DRL project: Commander. I will do it in Free Pascal. Plans are quite big so there is real danger of failure. Good luck to all participants of 7DRL contest. -- Michal ''Ancient'' Bielinski

7DRL : Valley of Ge-Hinnom - Info : @ goes chase to Moloch, java, using my library, so if I fail at least I can post an updated library. T.

7DRL - Deserted... - Okay, Here's to learning new things :) I am beginning work on my 7DRL, Deserted. Everybody loves waking up on a desert island, right? C++, dev-cpp, minGW... no curses.. I'm just beginning to dip into that. So, everyone get ready for a monochromatic..
   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 ]