You need to call refresh() (before usleep ).
Update: new code segments with codes (in a few comments) indicate a real problem that is the same in
ncurses-refresh : mixing
stdscr (implied by the following two calls) and
getch and
refresh with
newwin and
wrefresh .
Update 2: using the full code, as well as some hacks, I got it to work (for some value, "work", I obviously do not call printmap () correctly, and I compiled a dummy file "map").
Without looking carefully, I just changed all occurrences of getch() to wgetch(win.window) , all mvprintw turned to mvwprintw (to use the same window) and deleted at least one unnecessary getch / wgetch. Then the essence of the problem:
while (!checkcollisions(pos_f, input)) { - pos_f = moveobject(pos_f, input, ".."); -
The above printmap call printmap definitely wrong, but you still need to do something in the loop to change what was in win.window (or stdscr or some other window you put or something else); and then you need to force it to update and force output to stdout using fflush(stdout) before going to bed.
source share