Add keyboard press/release events for fine grained keyboard access
I'm not sure if this is possible or not, but having press/release events through the terminal would allow for cool unicode/text based games through iterm. I believe this can be done through using using raw keyboard input (which I'm not sure iterm supports), but I'm not sure how this works w/ OSX vs. Linux. Here's an article I found describing raw keyboard input in Linux: https://www.linuxjournal.com/article/1080
This is an example of Space Invaders (you can play it with docker run -it --rm pdevine/textinvaders
) but I've had to fudge the way the keyboard controls the 'laser' sprite. This is passable w/ something like Space Invaders, but it's really terrible for most action games.
▗▖▗▖▗▖▄ ▄▖ ▗▖▗▖▗▖▗▖▗▖▗▖
▙▖▌ ▌▌▙▘▙ ▌▌▌▌▌▌▌▌▌▌▌▌
▄▘▚▖▙▘▌▌▙▖ ▙▘▙▘▙▘▙▘▙▘▙▘
▟▙ ▟▙ ▟▙ ▟▙ ▟▙ ▟▙ ▟▙ ▟▙ ▟▙
▟▜▛▙ ▟▜▛▙ ▟▜▛▙ ▟▜▛▙ ▟▜▛▙ ▟▜▛▙ ▟▜▛▙ ▟▜▛▙ ▟▜▛▙
▀▛▜▀ ▀▛▜▀ ▀▛▜▀ ▀▛▜▀ ▀▛▜▀ ▀▛▜▀ ▀▛▜▀ ▀▛▜▀ ▀▛▜▀
▝▖▗▘ ▝▖▗▘ ▝▖▗▘ ▝▖▗▘ ▝▖▗▘ ▝▖▗▘ ▝▖▗▘ ▝▖▗▘ ▝▖▗▘
▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖
▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌
▜████▘ ▜████▘ ▜████▘ ▜████▘ ▜████▘ ▜████▘ ▜████▘ ▜████▘ ▜████▘
▗▘ ▚ ▗▘ ▚ ▗▘ ▚ ▗▘ ▚ ▗▘ ▚ ▗▘ ▚ ▗▘ ▚ ▗▘ ▚ ▗▘ ▚
▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖ ▖▚ ▗▘▖
▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌ ▙▛█▛▙▌
▜████▘ ▜████▘ ▜████▘ ▜████▘ ▜████▘ ▜████▘ ▜████▘ ▜████▘ ▜████▘
▗▘ ▚ ▗▘ ▚ ▗▘ ▚ ▗▘ ▚ ▗▘ ▚ ▗▘ ▚ ▗▘ ▚ ▗▘ ▚ ▗▘ ▚
▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖
█▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█
▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀
▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄
▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖ ▗▄██▄▖
█▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█ █▛▜▛▜█
▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀ ▀▜▛▜▛▀
▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄ ▄▀▝▘▀▄
▚
▘
▚
▘
▖
▐█
▟█████▖
██████▌