Sha256: 2272dc35bf2eb82c027a9d4aa985f1eba14295ddc52261f44730d68473e1bd3b
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
require 'forwardable' require 'pathname' require 'bundler/setup' require 'active_support/core_ext/string/inflections' require 'active_support/hash_with_indifferent_access' require 'gosu' __LIB__ = Pathname.new(__FILE__).join('..', '..').expand_path $:.unshift(__LIB__.to_s) unless $:.include?(__LIB__.to_s) require 'gosu/keyboard/dsl' require 'gosu/keyboard/dsl/helpers' module Gosu module Keyboard class << self def keys @keys ||= Gosu.constants.collect(&:to_s).grep(/^Kb/).each_with_object({}) do |constant_name, memo| constant = Gosu.const_get(constant_name) key_name = constant_name.gsub(/^Kb/, '').underscore.gsub(/numpad(\d)/, 'numpad_\1') key_name = case key_name when '0' then :zero when '1' then :one when '2' then :two when '3' then :three when '4' then :four when '5' then :five when '6' then :six when '7' then :seven when '8' then :eight when '9' then :nine else key_name.to_sym end memo[key_name] = constant end end def handle_keys(window, &blk) DSL.new(window, &blk) end def register(mod) DSL.send(:include, mod) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gosu-keyboard-0.1.8 | lib/gosu/keyboard.rb |
gosu-keyboard-0.1.7 | lib/gosu/keyboard.rb |