-
I still don't get it how would I use that on the code I already have... I think I'll just leave this function out of the final game and just check in the end how much time elapsed from the start of the game. Time is running out and I only have 2 days to finish it and a few critical bugs are still left in the code...
Thanks for all your time though.
-
You could pretty much just replace
Code:
ch = mvgetch(l, c);
with something like
Code:
move(l, c);
if(kbhit()) {
ch = getch();
/* process ch -- the if(ch...) code */
}
/* update the screen, including the timer */
BTW, I wouldn't call a variable l (lowercase L). It looks too much like 1 (numerical one).
Also, the variable i seems to play the same role as the variable c, unless they start at different numbers.
As well, this
Code:
mvprintw(l, c, " ");
is the same as
Code:
mvaddch(l, c, ' ');
not that it matters too much. But it might be easier to read for this code, for instance:
Code:
mvprintw(l, c++, "%c", ch);
->
Code:
mvaddch(l, c++, ch);
See the man page: http://developer.apple.com/documenta...vaddch.3x.html
----
But work on the critical bugs first. :)
-
Thanks for all the suggestions but I won't do the timer anymore, I'm getting really confused and I only have a few hours left before the system blocks me from uploading my project. I have it all finished now, everything seems to be working and I'm just missing the final report, so, lots of writing to do and can't bother any more with the code... I did what I initially thought of doing, the game starts I check the time, the game ends I recheck the time and calculate the difference in seconds, that's it. Simple enough. No time for more.
Thank you all though.