Advertisement
Guest User

doorstuck adjustable fullscreen script

a guest
Feb 20th, 2015
3,251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.63 KB | None | 0 0
  1. # doorstuck adjustable fullscreen script
  2.  
  3. CreateWindowEx            = Win32API.new('user32'  , 'CreateWindowEx'           , 'ippiiiiiiiii', 'i')
  4. GetDC                     = Win32API.new('user32'  , 'GetDC'                    , 'i'           , 'i')
  5. GetSystemMetrics          = Win32API.new('user32'  , 'GetSystemMetrics'         , 'i'           , 'i')
  6. FillRect                  = Win32API.new('user32'  , 'FillRect'                 , 'ipi'         , 'i')
  7. FindWindow                = Win32API.new('user32'  , 'FindWindow'               , 'pp'          , 'i')
  8. ReleaseDC                 = Win32API.new('user32'  , 'ReleaseDC'                , 'ii'          , 'i')
  9. SetWindowLong             = Win32API.new('user32'  , 'SetWindowLong'            , 'iii'         , 'i')
  10. SetWindowPos              = Win32API.new('user32'  , 'SetWindowPos'             , 'iiiiiii'     , 'i')
  11. ShowWindow                = Win32API.new('user32'  , 'ShowWindow'               , 'ii'          , 'i')
  12. UpdateWindow              = Win32API.new('user32'  , 'UpdateWindow'             , 'i'           , 'i')
  13. CreateSolidBrush          = Win32API.new('gdi32'   , 'CreateSolidBrush'         , 'i'           , 'i')
  14. DeleteObject              = Win32API.new('gdi32'   , 'DeleteObject'             , 'i'           , 'i')
  15.  
  16. screenRect = Rect.new(0, 0, GetSystemMetrics.call(0), GetSystemMetrics.call(1))
  17.  
  18. #universal constant
  19. rpgMakerX = 640
  20. #height that we would render if rpg maker would render non 32 tiles
  21. wishfulY = rpgMakerX * screenRect.height / screenRect.width
  22.  
  23. #divide by 32 and multiply by 32 to get the actual number of pixels that
  24. #could be rendered by RPG maker without glitches
  25. rpgMakerY = (wishfulY / 32) * 32
  26.  
  27. rpgMakerRaimander = wishfulY - rpgMakerY
  28.  
  29. Graphics.resize_screen(rpgMakerX, rpgMakerY)
  30.  
  31. #now we need to calculate the actual screen margin from top and bottom
  32. actualScreenMargin = screenRect.height * rpgMakerRaimander / wishfulY
  33. mainHeight = screenRect.height - actualScreenMargin
  34. upperMargin = actualScreenMargin / 2
  35.  
  36. #draw black background on all the screen
  37. BackgroundHandler = CreateWindowEx.call(0x08000008, 'Static', '', 0x80000000, 0, 0, 0, 0, 0, 0, 0, 0)
  38. ShowWindow.call(BackgroundHandler, 3)
  39. UpdateWindow.call(BackgroundHandler)
  40. dc    = GetDC.call(BackgroundHandler)
  41. rect  = [0, 0, screenRect.width, screenRect.height].pack('l4')
  42. brush = CreateSolidBrush.call(0)
  43. FillRect.call(dc, rect, brush)
  44. ReleaseDC.call(BackgroundHandler, dc)
  45. DeleteObject.call(brush)
  46.  
  47. mainWindowHandler = FindWindow.call('RGSS Player', 0)
  48. SetWindowLong.call(mainWindowHandler, -16, 0x14000000)
  49. SetWindowPos.call(mainWindowHandler, -1, 0, upperMargin, screenRect.width, mainHeight, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement