diff --git a/Data/Scripts.rvdata2 b/Data/Scripts.rvdata2 index 96d0583..f5fb114 100644 Binary files a/Data/Scripts.rvdata2 and b/Data/Scripts.rvdata2 differ diff --git a/Scripts/_.20.rb b/Scripts/_.20.rb index b709cb9..1cca370 100644 --- a/Scripts/_.20.rb +++ b/Scripts/_.20.rb @@ -1,81 +1,54 @@ -#============================================================================== -# ★ RGSS3-Extension -# LNX25_ゲーム画面倍率切替 -#  ゲーム中、F5 キーでゲーム画面の表示倍率を切り替えます。 -# -#  version : 1.00 (12/02/27) -#  author : ももまる -#  reference : [url]http://peachround.blog.fc2.com/blog-entry-20.html[/url] -# -#============================================================================== - module LNX25 #-------------------------------------------------------------------------- # ● 切替キー #-------------------------------------------------------------------------- RESIZE_KEY = :F5 # 規定値: :F5 + ZOOM_LEVELS = [1.0, 1.5, 2.0, 2.7] # 追加可能な倍率 end -#============================================================================== -# ■ LNXスクリプト導入情報 -#============================================================================== -$lnx_include = {} if $lnx_include == nil -$lnx_include[:lnx25] = 100 # version -p "OK:LNX25_ウィンドウサイズ変更" - -#============================================================================== -# ■ Graphics -#============================================================================== module Graphics - @screen_zoom = 1 - #-------------------------------------------------------------------------- - # ● ゲーム画面の表示倍率取得 - #-------------------------------------------------------------------------- + @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 - #-------------------------------------------------------------------------- - # ● ウィンドウハンドルの取得(Win32API) - #-------------------------------------------------------------------------- + + 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 - #-------------------------------------------------------------------------- - # ● ウィンドウのリサイズ(Win32API) - #-------------------------------------------------------------------------- + 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) # タイトルバーの高さ + 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 - # ウィンドウ位置・サイズ変更(ウィンドウ, X, Y, 幅, 高さ, 更新フラグ) move_w.call(self.rgssplayer, x, y, width, height, 1) end end + class << Graphics - #-------------------------------------------------------------------------- - # ● フレーム更新 - #-------------------------------------------------------------------------- alias :lnx25_update :update def update - # 元のメソッドを呼ぶ lnx25_update - # F5 キーが押されたらリサイズ if Input.trigger?(LNX25::RESIZE_KEY) - self.screen_zoom = (self.screen_zoom == 1 ? 1.5 : 1) + self.next_zoom_level + p "Zoom changed to #{Graphics.screen_zoom}" # Debugging output end end -end \ No newline at end of file +end