vrld/Quickie — pull request #1 by mkosler (2012-02-21 19:21:59+00:00)
Title: Added ability to change keyboard controls

It's a bit hackish, since LÖVE doesn't quite handle all Unicode characters. I added a new table to `core.keyboard` called `ctrl`, which itself has `down = {key = --[[key]], code = --[[unicode]]}, up = {key = --[[key]], code = --[[unicode]]}`. I made a function `keyboard.controls(up, down)` which allows users to change the controls by providing a key and a corresponding unicode. The way it works is both have to be true for the movement to be recorded. This is how I was able to maintain the ability to use [mod]+[key]. Example:

keyboard.controls({key = "tab", code = 0}, {key = "tab", code = 9})

Since SHIFT+TAB (or for that matter any held mod key + TAB) gives a unicode of 0 (according to LÖVE), this mimics the behavior of SHIFT+TAB without having to hard code it, since just pressing tab will result in a unicode of 9.

**Why make the change?**

I wanted to navigate through my buttons using the up and down arrows, but wasn't able to. Now I can! I figure other people might want this functionality, considering TAB is unlikely to be their main means of keyboard navigation.

**Shortcomings**

The user needs to know the unicode for their particular new keybinding, and also needs to understand that [mod]+[non-printing character] has a unicode of 0. This can be explained in any documentation, however. It also has a slightly clunky interface for the function.