added f5 resize options
This commit is contained in:
parent
940f311bb0
commit
3b7990d0d5
3 changed files with 60 additions and 2 deletions
Binary file not shown.
55
Scripts/Window_Resizer.rb
Normal file
55
Scripts/Window_Resizer.rb
Normal file
|
|
@ -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
|
||||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Reference in a new issue