So I was bored. Really really bored! I’ve been rather nostalgic about the ANSI scene and my old BBS software, ShockWavE:PRO. At first I thought it would be cool to read emails the ‘old fashion’ way, like we did on BBSs. I tried coding something up in PHP, but it just wasn’t going to happen as PHP has no way of gathering individual keystrokes without echoing it to the screen nor without having to press Enter. Someone suggested I use Go. I’ve been wanting to try my hand at Go for awhile now, I just didn’t have a project to use as a learning platform— Until now..
So, What I wanted was a route that mimicked Turbo Pascals ReadKey() function that would read keystrokes and pass back the decimal value of the key. You won’t believe how difficult this is. There’s no standard, easy way to do this. I had to drop to C and do it there. Anyhow, I finally got it working and put this new code to use with a light bar menu system. For those of you who remember Lotus 123 back in the DOS days, you’ll understand what I mean. I’ve published my hackery on Github for the world to see.
Attached is a screenshot of my resulting code. The code isn’t pretty, because I’m still learning. I’m pretty sure it can be refactored and done better.