查看: 2588|回复: 1

[已经过期] 切换地图的时候变成这样了

[复制链接]
梦石
0
星屑
936
在线时间
74 小时
注册时间
2018-7-8
回帖
31
发表于 2020-2-28 17:10:07 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 VIPArcher 于 2022-6-10 16:37 编辑

用了一个放大分辨率的脚本
结果切换地图的时候就这样了

这是那个放大分辨率的脚本,默认把屏幕调到800×600
  1. #   Esrever : Map viewport/scroll fix
  2. #   Zeus81  : FPS Display
  3. #-----------------------------------------------------------------------------
  4. # Permite utilizar fullscreen real (sem redimensionamento de tela), e alterar
  5. # o limite da função Graphics.resize_screen para a resolução máxima do monitor
  6. # ou um valor próximo.
  7. #=============================================================================

  8. # Módulo Graphics
  9. class << Graphics
  10.   # API
  11.   User32   = DL.dlopen('user32')
  12.   Kernel32 = DL.dlopen('kernel32')
  13.   GetActiveWindow  = DL::CFunc.new(  User32['GetActiveWindow' ], DL::TYPE_LONG)
  14.   GetSystemMetrics = DL::CFunc.new(  User32['GetSystemMetrics'], DL::TYPE_LONG)
  15.   GetWindowRect    = DL::CFunc.new(  User32['GetWindowRect'   ], DL::TYPE_LONG)
  16.   SetWindowLong    = DL::CFunc.new(  User32['SetWindowLong'   ], DL::TYPE_LONG)
  17.   SetWindowPos     = DL::CFunc.new(  User32['SetWindowPos'    ], DL::TYPE_LONG)
  18.   GetModuleHandle  = DL::CFunc.new(Kernel32['GetModuleHandle' ], DL::TYPE_LONG)  

  19.   # DLL sendo utilizada
  20.   _DLLName = DL::CPtr.malloc(140)
  21.   s = DL::CFunc.new(Kernel32['GetPrivateProfileString'], DL::TYPE_LONG).call([
  22.     DL::CPtr["Game"].to_i,
  23.     DL::CPtr["Library"].to_i,
  24.     0,
  25.     _DLLName.to_i,
  26.     140,
  27.     DL::CPtr["./Game.ini"].to_i
  28.   ])

  29.   @@DLLName = File.basename(_DLLName.to_s(s))

  30.   # Verifica se é uma RGSS3xx.dll
  31.   if @@DLLName.match(/^RGSS3(\d{2})\.dll$/)
  32.     @@DLLVersion = $1.to_i
  33.    
  34.     # Verifica se a versão é 0 ou 1.
  35.     if @@DLLVersion.between?(0, 1)
  36.       # Flag de fullscreen
  37.       @@inFullscreen = false
  38.      
  39.       # Instância da DLL. *Necessariamente* a RGSS300.dll ou RGSS301.dll, visto
  40.       # que o trabalho com memória a seguir é específico.
  41.      
  42.       @@DLLHandle   = GetModuleHandle.call([DL::CPtr[@@DLLName].to_i])
  43.      
  44.       # Instância da janela de jogo
  45.       @@hWnd       = GetActiveWindow.call([])
  46.      
  47.       # Tamanho da tela
  48.       @@screenSize = [
  49.         GetSystemMetrics.call([0]),
  50.         GetSystemMetrics.call([1])
  51.       ]
  52.      
  53.       # Calcula o próximo tamanho divisível por 32 para fazer a limitação
  54.       width, height = @@screenSize
  55.       width  += (32 - (width  % 32)) unless (width  % 32).zero?
  56.       height += (32 - (height % 32)) unless (height % 32).zero?
  57.       puts "Limitando para: #{width}x#{height}" if $TEST
  58.      
  59.       #-----------------------------------------------------------------------
  60.       # Bruxaria de scripter desconhecido. Remove a limitação de tamanho para
  61.       # o método Graphics.resize_screen (640x480)
  62.       #
  63.       # Base retirada de: [url]http://pastebin.com/sM2MNJZj[/url]
  64.       #
  65.       # Adaptações para a RGSS300.dll e início do mapeamento dos endereços
  66.       # utilizados por Gab!
  67.       #-----------------------------------------------------------------------
  68.      
  69.       # Número para string
  70.       wh = ->(w, h, off = 0){
  71.         [w + off, h + off].pack('l2').scan(/..../)
  72.       }
  73.      
  74.       # Altera um valor na memória relativa à DLL
  75.       mod = ->(adr, val){
  76.         adr += @@OFF if @@DLLVersion.zero?
  77.         DL::CPtr.new(@@DLLHandle + adr)[0, val.size] = val
  78.       }
  79.      
  80.       # Valores úteis
  81.       wt,  ht  = width.divmod(32), height.divmod(32)
  82.       w,   h   = wh.(width, height)
  83.       ww,  hh  = wh.(width, height, 32)
  84.       www, hhh = wh.(wt.first, ht.first, 1)
  85.       zero     = [0].pack('l')
  86.          
  87.       # Faz as alterações na memória
  88.      
  89.       # Graphics
  90.       @@OFF = 0
  91.       mod.(0x195F, "\x90"*5) # ???
  92.       mod.(0x19A4,   h     ) # ???
  93.       mod.(0x19A9,   w     ) # ???
  94.       mod.(0x1A56,   h     ) # ???
  95.       mod.(0x1A5B,   w     ) # ???
  96.       mod.(0x20F6,   w     ) # Max width  (?)
  97.       mod.(0x20FF,   w     ) # Max width  (?)
  98.       mod.(0x2106,   h     ) # Max height (?)
  99.       mod.(0x210F,   h     ) # Max height (?)
  100.      
  101.       # Plane (?) Class
  102.       @@OFF   = -0xC0
  103.       Graphics::PlaneSpeedUp = true
  104.         # Setando para false não é necessário reescrever classe Plane. No
  105.         # entanto, o mapa fica MUITO lento.
  106.       mod.(0x1C5E3,  Graphics::PlaneSpeedUp ? zero : h) # Max height
  107.       mod.(0x1C5E8,  Graphics::PlaneSpeedUp ? zero : w) # Max width
  108.      
  109.       # ???
  110.       @@OFF = 0x20
  111.       mod.(0x1F477,  h     ) # ???
  112.       mod.(0x1F47C,  w     ) # ???
  113.      
  114.       # Tilemap Class
  115.       @@OFF = 0x1E0
  116.       mod.(0x211FF,  hh    ) # Tilemap render height
  117.       mod.(0x21204,  ww    ) # Tilemap render width
  118.       mod.(0x21D7D,  hhh[0]) # Tilemap max tiles on screen height
  119.       mod.(0x21E01,  www[0]) # Tilemap max tiles on screen width
  120.      
  121.       # ???
  122.       @@OFF = 0x140
  123.       mod.(0x10DEA8, h     ) # ???
  124.       mod.(0x10DEAD, w     ) # ???   
  125.       mod.(0x10DEDF, h     ) # ???
  126.       mod.(0x10DEE3, w     ) # ???
  127.       mod.(0x10DF14, h     ) # ???
  128.       mod.(0x10DF18, w     ) # ???
  129.       mod.(0x10DF48, h     ) # ???
  130.       mod.(0x10DF4C, w     ) # ???
  131.       mod.(0x10E6A7, w     ) # ???
  132.       mod.(0x10E6C3, h     ) # ???
  133.       mod.(0x10EEA9, w     ) # ???
  134.       mod.(0x10EEB9, h     ) # ???
  135.      
  136.       #-------------------------------------------------------------------------
  137.       # Fim da bruxaria
  138.       #-------------------------------------------------------------------------
  139.      
  140.       # Sprite de transição de tela
  141.       @@TransitionSprite = Sprite.new
  142.       @@TransitionSprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  143.       @@TransitionSprite.bitmap.fill_rect(@@TransitionSprite.bitmap.rect, Color.new(0, 0, 0))
  144.       @@TransitionSprite.opacity = 0
  145.       @@TransitionSprite.z = 0x7FFFFFFF
  146.      
  147.       # Bitmap da tela no momento do Graphics.freeze
  148.       @@FrozenBitmap = Bitmap.new(Graphics.width, Graphics.height)
  149.       @@FrozenBitmap.fill_rect(@@FrozenBitmap.rect, Color.new(0, 0, 0))
  150.      
  151.       # Realiza a transição de tela
  152.       # Nota: Não é possível realizar transição de tela com imagens
  153.       alias oldFullscreenResTransition transition
  154.       def transition(time, image='', vague=40)
  155.         @@TransitionSprite.bitmap.dispose
  156.         @@TransitionSprite.dispose
  157.         @@TransitionSprite = Sprite.new
  158.         @@TransitionSprite.bitmap = @@FrozenBitmap
  159.         @@TransitionSprite.opacity = 255
  160.         @@TransitionSprite.z = 0x7FFFFFFF
  161.      
  162.         oldFullscreenResTransition(0)
  163.       
  164.         dec = (255.0 / time)
  165.         time.times {
  166.           @@TransitionSprite.opacity -= dec
  167.           Graphics.update
  168.         }
  169.       end
  170.      
  171.       # Fadein
  172.       def fadein(time)
  173.         @@FrozenBitmap = Bitmap.new(Graphics.width, Graphics.height)
  174.         @@FrozenBitmap.fill_rect(@@FrozenBitmap.rect, Color.new(0, 0, 0))
  175.       
  176.         transition(time)
  177.       end
  178.      
  179.       # Fadeout
  180.       def fadeout(time)
  181.         inc = (255.0 / time)
  182.         time.times {
  183.           @@TransitionSprite.opacity += inc
  184.           Graphics.update
  185.         }
  186.       end
  187.      
  188.       # Armazena a imagem da tela
  189.       alias oldFullscreenResFreeze freeze
  190.       def freeze(*a, &b)
  191.         oldFullscreenResFreeze(*a, &b)
  192.         @@FrozenBitmap = Graphics.snap_to_bitmap
  193.       end
  194.      
  195.       # Realiza o redimensionamento de tela
  196.       alias gabFullscreenOldResizeScreen resize_screen
  197.       def resize_screen(*a, &b)
  198.         # Redimensiona normalmente
  199.         gabFullscreenOldResizeScreen(*a, &b)
  200.         # Redimensiona o sprite de transição
  201.         @@TransitionSprite.bitmap.dispose
  202.         @@TransitionSprite.bitmap = Bitmap.new(*Graphics.size)
  203.         @@TransitionSprite.bitmap.fill_rect(@@TransitionSprite.bitmap.rect, Color.new(0, 0, 0))
  204.       
  205.         if Graphics::PlaneSpeedUp
  206.           # Manda o sinal de atualização para todas as instâncias da classe Plane
  207.           ObjectSpace.each_object(Plane){|plane|
  208.             plane.send(:recreateBitmap)
  209.           }
  210.         end
  211.       end
  212.      
  213.       # Altera para fullscreen
  214.       def fullscreen
  215.         # Retorna se já estiver em fullscreen
  216.         return if @@inFullscreen
  217.         # Tamanho antes do fullscreen
  218.         rect = DL::CPtr.malloc(16)
  219.         rect[0, 16] = 0.chr * 16
  220.         GetWindowRect.call([@@hWnd, rect])
  221.         @@windowSize = rect[0, 16].unpack("l*")
  222.         @@windowSize[2] -= @@windowSize[0]
  223.         @@windowSize[3] -= @@windowSize[1]
  224.         @@windowResolution = Graphics.size
  225.         # Muda o tamanho da tela
  226.         Graphics.resize_screen(*@@screenSize)
  227.         # Remover bordas da janela
  228.         SetWindowLong.call([@@hWnd, -16, 0x14000000])
  229.         # Coloca a janela acima de todas as outras
  230.         SetWindowPos.call([@@hWnd, -1, 0, 0, *@@screenSize, 0])
  231.         # Modifica a flag de fullscreen
  232.         @@inFullscreen = true
  233.         # Espera alguns frames para terminar o processamento
  234.         Graphics.wait(5)
  235.       end
  236.      
  237.       # Altera para modo janela
  238.       def windowed
  239.         # Retorna se não estiver em fullscreen
  240.         return unless @@inFullscreen
  241.         # Muda o tamanho da tela
  242.         Graphics.resize_screen(*@@windowResolution)
  243.         # Recoloca bordas da janela
  244.         SetWindowLong.call([@@hWnd, -16, 0x14CA0000])
  245.         # Coloca a janela na posição x,y,z comum e ajusta seu tamanho
  246.         SetWindowPos.call([@@hWnd, 0, *@@windowSize, 0])
  247.         # Modifica a flag de fullscreen
  248.         @@inFullscreen = false
  249.         # Espera alguns frames para terminar o processamento
  250.         Graphics.wait(5)
  251.       end
  252.      
  253.       # Tamanho da tela
  254.       def size
  255.         [self.width, self.height]
  256.       end
  257.      
  258.       # Verifica se a janela está no modo fullscreen
  259.       def fullscreen?
  260.         return @@inFullscreen
  261.       end
  262.      
  263.       # Verifica se a janela está no modo janela
  264.       def windowed?
  265.         return !@@inFullscreen
  266.       end
  267.      
  268.       # Alterna entre os modos fullscreen e janela
  269.       def toggleFullscreen
  270.         @@inFullscreen ? self.windowed : self.fullscreen
  271.       end
  272.     end
  273.   end
  274. end

  275. if Graphics::PlaneSpeedUp
  276.   # Remove a classe Plane Anterior
  277.   Object.send(:remove_const, :Plane)
  278.   # Redefinição da classe Plane
  279.   class Plane
  280.     attr_reader :viewport
  281.     attr_reader :bitmap
  282.     attr_reader :ox
  283.     attr_reader :oy
  284.     attr_reader :opacity
  285.     attr_reader :blend_type
  286.     attr_reader :color
  287.     attr_reader :tone
  288.     attr_reader :visible
  289.     attr_reader :zoom_x
  290.     attr_reader :zoom_y
  291.     attr_reader :z
  292.    
  293.     # Inicialização do objeto
  294.     def initialize(viewport = nil)
  295.       # É necessário verificar se um viewport foi enviado. Desse modo, ao mudar a
  296.       # resolução da tela, deve-se mudar também a rect do viewport para que o
  297.       # Plane que ocupava a tela toda continue
  298.       @defaultViewport = !viewport.is_a?(Viewport)
  299.       @viewport = @defaultViewport ? Viewport.new(0, 0, *Graphics.size) : viewport
  300.      
  301.       @sprite        = Sprite.new(@viewport)
  302.       @bitmap        = nil
  303.       @ox            = @sprite.ox         # 0
  304.       @oy            = @sprite.oy         # 0
  305.       @opacity       = @sprite.opacity    # 255
  306.       @blend_type    = @sprite.blend_type # 0
  307.       @color         = @sprite.color      # Color.new(0, 0, 0, 0)
  308.       @tone          = @sprite.tone       # Tone.new(0, 0, 0, 0)
  309.       @visible       = @sprite.visible    # true
  310.       @z             = @sprite.z          # 0
  311.       @zoom_x        = @sprite.zoom_x     # 1.0
  312.       @zoom_y        = @sprite.zoom_y     # 1.0
  313.     end
  314.    
  315.     def bitmap=(bitmap)
  316.       return unless bitmap.is_a?(Bitmap)
  317.       @bitmap = bitmap
  318.       self.recreateBitmap(true)
  319.     end
  320.    
  321.     def ox=(value)
  322.       @ox = value
  323.       return unless @bitmap
  324.       @sprite.ox = (value % @bitmap.width)
  325.     end
  326.    
  327.     def oy=(value)
  328.       @oy = value
  329.       return unless @bitmap
  330.       @sprite.oy = (value % @bitmap.height)
  331.     end
  332.    
  333.     def opacity=(value)
  334.       @sprite.opacity = value
  335.       @opacity = @sprite.opacity
  336.     end
  337.    
  338.     def blend_type=(value)
  339.       @sprite.blend_type = value
  340.       @blend_type = @sprite.blend_type
  341.     end
  342.    
  343.     def color=(value)
  344.       @sprite.color = value
  345.       @color = @sprite.color
  346.     end
  347.    
  348.     def tone=(value)
  349.       @sprite.tone = value
  350.       @tone = @sprite.tone
  351.     end
  352.    
  353.     def viewport=(value)
  354.       @defaultViewport &= (value == @sprite.viewport)
  355.       @sprite.viewport = value
  356.       @viewport = @sprite.viewport
  357.     end
  358.    
  359.     def visible=(value)
  360.       @sprite.visible = value
  361.       @visible = sprite.visible
  362.     end
  363.    
  364.     def z=(value)
  365.       @sprite.z = value
  366.       @z = @sprite.z
  367.     end
  368.    
  369.     def zoom_x=(value)
  370.       @sprite.zoom_x = value
  371.       @zoom_x = @sprite.zoom_x
  372.       self.recreateBitmap
  373.     end
  374.    
  375.     def zoom_y=(value)
  376.       @sprite.zoom_y = value
  377.       @zoom_y = @sprite.zoom_y
  378.       self.recreateBitmap
  379.     end
  380.    
  381.     def disposed?
  382.       return @sprite.disposed?
  383.     end
  384.    
  385.     def dispose
  386.       @sprite.dispose
  387.     end
  388.    
  389.     protected
  390.    
  391.     def recreateBitmap(forceRefresh = false)
  392.       cw, ch      = Graphics.width * (2.0/@zoom_x), Graphics.height * (2.0/@zoom_y)
  393.       needRefresh = true
  394.      
  395.       if @defaultViewport
  396.         @viewport.rect.width, @viewport.rect.height = *Graphics.size
  397.       end
  398.      
  399.       if @sprite.bitmap.nil? or @sprite.bitmap.disposed?
  400.         newBitmap = Bitmap.new(cw, ch)
  401.       else
  402.         if (cw == @sprite.bitmap.width) and (ch == @sprite.bitmap.height) and (!forceRefresh)
  403.           return
  404.         end
  405.       
  406.         newBitmap = Bitmap.new(cw, ch)
  407.         if (cw < @sprite.bitmap.width) and (ch < @sprite.bitmap.height)
  408.           newBitmap.blt(0, 0, @sprite.bitmap, @sprite.bitmap.rect)
  409.           @sprite.bitmap.dispose
  410.           needRefresh = false
  411.         end
  412.       end
  413.      
  414.       @sprite.bitmap = newBitmap
  415.       self.refreshBitmap if needRefresh or forceRefresh
  416.     end
  417.    
  418.     def refreshBitmap
  419.       # Limpa o bitmap
  420.       b = @sprite.bitmap
  421.       b.clear
  422.      
  423.       return if @bitmap.nil?
  424.      
  425.       # Quantia de espaços para blt
  426.       tx = (b.width  / @bitmap.width.to_f )
  427.       ty = (b.height / @bitmap.height.to_f)
  428.      
  429.       b.blt(0, 0, @bitmap, @bitmap.rect)
  430.      
  431.       return if tx + ty == 2
  432.      
  433.       # Preenche 1 linha
  434.       basePow = @bitmap.width
  435.       baseRct = Rect.new(0, 0, @bitmap.width, @bitmap.height)
  436.      
  437.       Math.log2(tx).floor.times{
  438.         b.blt(basePow, 0, b, baseRct)
  439.         baseRct.width += basePow
  440.         basePow *= 2
  441.       }
  442.      
  443.       # Último bitmap da linha
  444.       baseRct.width = (b.width - baseRct.width)
  445.       b.blt(basePow, 0, b, baseRct)
  446.      
  447.       # Preenche o restante das linhas
  448.       basePow = @bitmap.height
  449.       baseRct = Rect.new(0, 0, b.width, @bitmap.height)
  450.      
  451.       Math.log2(ty).floor.times{
  452.         b.blt(0, basePow, b, baseRct)
  453.         baseRct.height += basePow
  454.         basePow *= 2
  455.       }
  456.      
  457.       # Última linha
  458.       baseRct.height = b.height - baseRct.height
  459.       b.blt(basePow, 0, b, baseRct)
  460.     end
  461.   end
  462. end

  463. class Game_Map
  464.   # Número de tiles horizontais na tela
  465.   def screen_tile_x
  466.     (Graphics.width / 32.0).ceil
  467.   end

  468.   # Número de tiles verticais na tela
  469.   def screen_tile_y
  470.     (Graphics.height / 32.0).ceil
  471.   end
  472. end

  473. # Contador de FPS para o modo Fullscreen
  474. if $TEST
  475.   # FPS Display // Zeus81
  476.   # [url]http://forums.rpgmakerweb.com/index.php?/topic/3738-fps-display-isnt-very-accurate/#entry40350[/url]
  477.   module Graphics
  478.     @fps, @fps_tmp = 0, []
  479.    
  480.     class << self
  481.       attr_reader :fps
  482.      
  483.       alias fps_update update unless method_defined?(:fps_update)
  484.       def update
  485.         t = Time.now
  486.         fps_update
  487.         @fps_tmp[frame_count % frame_rate] = Time.now != t
  488.         @fps = 0
  489.         frame_rate.times {|i| @fps += 1 if @fps_tmp[i]}
  490.         fps_sprite.src_rect.y = @fps * 16
  491.       end
  492.      
  493.       def fps_sprite
  494.         if !@fps_sprite or @fps_sprite.disposed?
  495.           @fps_sprite = Sprite.new
  496.           @fps_sprite.z = 0x7FFFFFFF
  497.           @fps_sprite.bitmap = Bitmap.new(24, 16*120)
  498.           @fps_sprite.bitmap.font.name = "Arial"
  499.           @fps_sprite.bitmap.font.size = 16
  500.           @fps_sprite.bitmap.font.color.set(255, 255, 255)
  501.           @fps_sprite.bitmap.fill_rect(@fps_sprite.bitmap.rect, Color.new(0, 0, 0, 127))
  502.           120.times {|i|
  503.             @fps_sprite.bitmap.draw_text(0, i*16, 24, 16, "% 3d"%i, 1)
  504.           }
  505.           @fps_sprite.src_rect.height = 16
  506.         end
  507.         return @fps_sprite
  508.       end      
  509.     end
  510.   end
  511. end

  512. #==============================================================================
  513. # ▼ Viewports/Map Fix for Modified RGSS300.dll File
  514. #   Origin of Code: Yanfly Engine Ace - Ace Core Engine v1.06
  515. # -- Last Updated: 2011.12.26
  516. # -- Level: Easy, Normal
  517. # -- Requires: n/a
  518. #==============================================================================

  519. #==============================================================================
  520. # ■ Game_Map
  521. #==============================================================================

  522. class Game_Map

  523.   #--------------------------------------------------------------------------
  524.   # overwrite method: scroll_down
  525.   #--------------------------------------------------------------------------
  526.   def scroll_down(distance)
  527.     if loop_vertical?
  528.       @display_y += distance
  529.       @display_y %= @map.height * 256
  530.       @parallax_y += distance
  531.     else
  532.       last_y = @display_y
  533.       dh = Graphics.height > height * 32 ? height : screen_tile_y
  534.       @display_y = [@display_y + distance, height - dh].min
  535.       @parallax_y += @display_y - last_y
  536.     end
  537.   end

  538.   #--------------------------------------------------------------------------
  539.   # overwrite method: scroll_right
  540.   #--------------------------------------------------------------------------
  541.   def scroll_right(distance)
  542.     if loop_horizontal?
  543.       @display_x += distance
  544.       @display_x %= @map.width * 256
  545.       @parallax_x += distance
  546.     else
  547.       last_x = @display_x
  548.       dw = Graphics.width > width * 32 ? width : screen_tile_x
  549.       @display_x = [@display_x + distance, width - dw].min
  550.       @parallax_x += @display_x - last_x
  551.     end
  552.   end

  553. end # Game_Map

  554. #==============================================================================
  555. # ■ Spriteset_Map
  556. #==============================================================================

  557. class Spriteset_Map

  558.   #--------------------------------------------------------------------------
  559.   # overwrite method: create_viewports
  560.   #--------------------------------------------------------------------------
  561.   def create_viewports
  562.     if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
  563.       dx = (Graphics.width - $game_map.width * 32) / 2
  564.     else
  565.       dx = 0
  566.     end
  567.     dw = [Graphics.width, $game_map.width * 32].min
  568.     dw = Graphics.width if $game_map.loop_horizontal?
  569.     if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
  570.       dy = (Graphics.height - $game_map.height * 32) / 2
  571.     else
  572.       dy = 0
  573.     end
  574.     dh = [Graphics.height, $game_map.height * 32].min
  575.     dh = Graphics.height if $game_map.loop_vertical?
  576.     @viewport1 = Viewport.new(dx, dy, dw, dh)
  577.     @viewport2 = Viewport.new(dx, dy, dw, dh)
  578.     @viewport3 = Viewport.new(dx, dy, dw, dh)
  579.     @viewport2.z = 50
  580.     @viewport3.z = 100
  581.   end

  582.   #--------------------------------------------------------------------------
  583.   # new method: update_viewport_sizes
  584.   #--------------------------------------------------------------------------
  585.   def update_viewport_sizes
  586.     if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
  587.       dx = (Graphics.width - $game_map.width * 32) / 2
  588.     else
  589.       dx = 0
  590.     end
  591.     dw = [Graphics.width, $game_map.width * 32].min
  592.     dw = Graphics.width if $game_map.loop_horizontal?
  593.     if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
  594.       dy = (Graphics.height - $game_map.height * 32) / 2
  595.     else
  596.       dy = 0
  597.     end
  598.     dh = [Graphics.height, $game_map.height * 32].min
  599.     dh = Graphics.height if $game_map.loop_vertical?
  600.     rect = Rect.new(dx, dy, dw, dh)
  601.     for viewport in [@viewport1, @viewport2, @viewport3]
  602.       viewport.rect = rect
  603.     end
  604.   end

  605. end # Spriteset_Map

  606. #==============================================================================
  607. # ■ Scene_Map
  608. #==============================================================================

  609. class Scene_Map < Scene_Base

  610.   #--------------------------------------------------------------------------
  611.   # alias method: post_transfer
  612.   #--------------------------------------------------------------------------
  613.   alias scene_map_post_transfer_ace post_transfer
  614.   def post_transfer
  615.     @spriteset.update_viewport_sizes
  616.     scene_map_post_transfer_ace
  617.   end

  618. end # Scene_Map

  619. #==============================================================================
  620. # ■ Game_Event
  621. #==============================================================================

  622. class Game_Event < Game_Character

  623.   #--------------------------------------------------------------------------
  624.   # overwrite method: near_the_screen?
  625.   #--------------------------------------------------------------------------
  626.   def near_the_screen?(dx = nil, dy = nil)
  627.     dx = [Graphics.width, $game_map.width * 256].min/32 - 5 if dx.nil?
  628.     dy = [Graphics.height, $game_map.height * 256].min/32 - 5 if dy.nil?
  629.     ax = $game_map.adjust_x(@real_x) - Graphics.width / 2 / 32
  630.     ay = $game_map.adjust_y(@real_y) - Graphics.height / 2 / 32
  631.     ax >= -dx && ax <= dx && ay >= -dy && ay <= dy
  632.   end

  633. end # Game_Event

  634. # Chama o método que realiza a mudança de tamanho
  635. # Graphics.fullscreen
  636. Graphics.resize_screen(800, 600)

  637. __END__
  638. # TESTES
  639. # Graphics.windowed
  640. x = Bitmap.new(50, 50)
  641. x.gradient_fill_rect(0,  0, 50, 25, Color.new(255, 0, 0), Color.new(0, 255, 0))
  642. x.gradient_fill_rect(0, 25, 50, 25, Color.new(0, 255, 0), Color.new(0, 0, 255))
  643. y = Plane.new
  644. y.bitmap = x
  645. y.zoom_x = 3
  646. y.zoom_y = 3
  647. #Graphics.fullscreen
  648. #Graphics.windowed
  649. loop do
  650.   Graphics.update
  651.   y.ox += 1
  652.   y.oy += 1
  653. end
复制代码
梦石
0
星屑
936
在线时间
74 小时
注册时间
2018-7-8
回帖
31
 楼主| 发表于 2020-2-29 18:50:36 | 显示全部楼层
我日图呢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部