Project1
标题:
请问这几段代码所写的方法的具体作用是?
[打印本页]
作者:
Sion
时间:
2012-12-20 19:27
标题:
请问这几段代码所写的方法的具体作用是?
本帖最后由 Sion 于 2013-2-8 14:12 编辑
就是21行开始定义的方法
module Kboard
$R_Key_A = 0x41 # A key
$R_Key_B = 0x42 # B key
$R_Key_C = 0x43 # C key
$R_Key_D = 0x44 # D key
$R_Key_E = 0x45 # E key
$R_Key_F = 0x46 # F key
$R_Key_G = 0x47 # G key
$R_Key_H = 0x48 # H key
#楼主已经将中间无数按键的定义省略
GetKeyState = Win32API.new("user32","GetAsyncKeyState",['I'],'I')
GetKeyboardState = Win32API.new("user32","GetKeyState",['I'],'I')
GetSetKeyState = Win32API.new("user32","SetKeyboardState",['I'],'I')
#--------------------------------------------------------------------------
module_function
def keyb(rkey)
if GetKeyState.call(rkey) != 0
return 1
end
return 0
end
def keyboard(rkey)
GetKeyState.call(rkey) & 0x01 == 1
end
def key(rkey, key = 0)
GetKeyboardState.call(rkey) & 0x01 == key
end
end
复制代码
编辑一下,之前只贴了半截……
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1