keyboard

by Konlet
My keyboard lib. Capable of forwarding keys. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Konlet.keyboard##version=5

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://Konlet.keyboard##version=5

67 downloads
Version 5
Date added: Oct 31 2015
Last updated: Aug 22 2016
1 fan
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.

Recent BYOND Members

Please support BYOND through Membership or a donation!

Comments

Konlet: (Nov 2 2015, 10:19 am)
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.
Kaiochao: (Nov 2 2015, 9:20 am)
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.
Konlet: (Nov 2 2015, 5:39 am)
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.
FKI: (Nov 1 2015, 4:49 pm)
You probably want to spawn() that world loop so world/New() can finish.
Zecronious: (Nov 1 2015, 3:12 pm)
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.