Advertisement
FlipelyFlip

Change Fullscreen

Jun 4th, 2024
833
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.16 KB | None | 0 0
  1. class << Graphics
  2. public
  3.   def toggle_fullscreen
  4.     if fullscreen?
  5.       windowed_mode
  6.     else
  7.       fullscreen_mode
  8.       Window_Resize.f
  9.     end
  10.   end
  11.   def update
  12.     release_alt if Disable_VX_Fullscreen && Input.trigger?(Input::ALT)
  13.     zeus_fullscreen_update
  14.     toggle_fullscreen if Input.trigger?(Input::F5)
  15.     toggle_ratio      if Input.trigger?(Input::F6)
  16.     toggle_fullscreen if Input.alt_enter_trigger?
  17.   end
  18.   def release_alt
  19.     inputs = [1,18,2, 1,164,2, 1,165,2].pack('LSx2Lx16'*3)
  20.     SendInput.call(3, inputs, 28)
  21.   end
  22.  
  23.   alias zeus_fullscreen_update2        update
  24.   def toggle_vx_fullscreen
  25.     windowed_mode if @fullscreen and !vx_fullscreen?
  26.     inputs = [1,18,0, 1,13,0, 1,13,2, 1,18,2].pack('LSx2Lx16'*4)
  27.     SendInput.call(4, inputs, 28)
  28.     zeus_fullscreen_update2
  29.     Window_Resize.f
  30.     self.ratio += 0 # refresh window size
  31.   end
  32. end
  33.  
  34. module Input
  35.   VK_LALT = 0xA4
  36.   VK_RETURN = 0x0D
  37.  
  38.   GetAsyncKeyState = Win32API.new('user32', 'GetAsyncKeyState', 'i', 'i')
  39.  
  40.   def self.alt_enter_trigger?
  41.     (GetAsyncKeyState.call(VK_LALT) & 0x0001) != 0 && (GetAsyncKeyState.call(VK_RETURN) & 0x0001) != 0
  42.   end
  43.  
  44. end
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement