From 3b7990d0d55fe5ce38379ab7fda4b8857051d206 Mon Sep 17 00:00:00 2001 From: onms Date: Thu, 19 Jun 2025 01:13:16 -0500 Subject: [PATCH] added f5 resize options --- Data/Scripts.rvdata2 | Bin 265610 -> 266419 bytes Scripts/Window_Resizer.rb | 55 ++++++++++++++++++++++++++++++++++++++ YAML/Scripts.yaml | 7 +++-- 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 Scripts/Window_Resizer.rb diff --git a/Data/Scripts.rvdata2 b/Data/Scripts.rvdata2 index d0b247c4e9bd21b4e2cb0093d7a5981cf9c755a8..a1451c157c7a116548d7444c1ea2ae280ebf03df 100644 GIT binary patch delta 873 zcmV-v1D5=Xn-H_15CsGXTLGJa1%(9xg#`kI1p~DO1e*+h6IW?&WN&vMQe|^#dS!A3 zI{;K70t*9p+O1UGZrU&uzOTeP92HfBHDn?Dh*hmN)|CpaT~R@rG=z{z9AeGHD0YDC zVvn)wJ=>mSK5-~yTd&q2ksP1zeCOZQs~3GLCsp|M<0pJ(aUizvNG1D5VIr1GPQe;< z>d=6Gszl>|n#PJIa1Ik9zb;4u4`C>&()NuPeK4Tw%;!{siV~47BakGdur&c%Z^9(jjvIR$|iddXmtwhX}NMIq-IFJr}N`s~L zP>`kTElC38Bpbm3!$;zB5YC033`zI3B1Co2)8I(pNqu}?Tn zDklI{_&`GzQwZ6P2IWdkw=7VR4H0F_NX-yF9)7tQ!xcLkmc+*|nkTwT~d3U7>5by`BxdmS>bz@U;0}*Xp`9G~KqFD^Yi_>$W_t^V+>a z*E+I)>vgolX6ubt=)Sj{cCMUZ9RMc%@yGZ5$N9rxFus}SWIPvP_qsXHv~J(0$_b4F zB=I?s5-u;{HX-YX`4V{vXGB7hZ^1lW2SiaYFVqG!Jd&V{Ge@R3W{sSKBKKK1E_Kl$ z5%NyUbf;5sO^WDDQXV?T^elv7yiS#)61H4_(&Vjmp?B2ijwr0+>l~VOI4cdz#YNtK zXYUptJTU#&?B1C)D?DBxTOlDpHLcO=>$&|6R}a6<9Tie zIs+X>%j=JZPE5B}EtNEBc{Lkqnqr(uMOXJ!m%x|$Y+4)E^qA=Xx}(G9mRm1znjrpv zle1Yj$zmGUg!?JS(J=;}m(%6?3;aVzptnBi@whz9z;qeAt9k#`2qpd!DzD@%THO~5ZiAH!h%IkEu zuhZ${?RX3$PBNOD>S{1vGy|Q@i`9HB-UTkOaiOKNt#t=azq)br7n|{mq1&*tA+w=0 zeEJ%xmpAY?lCTd7TL@_ZnU|gn1R?>Nm%$7Kw-TF4A^-+E08}Ckc-jL100001yLOYy delta 59 zcmdnIP@rqJ04obeG~=vB)>c-=R#v7~R_3j&EVFs0pX6szV4OMq6+g>%p;?|v3~bg6 OAxgXzx0o4#fDr)eT@Kj* 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'