keyboard

by Konlet
My keyboard lib. Capable of forwarding keys.
ID:1975600
 
Uh, there's a demo in this. If you have any questions or feature requests, leave a comment.

Thanks to Kaiochao for minor improvements.

Updated 8/23/2016.
-Added Gamepad Support.
Solid library, very useful.

On a side note I usually like to use sleep(world.tick_lag) for the loops but that's just a personal preference.
You probably want to spawn() that world loop so world/New() can finish.
In response to FKI
FKI wrote:
You probably want to spawn() that world loop so world/New() can finish.

Or just put ..() or build the world before the for loop.
It's a mistake that won't ruin projects by including the library since it's demo code.
However, because it's demo code that's meant to show people how to do something, it would be best to just fix the mistake. If someone were to copy your way of starting a game loop like this:
// code to be included
world/New()
..() // <-- in this context (with no prior code), this does absolutely nothing
for()
sleep tick_lag // etc.

// code that includes or comes after the above code
world/New()
..() // <-- this calls the above infinite loop
<unreachable code comes after>

You don't want people using your code to have to worry about a situation like that. You don't have to force people to tiptoe around your library's shortcomings in any way. Just do this:
world/New()
..()
spawn for()
sleep tick_lag // etc.

Or this:
world
New()
..()
GameLoop()

proc/GameLoop()
set waitfor = FALSE
for()
sleep tick_lag // etc.

Or this:
world
New()
..()
spawn GameLoop()

proc/GameLoop()
for()
sleep tick_lag // etc.
In response to Kaiochao
Alright, my stubbornness knows bounds. I updated it to be compatible, and now when using it as a library the demo file isn't included.