| 赞 | 87 |
| VIP | |
| 好人卡 | |
| 积分 | 136 |
| 经验 | |
| 最后登录 | 2021-1-24 |
| 在线时间 | 2753 小时 |
- 梦石
- 0
- 星屑
- 13562
- 在线时间
- 2753 小时
- 注册时间
- 2014-10-4
- 回帖
- 705

|
发表于 2015-12-12 22:59:26
|
显示全部楼层
本帖最后由 SixRC 于 2015-12-12 23:04 编辑
[pre lang="ruby"]class << Graphics
KE=Win32API.new("user32",'keybd_event','iiii','v')
GK=Win32API.new("user32","GetAsyncKeyState",'i','i')
alias update_y update
def update()
KE.call(13,0,2,0)
KE.call(13,0,0,0) if GK.call(0x61) != 0
update_y
end
end
module Input
DOWN=15
UP=18
LEFT=14
RIGHT=16
end
class << Input
Get=Win32API.new("user32","GetAsyncKeyState",'i','i')
def dir4
w,s,a,d=Get.call(0x57),Get.call(0x53),Get.call(0x41),Get.call(0x44)
return 0 if ((w != 0 && s !=0) || (a !=0 && d !=0))
return 8 if w !=0
return 2 if s !=0
return 4 if a !=0
return 6 if d !=0
0
end
alias trigger_y trigger?
def trigger?(key)
return trigger_y(2) if key == 12
trigger_y(key)
end
end[/pre]
抱歉
这个问题现在正式被解决 |
评分
-
查看全部评分
|