I always enjoyed watching demoscene demos in the early 90’s, and always wanted to do some similar “magic” on the screen as a kid. I also like ASCII art, and I needed a clock in my kitchen at that time…
So the question was obvious: “why not build one”?
It’s written in C++, not the best code what I ever wrote, but it was a funny and interesting way to learn the language basics. All of the displayed effects are made of simple ASCII characters and are generated realtime with the help of some math and random numbers.
Currently it has:
- Digital clock display (analog is in progress)
- 3 character sets (fonts?) for digital clock
- 9+ background effects (snow, starfield, 3D starfield, fire, matrix, plasma, labyrinth, a game of life, and one with a few rotating 3D objects)
- 1 foreground effect (a rotating 3D cube)
The digits’ style are easily changabe by editing inc/clock_digits.h file
It is capable of displaying current Bitcoin price with a lame method, just uncomment the command in main.cpp around line 170-180.
All you need is a linux terminal, and a C++ compiler to run it. It was tested on Ubuntu 18.04, 20.04, Raspbian, and WSL on Win10.
You can find the source on Github
All of the screen drawing was made with the help of a self written ASCII display library, which is capable of handling multiple layers, and transparency. (-> screen.h on Github)
The main advantage of an own display routine is that it doesn’t depend on any external libraries, like ncurses. In contrast it simply echoes chars with ANSI escape sequences to the terminal, so it’s not the fastest in the world, but with today’s hardware it gives a decent performance.
If you would like to use it in any of your projects, please use the linked standalone Github project above, because it’s a more well thought OO version than one included in this project.
Currently it runs on an old 17" disassembled laptop in my kitchen.
It can run smoothly on a Raspberry Pi (tested on 3B+) with a small TFT display. I have a very slow screen that has some difficulties displaying graphical videos ( ~1 FPS :))), but in full text mode it works very well.
Some gifs with the effects: