Sha256: 264d34be2c724e460f537f200ae1890ad828053dfb7aa9729e548a00b78d3027
Contents?: true
Size: 592 Bytes
Versions: 6
Compression:
Stored size: 592 Bytes
Contents
class AuthorEngine class Part module OpalInput BUTTONS = { "left" => "ArrowLeft", "right" => "ArrowRight", "up" => "ArrowUp", "down" => "ArrowDown", "x" => "x", "y" => "c", } # Store key states KEY_STATES = { } def button?(name) down = false if BUTTONS.dig(name) down = KEY_STATES.dig(BUTTONS.dig(name)) # dig returns false if key not found else raise "Button '#{name}' not found!" end return down end end end end
Version data entries
6 entries across 6 versions & 1 rubygems