赞 | 13 |
VIP | 320 |
好人卡 | 64 |
积分 | 3 |
经验 | 112963 |
最后登录 | 2022-8-25 |
在线时间 | 2355 小时 |
Lv2.观梦者 (暗夜天使)
- 梦石
- 0
- 星屑
- 266
- 在线时间
- 2355 小时
- 注册时间
- 2009-3-13
- 帖子
- 2309
|
本帖最后由 Sion 于 2014-1-15 23:12 编辑
这个试试
# 按 F5 可以放大缩小窗口,存档记录玩家的偏好 class << Input alias_method :update_sion_zrscreen, :update def update Graphics.switch_room if trigger?(:F5) update_sion_zrscreen end end class << Graphics FindWindowEx = Win32API.new('user32', 'FindWindowEx', 'llpp', 'i') GetSysMtr = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i') KeybdEvent = Win32API.new('user32', 'keybd_event', 'iill', 'v') SetWindowPos = Win32API.new('user32', 'SetWindowPos', 'liiiiip', 'i') HWnd = FindWindowEx.call(0, 0, 'RGSS Player', 0) # def switch_room zoom($game_system.zoom_rate == 2 ? 1 : 2) end def zoom(rate) $game_system.zoom_rate = rate __zoom__(width * rate, height * rate) end def reset SetWindowPos.call(HWnd, 0, 0, 0, GetSysMtr.call(0), GetSysMtr.call(1), 0) end # def full_screen __toggle__ if GetSysMtr.call(0) > 640 end def windowed __toggle__ if GetSysMtr.call(0) < 640 end private def __zoom__(w, h) w += (GetSysMtr.call(5) + GetSysMtr.call(45)) * 2 h += (GetSysMtr.call(5) + GetSysMtr.call(45)) * 2 + GetSysMtr.call(4) x = [0, GetSysMtr.call(0) - w].max / 2 y = [0, GetSysMtr.call(1) - h].max / 2 SetWindowPos.call(HWnd, 0, x, y, w, h, 0) end def __toggle__ KeybdEvent.call(0xA4, 0, 0, 0) KeybdEvent.call(0x0D, 0, 0, 0) KeybdEvent.call(0x0D, 0, 2, 0) KeybdEvent.call(0xA4, 0, 2, 0) end end class Game_System attr_accessor :zoom_rate alias_method :on_after_load_sion_zrscreen, :on_after_load def on_after_load Graphics.zoom(@zoom_rate || 1) on_after_load_sion_zrscreen end end
# 按 F5 可以放大缩小窗口,存档记录玩家的偏好
class << Input
alias_method :update_sion_zrscreen, :update
def update
Graphics.switch_room if trigger?(:F5)
update_sion_zrscreen
end
end
class << Graphics
FindWindowEx = Win32API.new('user32', 'FindWindowEx', 'llpp', 'i')
GetSysMtr = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
KeybdEvent = Win32API.new('user32', 'keybd_event', 'iill', 'v')
SetWindowPos = Win32API.new('user32', 'SetWindowPos', 'liiiiip', 'i')
HWnd = FindWindowEx.call(0, 0, 'RGSS Player', 0)
#
def switch_room
zoom($game_system.zoom_rate == 2 ? 1 : 2)
end
def zoom(rate)
$game_system.zoom_rate = rate
__zoom__(width * rate, height * rate)
end
def reset
SetWindowPos.call(HWnd, 0, 0, 0, GetSysMtr.call(0), GetSysMtr.call(1), 0)
end
#
def full_screen
__toggle__ if GetSysMtr.call(0) > 640
end
def windowed
__toggle__ if GetSysMtr.call(0) < 640
end
private
def __zoom__(w, h)
w += (GetSysMtr.call(5) + GetSysMtr.call(45)) * 2
h += (GetSysMtr.call(5) + GetSysMtr.call(45)) * 2 + GetSysMtr.call(4)
x = [0, GetSysMtr.call(0) - w].max / 2
y = [0, GetSysMtr.call(1) - h].max / 2
SetWindowPos.call(HWnd, 0, x, y, w, h, 0)
end
def __toggle__
KeybdEvent.call(0xA4, 0, 0, 0)
KeybdEvent.call(0x0D, 0, 0, 0)
KeybdEvent.call(0x0D, 0, 2, 0)
KeybdEvent.call(0xA4, 0, 2, 0)
end
end
class Game_System
attr_accessor :zoom_rate
alias_method :on_after_load_sion_zrscreen, :on_after_load
def on_after_load
Graphics.zoom(@zoom_rate || 1)
on_after_load_sion_zrscreen
end
end
|
|