Add support for building a console version

This is essentially @daniel-j's console support, implemented in a way that lets us build console and gui versions as well.

It's a damn big change. I had to change a few names (because things like the main class being named `Widget` were driving me nuts), hopefully the changes make sense. Want me to change or modify anything, just let me know, but I do know this compiles and works fine!