| 赞 | 274 |
| VIP | |
| 好人卡 | |
| 积分 | 496 |
| 经验 | |
| 最后登录 | 2024-6-21 |
| 在线时间 | 1919 小时 |
- 梦石
- 10
- 星屑
- 39550
- 在线时间
- 1919 小时
- 注册时间
- 2010-11-14
- 回帖
- 3214

|
发表于 2021-3-24 01:04:00
|
显示全部楼层
老实说,学会这个并不会让你的游戏怎么样……
还是多花点心思做好游戏本体吧。
[pre lang="ruby"]
# 使用方法:
# set_window(x, y)
# 设置窗口位置到(x, y),从屏幕左上角开始计算
if !defined?(user32)
def user32(function, arg_types, return_value_type)
Win32API.new("user32.dll", function, arg_types, return_value_type)
end
end
GetForegroundWindow = user32("GetForegroundWindow", "", "L")
SetWindowPos = user32("SetWindowPos", ["L"] * 7, 'i')
$hwnd = GetForegroundWindow.call
def set_window(x, y)
SetWindowPos.call($hwnd, 0, x, y, Graphics.width, Graphics.height, 0)
end
[/pre]
|
评分
-
查看全部评分
|