I'm trying to make a text animation for an application made in ncurses.
User presses a key, selects a direction and an object in a text grid should move from one cell of the grid to the next in the given direction, waiting 500ms before it moves. The code I used is
while (!checkcollisions(pos_f, input)) { // Checks if it can move to next grid
pos_f = moveobject(pos_f, input, ".."); // Moves object to next cell
usleep(50000);
}
But when I execute it, instead of moving, waiting and moving again, it waits a long time, and the object suddenly appears at the final cell of the grid, without showing the animation.
Is this because of how ncurses work? I already tried using other solutions like the select() stalling function.