Game in linux terminal: Changing images: printing over already printed text

后端 未结 1 1715
终归单人心
终归单人心 2021-01-25 10:01

Well, I\'m simply implementing pretty easy card game in linux terminal. What I want to achieve is an effect of changing images, basically trick printing over already printed tex

相关标签:
1条回答
  • 2021-01-25 10:59

    Ncurses creates its own character window in the terminal and allows you to acces and overwrite characters at specific positions. This looks perfect for your game, where you can draw character-art cards anywhere on the screen. Way better than emulating the same by scrolling () the terminal, anyway. – M Oehm

    Curses is the best option, as compatible libraries are available for all operating systems (including Windows command line); ncurses is the best one for Linux. For Linux and Unix terminals, you can also use ANSI escape codes, often called terminal codes. For example, printing "\033[2;3H" will move the cursor to the third column on the second row, counting from top. Anyway, I do recommend using Curses anyway. – Nominal Animal

    0 讨论(0)
提交回复
热议问题