KnightOS/z80e — pull request #26 by klange (2014-09-06 03:01:50+00:00)
Title: Initial SDL frontend

Don't expect to merge this quite yet, there's some important functionality missing and I haven't cleaned it up - just wanted to get the ball rolling. This is essentially a fork of the text UI, with the addition of automatic startup for the device and, obviously, the SDL screen and keyboard handler.

![screenshot - 09052014 - 07 58 32 pm](https://cloud.githubusercontent.com/assets/223546/4173997/b6931334-3571-11e4-9a45-d72fed8e51a3.png)

The display is automatically scaled to the best integer multiplier available and centered within the window, so you can fullscreen or tile or whatever.

Keyboard input is the same as in the web UI on http://knightos.org - Escape, Enter, arrow keys, 0-9, F1-F5.

Some notable TODOs:
- [ ] The SDL stuff is kinda jammed into the interactive, loop-forever mode, so the debugger doesn't work (nor does the "run n cycles" mode).
- [ ] Colors should probably be configurable, at least through command-line args. I've chosen the same background color as the web UI, which is a jarring emulation of the real deal.
- [ ] I tossed a bunch of state into the global namespace - that stuff should probably all move into the app context struct.

And some nice-to-haves:
- [ ] I've only bound the keys that are bound in the web interface - more keys would be nice.
- [ ] Skins with operable buttons would be cool. Lots of calculator emulators have those, and it wouldn't be too hard to spit out an image into the SDL window.