#============================================================================== # ■ Numset #------------------------------------------------------------------------------ #  定数全般のモジュールです。 #============================================================================== module Numset # ウィンドウハンドル取得 win = Win32API.new("user32", "FindWindow", %w(p p), "i") WINDOW_HANDLE = win.call("RGSS Player", $game_system.game_title) end module Input #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def self.update if self.press?(ENTER) and self.press?(ALT) raise "Can,t FullScreen" end for code in 0..255 if @@cons_press[code] == nil @@cons_press[code] = [] end if @@cons_press[code][0] == 0 @@cons_press[code][0] = 1 INPUTKEY.call(code, 0, @@cons_press[code][1]) elsif @@cons_press[code][0] == 1 @@cons_press[code][0] = 0 INPUTKEY.call(code, 2, @@cons_press[code][1]) end if @@press[code] == true if (Graphics.frame_count % REPERT_TIME) == @@time[code] @@repert[code] = true else @@repert[code] = false end else @@repert[code] = false end if GETKEY.call(code) == -128 or GETKEY.call(code) == -127 or GETKEY.call(code) == 65408 or GETKEY.call(code) == 65409 if @@press[code] == false @@trigger[code] = true else @@trigger[code] = false end @@press[code] = true if @@time[code] != 0 @@time[code] = Graphics.frame_count % REPERT_TIME end else @@press[code] = false @@trigger[code] = false @@time[code] = 0 end end end end #============================================================================== # ■ Screen #------------------------------------------------------------------------------ #  ウィンドウの大きさのモジュールです。 #============================================================================== module Screen #-------------------------------------------------------------------------- # ● それでも定数宣言 #-------------------------------------------------------------------------- RECT = Win32API.new("user32", "GetWindowRect", %w(i p), "i") SET = Win32API.new("user32", "SetWindowPos", %w(i i i i i i i), "i") #-------------------------------------------------------------------------- # ● 矩形(くけい)の取得 #-------------------------------------------------------------------------- def self.rect pack = [0, 0, 0, 0].pack("i4") RECT.call(Numset::WINDOW_HANDLE, pack) return pack.unpack("i4") end #-------------------------------------------------------------------------- # ● ウィンドウの作り直し #-------------------------------------------------------------------------- def self.resize(width, height) SET.call(Numset::WINDOW_HANDLE, 0, self.rect[0] + (self.rect[2] - width) / 4, self.rect[1] + (self.rect[3] - height) / 4, width, height, 4) end end #============================================================================== # ■ Game_System #------------------------------------------------------------------------------ #  システム周りのデータを扱うクラスです。BGM などの管理も行います。このクラス # のインスタンスは $game_system で参照されます。 #============================================================================== class Game_System #-------------------------------------------------------------------------- # ● ゲームタイトル取得 #-------------------------------------------------------------------------- def title win = Win32API.new("kernel32", "GetPrivateProfileString", %w(p p p p i p), "i") title = "\0" * 255 win.call("Game", "Title", "Not title", title, 255, ".\\Game.ini") title.gsub!(/\0/){} if String.method_defined?("utf8") return title.utf8 else return title end end end #============================================================================== # ■ Interpreter #------------------------------------------------------------------------------ #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ # スや Game_Event クラスの内部で使用されます。 #============================================================================== class Interpreter #-------------------------------------------------------------------------- # ● 注釈イベントの実行 #-------------------------------------------------------------------------- if self.class.method_defined?("command_108") alias :base_command_108 :command_108 def command_108 if parameters[0] =~ /ウィンドウのサイズ設定 幅\[(\d+)\] ?高さ\[(\d+)\]/ Screen.resize($1, $2) return true end base_command_108 end end end