PDA

View Full Version : Weird printw.



Fredd
10-10-2002, 01:05 PM
After reading a tutorial about ncurses i was trying to make a pong like game, after a big struggle with finding something remotley alike kbhit() i found a "home made" version after implementing it i found something wierd.



for( ;; )
{
loop_count++;

if (kbhit())
{
key = getch();

switch(key)
{
case up:
do stuff
...
}
}
printw("%d", loop_count);
}

this code show the variable loop_count After you press any keys but if you replace it with printf("%d", loop_count);
it work like a charm... why is this and is there a way around it? since printf doesnt seem to work very well with ncurses i would very much like to replace it.

Fredd
10-11-2002, 07:46 AM
Oops missed a refresh() :rolleyes:
no replies though .. kinda sad :)

Hammer
10-11-2002, 05:16 PM
>>no replies though .. kinda sad :)
Give us a chance pal (ie more than a few hours) :rolleyes: :D

Fredd
10-12-2002, 06:28 AM
Give us a chance pal (ie more than a few hours)
I gave you a day :p :D

shaik786
10-12-2002, 07:38 AM
Is your prntf() the last statement in your code? if yes, insert a redundant getch() just before endwin().

Fredd
10-15-2002, 10:24 AM
Is your prntf() the last statement in your code? if yes, insert a redundant getch() just before endwin().

Thanks... but the refresh() kinda made it work :)