Skip to content

Instantly share code, notes, and snippets.

@RPGP1
Created March 14, 2014 10:03
Show Gist options
  • Save RPGP1/9545114 to your computer and use it in GitHub Desktop.
Save RPGP1/9545114 to your computer and use it in GitHub Desktop.
Input.push_keysが欲しくなったから作った。#DXRuby キーコードが全て/^K_/だからできた。
# coding: UTF-8
require "dxruby"
module DXRuby
KeyNames = self.constants.keep_if{|c| c[0..1] == "K_"}.freeze
KeyCodes = KeyNames.dup.map{|k| self.const_get(k)}.freeze
Keys = Hash.new.tap{|h| KeyNames.each_with_index{|n, i| h[n] = KeyCodes[i]}}.freeze
end
module Input
def self.push_keys
KeyCodes.dup.keep_if{|k| self.keyPush?(k)}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment