Currently I have some C code which will every time an arrow key is pressed it will reprint an array of characters to the screen and change only the player’s position one spot. I would like to know how to only reprint the two characters that are actually changing, instead of reprinting the entire array of characters.
and example sudo code for what my code currently does is:
for i < width
for j < height
printf("%c", board[i][j]);
instead I would like to access the command line at a certain location say [i][j] and when an arrow key say ‘up’ is pressed change only the [i][j] character and the [i][j-1] character in the console with out reprinting the entire array to the screen.
Any libraries or ideas?
ncursesis a nice portable library which handles terminal graphics; I’d definitely recommend it for your purposes.