Text Appearing in Window Delayed

● ARCHIVED · READ-ONLY
Started by Rello 5 posts View original ↗
  1. Hey all,

    A friend and I compiled resources and made a Game Time Window, and it works rather swell. However, we are noticing that the text takes a bit longer to "appear" in the window (compared to everything else in the scene appearing nearly instantaneously). I was wondering if anybody would be able to point us (well, me at least) in the right direction as to what may be causing this?

    Any help is appreciated!

    Spoiler
    Code:
    #=#=========================================================================#=## #                                TIME WINDOW                              # ##=#=========================================================================#=#class Window_RAD_Time < Window_Base  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize    super(RAD_Menu::TIME_X, RAD_Menu::TIME_Y,RAD_Menu::TIME_WIDTH,RAD_Menu::TIME_HEIGHT)  end  #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def update    super    if @old_text != $game_system.playtime_s      @old_text = $game_system.playtime_s      refresh    end  end    def refresh        contents.clear #Clear contents        str = $game_system.playtime_s #Store playtime string in new string    offset_x = 30 #Offset from left to place playtime    offset_y = 12 #Offset from bottom to place playtime    space = 10 #Space between characters        grey = Color.new(255, 255, 255, 100) #Greyed out text color    normal = Color.new(255, 255, 255, 255) #Normal text color    self.contents.font.color = grey #Set text color to greyed out        i = 0 #Create index value for while loop    while i < str.length do       if str[i] != '0' and str[i] != ':'        self.contents.font.color = normal #If character is not 0 or : change color      end            draw_text(offset_x + (space * i) + 19, -offset_y-3, 140, 48, str[i], 0)      i += 1 #Increase index by 1    end    self.contents.draw_text(0,-7,140,32, RAD_Menu::VOCAB_TIME)  endend#=#=========================================================================#=## #                               /TIME WINDOW                              # ##=#=========================================================================#=# 
  2. Well, based from the help file itself, drawing text is a very consuming process. Updating texts every frame refresh would probably cause noticeable lag on slower computers
  3. It's not lagging- just takes a second to appear and runs smoothly.

    (And my computer is hardly slow)
  4. Ah.. then might be because it only starts drawing text during the next frame update since you didn't made the init method to call refresh or update


    though it shouldn't be delayed for a full second though
  5. *facepalm*

    Yeah, that did it. How did I forget refresh? Thanks for the help.