Linux drawing in text mode(no gui, desktop)

2019-07-25 21:16发布

问题:

I'm kind of new to linux without a gui and i run into a problem. When using a linux distro with gui, it looks easy to draw on a window using a library(opengl, sdl). I wanted to create a chip8 emulator in c++, but how can i handle drawing on screen? Or any library that can draw in text based linux, or just usage of opengl in text based linux. Thanks! Btw! I'm using bash in windows and a vagrant machine running precise64.

回答1:

For text mode drawing you might want to investigate NCURSES:

http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/

With this you can print in colour to character cells on a console screen, so that might be just what you need for emulating a machine with a character-mapped display.

There is also a version of the old Windows "conio.h" library if you want to start with something very simple:

https://ubuntuforums.org/showthread.php?t=1353043&p=8485667#post8485667

There is an excellent simple tutorial for SDL graphics at:

http://lodev.org/cgtutor/quickcg.html