=begin ■ゲームウインドウ表示倍率変更 RGSS2 DAIpage■ v1.1 ●機能と使い方● スクリプトで、 Graphics.zoom(n) とするとゲームウインドウがn倍に拡大縮小します。小数指定も可能。 ●更新履歴● 10/08/31:ウインドウの枠を考慮していなかったミスを修正。 10/06/18:公開 =end #============================================================================== # ■ Graphics #============================================================================== module Graphics module_function #-------------------------------------------------------------------------- # ● ゲームウインドウの倍率 #-------------------------------------------------------------------------- def zoom(n) f = Win32API.new("user32", "FindWindowEx", "llpp", "i") fw = f.call(0, 0, "RGSS Player", 0) gsm = Win32API.new("user32", "GetSystemMetrics", "i", "i") mw = Win32API.new("user32", "MoveWindow", "liiiil", "l") sw, sh, w, h = gsm.call(0), gsm.call(1), $Find_W * n, $Find_H * n mw.call(fw, (sw - w) / 2, (sh - h) / 2, w, h, 1) end #-------------------------------------------------------------------------- # ● ゲームウインドウの初期サイズ取得 #-------------------------------------------------------------------------- def get_size f = Win32API.new("user32", "FindWindowEx", "llpp", "i") fw = f.call(0, 0, "RGSS Player", 0) r = [].fill(0.chr, 0..4*4).join Win32API.new("user32", "GetWindowRect", "lp", "i").call(fw, r) rect = r.unpack("i*") $Find_W, $Find_H = (rect[2] - rect[0]), h = (rect[3] - rect[1]) end end #-------------------------------------------------------------------------- # ● 解像度変更対応 #-------------------------------------------------------------------------- class << Graphics alias DAI_resize_screen resize_screen def Graphics::resize_screen(width, height) DAI_resize_screen(width, height) get_size end end Graphics.get_size