Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #doorstuck adjustable fullscreen 1.1
- class AdjustableResizer
- CreateWindowEx = Win32API.new('user32' , 'CreateWindowEx' , 'ippiiiiiiiii', 'i')
- GetDC = Win32API.new('user32' , 'GetDC' , 'i' , 'i')
- GetSystemMetrics = Win32API.new('user32' , 'GetSystemMetrics' , 'i' , 'i')
- FillRect = Win32API.new('user32' , 'FillRect' , 'ipi' , 'i')
- FindWindow = Win32API.new('user32' , 'FindWindow' , 'pp' , 'i')
- ReleaseDC = Win32API.new('user32' , 'ReleaseDC' , 'ii' , 'i')
- SetWindowLong = Win32API.new('user32' , 'SetWindowLong' , 'iii' , 'i')
- SetWindowPos = Win32API.new('user32' , 'SetWindowPos' , 'iiiiiii' , 'i')
- ShowWindow = Win32API.new('user32' , 'ShowWindow' , 'ii' , 'i')
- UpdateWindow = Win32API.new('user32' , 'UpdateWindow' , 'i' , 'i')
- GetWindowRect = Win32API.new('user32' , 'GetWindowRect' , 'ip' , 'i')
- CreateSolidBrush = Win32API.new('gdi32' , 'CreateSolidBrush' , 'i' , 'i')
- DeleteObject = Win32API.new('gdi32' , 'DeleteObject' , 'i' , 'i')
- def initialize()
- @defaultRpgMakerX = 544
- @defaultRpgMakerY = 416
- @screenRect = Rect.new(0, 0, GetSystemMetrics.call(0), GetSystemMetrics.call(1))
- #universal constant
- @rpgMakerX = 640
- #height that we would render if rpg maker would render non 32 tiles
- wishfulY = @rpgMakerX * @screenRect.height / @screenRect.width
- #divide by 32 and multiply by 32 to get the actual number of pixels that
- #could be rendered by RPG maker without glitches
- @rpgMakerY = (wishfulY / 32) * 32
- rpgMakerRaimander = wishfulY - @rpgMakerY
- #now we need to calculate the actual screen margin from top and bottom
- actualScreenMargin = @screenRect.height * rpgMakerRaimander / wishfulY
- @mainHeight = @screenRect.height - actualScreenMargin
- @upperMargin = actualScreenMargin / 2
- #draw black background on all the screen
- @BackgroundHandler = CreateWindowEx.call(0x08000008, 'Static', '', 0x80000000, 0, 0, 0, 0, 0, 0, 0, 0)
- @mainWindowHandler = FindWindow.call('RGSS Player', 0)
- windowRectPointer = [0, 0, 0, 0].pack('l4')
- GetWindowRect.call(@mainWindowHandler, windowRectPointer)
- @originalWindowRect = windowRectPointer.unpack('l4')
- end
- def backToWindowed
- Graphics.resize_screen(@defaultRpgMakerX, @defaultRpgMakerY)
- SetWindowLong.call(@mainWindowHandler, -16, 0x14CA0000)
- SetWindowPos.call(@mainWindowHandler, -1, @originalWindowRect[0], @originalWindowRect[1], @originalWindowRect[2] - @originalWindowRect[0], @originalWindowRect[3] - @originalWindowRect[1], 0)
- ShowWindow.call(@BackgroundHandler, 0)
- end
- def adjustableFullscreen
- Graphics.resize_screen(@rpgMakerX, @rpgMakerY)
- paintBackground()
- SetWindowLong.call(@mainWindowHandler, -16, 0x14000000)
- SetWindowPos.call(@mainWindowHandler, -1, 0, @upperMargin, @screenRect.width, @mainHeight, 0)
- end
- def paintBackground
- ShowWindow.call(@BackgroundHandler, 3)
- UpdateWindow.call(@BackgroundHandler)
- dc = GetDC.call(@BackgroundHandler)
- rect = [0, 0, @screenRect.width, @screenRect.height].pack('l4')
- brush = CreateSolidBrush.call(0)
- FillRect.call(dc, rect, brush)
- ReleaseDC.call(@BackgroundHandler, dc)
- DeleteObject.call(brush)
- end
- end
- resizer = AdjustableResizer.new()
- resizer.adjustableFullscreen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement