diff --git a/Data/Scripts.rvdata2 b/Data/Scripts.rvdata2 index d0b247c..a1451c1 100644 Binary files a/Data/Scripts.rvdata2 and b/Data/Scripts.rvdata2 differ diff --git a/Scripts/Window_Resizer.rb b/Scripts/Window_Resizer.rb new file mode 100644 index 0000000..a8001d1 --- /dev/null +++ b/Scripts/Window_Resizer.rb @@ -0,0 +1,55 @@ +#============================================================================== +# ■ Window Resize Toggle (F5) - Auto-Center + Taskbar Offset +#------------------------------------------------------------------------------ +# Cycles through safe window sizes and auto-centers the window to ensure it +# stays fully visible within the monitor bounds. Nudges window upward to avoid +# overlapping the taskbar at the bottom. +#============================================================================== + +module WindowScaler + # Define fixed window sizes [width, height] + SIZES = [ + [544, 416], # 1.0x native + [816, 624], # 1.5x + [1088, 832], # 2.0x + [1360, 1040], # 2.5x + [1632, 1248], # 3.0x + [1856, 1392], # ~3.4x + ] + + TASKBAR_OFFSET = 20 # Move window upward to avoid taskbar +end + +class << Graphics + alias resize_update update + def update + resize_update + WindowResize.update + end +end + +module WindowResize + @index = 0 + + def self.update + if Input.trigger?(:F5) + @index = (@index + 1) % WindowScaler::SIZES.size + apply_size(*WindowScaler::SIZES[@index]) + end + end + + def self.apply_size(width, height) + # Get screen resolution + screen_width = Win32API.new('user32', 'GetSystemMetrics', ['I'], 'I').call(0) + screen_height = Win32API.new('user32', 'GetSystemMetrics', ['I'], 'I').call(1) + + # Calculate centered position, nudged up by TASKBAR_OFFSET + x = [(screen_width - width) / 2, 0].max + y = [(screen_height - height) / 2 - WindowScaler::TASKBAR_OFFSET, 0].max + + # Resize and move window + hwnd = Win32API.new('user32', 'FindWindowA', ['P', 'P'], 'L').call("RGSS Player", nil) + move_window = Win32API.new('user32', 'MoveWindow', %w(L L L L L L), 'L') + move_window.call(hwnd, x, y, width, height, 1) + end +end diff --git a/YAML/Scripts.yaml b/YAML/Scripts.yaml index cc0f6a1..32c69cf 100644 --- a/YAML/Scripts.yaml +++ b/YAML/Scripts.yaml @@ -452,11 +452,14 @@ - 'メッセージスキップ機能' - '_.24.rb' - - !!int '152' + - 'Window Resizer' + - 'Window_Resizer.rb' +- - !!int '153' - '▼ メイン' - !!null 'null' -- - !!int '153' +- - !!int '154' - 'Main' - 'Main.rb' -- - !!int '154' +- - !!int '155' - '' - !!null 'null'