54 lines
1.5 KiB
Ruby
54 lines
1.5 KiB
Ruby
module LNX25
|
|
#--------------------------------------------------------------------------
|
|
# ● 切替キー
|
|
#--------------------------------------------------------------------------
|
|
RESIZE_KEY = :F5 # 規定値: :F5
|
|
ZOOM_LEVELS = [1.0, 1.5, 2.0, 2.7] # 追加可能な倍率
|
|
end
|
|
|
|
module Graphics
|
|
@zoom_index = 0
|
|
@screen_zoom = 1.0
|
|
|
|
def self.screen_zoom
|
|
@screen_zoom
|
|
end
|
|
|
|
def self.screen_zoom=(rate)
|
|
self.rgssplayer_resize(rate)
|
|
@screen_zoom = rate
|
|
end
|
|
|
|
def self.next_zoom_level
|
|
@zoom_index = (@zoom_index + 1) % LNX25::ZOOM_LEVELS.size
|
|
self.screen_zoom = LNX25::ZOOM_LEVELS[@zoom_index]
|
|
end
|
|
|
|
def self.rgssplayer
|
|
Win32API.new("user32", "FindWindow", "pp", "i").call("RGSS Player", 0)
|
|
end
|
|
|
|
def self.rgssplayer_resize(rate)
|
|
move_w = Win32API.new("user32", "MoveWindow", "liiiil", "l")
|
|
get_sm = Win32API.new("user32", "GetSystemMetrics", "i", "i")
|
|
frame_w = get_sm.call(7) * 2
|
|
frame_h = get_sm.call(8) * 2
|
|
caption_h = get_sm.call(4)
|
|
width = self.width * rate + frame_w
|
|
height = self.height * rate + frame_h + caption_h
|
|
x = (get_sm.call(0) - width ) / 2
|
|
y = (get_sm.call(1) - height) / 2
|
|
move_w.call(self.rgssplayer, x, y, width, height, 1)
|
|
end
|
|
end
|
|
|
|
class << Graphics
|
|
alias :lnx25_update :update
|
|
def update
|
|
lnx25_update
|
|
if Input.trigger?(LNX25::RESIZE_KEY)
|
|
self.next_zoom_level
|
|
p "Zoom changed to #{Graphics.screen_zoom}" # Debugging output
|
|
end
|
|
end
|
|
end
|