Project1

标题: [新手初级脚本问]循环问题循环工作效率 [打印本页]

作者: kula1900    时间: 2009-9-14 17:12
标题: [新手初级脚本问]循环问题循环工作效率
本人 用了 for i in 0..15 去处理 Bitmap中的 draw_text 感觉效率很慢
出现 卡 的现象
请问 for 循环处理效率怎样 有比他快些的循环处理吗》??
脚本 是
    for i in 0..@size - 1
      for s in 0..6
        # 刷新画面
      Graphics.update
        if s != 6
          self.contents.font.size = 26 - s
          self.contents.fill_rect(x, 0, 40, 32, Color.new( 0, 0, 0,0))
          self.contents.draw_text(x, 0, 40, 32, @text[i])
        else
          self.contents.font.size = 26 - s
          self.contents.draw_text(x, 0, 40, 32, @text[i])
        end
      end
      x += self.contents.text_size(@text[i]).width + 1
    end
作者: 66rpg学习    时间: 2009-9-14 17:25
提示: 作者被禁止或删除 内容自动屏蔽
作者: enter9009    时间: 2009-9-14 18:15
乱糟糟的,完全看不懂
作者: ONEWateR    时间: 2009-9-14 18:54
厄……我大概想知道你的SIZE的值和你想要的效果。
作者: Flyingpww    时间: 2009-9-14 21:37
首先,那个draw_text 本来就耗时间,你又加Graphics.update 肯定会慢不少!




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