Sha256: e28ee37803b73f514f7b650f0b375f2fbacdaf4af6c049cfa588f48171c9c30b
Contents?: true
Size: 592 Bytes
Versions: 1
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 keys state 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
author_engine-0.4.0 | lib/author_engine/game/opal/parts/input.rb |