Created
March 14, 2014 10:03
-
-
Save RPGP1/9545114 to your computer and use it in GitHub Desktop.
Input.push_keysが欲しくなったから作った。#DXRuby キーコードが全て/^K_/だからできた。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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