Answer the question
In order to leave comments, you need to log in
How is real-time console graphics implemented?
Hello! My question may sound rather vague, but I'll try to explain anyway.
Here, let's say, I wrote the working part (algorithmic) for tic-tac-toe, that is, everything works, win-lose-draw is determined, and the like. And now I need to correctly arrange the graphical part of the game in the console. Of course, while writing the algorithm, I did something similar, but it looks strange - that is, every time the player makes a move, I reprinted the game grid just below the previous grid output.
How are graphics made in console games?
For example, it seems wrong to me to clear the console window and redraw the grid after each move. Or, for example, if I want to stick a clock into the game window, do I really have to update the screen every second in this way?
That is, how are changes (color, position, etc.) monitored and made in the console output in real time or based on user actions?
Thanks in advance.
PS The language I write in is Java, but I'm interested in a more general concept of how it all happens and what is usually used for this.
Answer the question
In order to leave comments, you need to log in
For example bash:
#!/bin/bash
echo -ne '##### (33%)\r'
sleep 1
echo -ne '############# (66%)\r'
sleep 1
echo -e '####################### (100%)\r'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question