Archeia

Visual Novel Maker Extension: Auto Screen Scaling

Jan 13th, 2018
560
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. stockHeight = [1080, 960, 720, 640, 576, 480, 360, 240]
  2.  
  3. resizeScreen = () ->
  4.     gameResolution =
  5.         width: $PARAMS.resolution.width
  6.         height: $PARAMS.resolution.height
  7.     screenResolution =
  8.         width: window.screen.availWidth
  9.         height: window.screen.availHeight
  10.     if $PARAMS.preview or GameManager.inLivePreview then return
  11.     if !nw? then return
  12.     isFullscreen = nw.Window.get().isFullscreen
  13.     ratio = gameResolution.width / gameResolution.height
  14.    
  15.     if isFullscreen then return
  16.     for height in stockHeight
  17.         if gameResolution.height < height then continue
  18.         if screenResolution.height < height then continue
  19.         width = height * ratio
  20.         if screenResolution.width < width then continue
  21.         diff =
  22.             width: window.innerWidth - width
  23.             height: window.innerHeight - height
  24.         window.resizeBy(-diff.width, -diff.height)
  25.         return
  26.    
  27. gs.YEM = {} if !gs.YEM?
  28. gs.YEM.resizeScreen = resizeScreen
  29. gs.YEM.resizeScreen()
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×