Project1

标题: 把圖片加入到RPG::Cache.animation的方法 [打印本页]

作者: Vernon126    时间: 2008-5-6 07:08
提示: 作者被禁止或删除 内容自动屏蔽
作者: 3535    时间: 2008-5-6 07:16
脚本请插入工程的Main之前:
  1. module RPG
  2. class Sprite < ::Sprite
  3.    def dispose_animation
  4.      if @_animation_sprites != nil
  5.        sprite = @_animation_sprites[0]
  6.        if sprite != nil
  7.          @@_reference_count[sprite.bitmap] -= 1
  8.        end
  9.        for sprite in @_animation_sprites
  10.          sprite.dispose
  11.        end
  12.        @_animation_sprites = nil
  13.        @_animation = nil
  14.      end
  15.    end
  16. end
  17. end
复制代码

作者: Vernon126    时间: 2008-5-6 09:16
提示: 作者被禁止或删除 内容自动屏蔽
作者: 神思    时间: 2008-5-6 18:19
因为RPG::Cache.animation就是生成了一个Bitmap.但未释放


  1. RPG::Cache.animation("file")
  2. 100.times{ RPG::Cache.animation("file") }
复制代码

  1. Bitmap.new("Graphics/Animations/file")
  2. 100.times{ Bitmap.new("Graphics/Animations/file") }
复制代码


可以测试以上的2个代码..

前者几乎瞬间完成
后者..


作者: Vernon126    时间: 2008-5-7 00:45
提示: 作者被禁止或删除 内容自动屏蔽
作者: Vernon126    时间: 2008-5-7 01:03
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1