Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class << Graphics
- public
- def fullscreen_mode
- return if vx_fullscreen?
- initialize_fullscreen_rects
- show_back
- hide_borders
- @fullscreen = true
- self.ratio += 0 # refresh window size
- end
- def toggle_fullscreen
- if fullscreen?
- windowed_mode
- else
- fullscreen_mode
- Window_Resize.f
- end
- end
- def update
- toggle_fullscreen if Input.alt_enter_trigger?
- toggle_fullscreen if Input.trigger?(Input::F5)
- toggle_ratio if Input.trigger?(Input::F6)
- zeus_fullscreen_update
- end
- def ratio=(r)
- return if vx_fullscreen?
- initialize_fullscreen_rects
- r = 0 if r < 0
- if @fullscreen
- @fullscreen_ratio = r
- w_max, h_max = @fullscreen_rect.width, @fullscreen_rect.height
- else
- @windowed_ratio = r
- w_max = @workarea_rect.width - @borders_size.width
- h_max = @workarea_rect.height - @borders_size.height
- end
- if r == 0
- w, h = w_max, w_max * height / width
- h, w = h_max, h_max * width / height if h > h_max
- else
- w, h = width * r, height * r
- return self.ratio = 0 if w > w_max or h > h_max
- end
- index = Mewgles_SystemOptionsEdit::resolution_index
- w = Mewgles_SystemOptionsEdit::RESOLUTIONS[index][1]
- h = Mewgles_SystemOptionsEdit::RESOLUTIONS[index][2]
- resize_window(w, h)
- save_fullscreen_settings
- end
- end
- module Input
- VK_LALT = 0xA4
- VK_RETURN = 0x0D
- GetAsyncKeyState = Win32API.new('user32', 'GetAsyncKeyState', 'i', 'i')
- def self.alt_enter_trigger?
- (GetAsyncKeyState.call(VK_LALT) & 0x8001) != 0 && (GetAsyncKeyState.call(VK_RETURN) & 0x0001) != 0
- end
- def self.alt_trigger?
- (GetAsyncKeyState.call(VK_LALT) & 0x8001) != 0
- end
- def self.enter_trigger?
- (GetAsyncKeyState.call(VK_RETURN) & 0x0001) != 0
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement