Class: Window_ScrollText

Inherits:
Window_Base show all
Defined in:
lib/rgss3_default_scripts/Window_ScrollText.rb

Overview

** Window_ScrollText


This window is for displaying scrolling text. No frame is displayed, but it

is handled as a window for convenience.

Instance Method Summary collapse

Methods inherited from Window_Base

#activate, #actor_name, #calc_line_height, #change_color, #close, #contents_width, #convert_escape_characters, #create_contents, #crisis_color, #deactivate, #dispose, #draw_actor_class, #draw_actor_face, #draw_actor_graphic, #draw_actor_hp, #draw_actor_icons, #draw_actor_level, #draw_actor_mp, #draw_actor_name, #draw_actor_nickname, #draw_actor_param, #draw_actor_simple_status, #draw_actor_tp, #draw_character, #draw_currency_value, #draw_current_and_max_values, #draw_face, #draw_gauge, #draw_icon, #draw_item_name, #draw_text, #draw_text_ex, #fitting_height, #gauge_back_color, #hide, #hp_color, #hp_gauge_color1, #hp_gauge_color2, #knockout_color, #line_height, #make_font_bigger, #make_font_smaller, #mp_color, #mp_cost_color, #mp_gauge_color1, #mp_gauge_color2, #normal_color, #obtain_escape_code, #obtain_escape_param, #open, #param_change_color, #party_member_name, #pending_color, #power_down_color, #power_up_color, #process_character, #process_draw_icon, #process_escape_character, #process_new_line, #process_new_page, #process_normal_character, #reset_font_settings, #show, #standard_padding, #system_color, #text_color, #text_size, #tp_color, #tp_cost_color, #tp_gauge_color1, #tp_gauge_color2, #translucent_alpha, #update_close, #update_open, #update_padding, #update_tone

Constructor Details

#initializeWindow_ScrollText


  • Object Initialization




12
13
14
15
16
17
# File 'lib/rgss3_default_scripts/Window_ScrollText.rb', line 12

def initialize
  super(0, 0, Graphics.width, Graphics.height)
  self.opacity = 0
  self.arrows_visible = false
  hide
end

Instance Method Details

#contents_heightObject


  • Calculate Height of Window Contents




59
60
61
# File 'lib/rgss3_default_scripts/Window_ScrollText.rb', line 59

def contents_height
  @all_text_height ? @all_text_height : super
end

#refreshObject


  • Refresh




39
40
41
42
43
44
45
# File 'lib/rgss3_default_scripts/Window_ScrollText.rb', line 39

def refresh
  reset_font_settings
  update_all_text_height
  create_contents
  draw_text_ex(4, 0, @text)
  self.oy = @scroll_pos = -height
end

#scroll_speedObject


  • Get Scroll Speed




73
74
75
# File 'lib/rgss3_default_scripts/Window_ScrollText.rb', line 73

def scroll_speed
  $game_message.scroll_speed * (show_fast? ? 1.0 : 0.5)
end

#show_fast?Boolean


  • Determine if Fast Forward


Returns:

  • (Boolean)


79
80
81
# File 'lib/rgss3_default_scripts/Window_ScrollText.rb', line 79

def show_fast?
  !$game_message.scroll_no_fast && (Input.press?(:A) || Input.press?(:C))
end

#start_messageObject


  • Start Message




31
32
33
34
35
# File 'lib/rgss3_default_scripts/Window_ScrollText.rb', line 31

def start_message
  @text = $game_message.all_text
  refresh
  show
end

#terminate_messageObject


  • End Message




85
86
87
88
89
# File 'lib/rgss3_default_scripts/Window_ScrollText.rb', line 85

def terminate_message
  @text = nil
  $game_message.clear
  hide
end

#updateObject


  • Frame Update




21
22
23
24
25
26
27
# File 'lib/rgss3_default_scripts/Window_ScrollText.rb', line 21

def update
  super
  if $game_message.scroll_mode
    update_message if @text
    start_message if !@text && $game_message.has_text?
  end
end

#update_all_text_heightObject


  • Update Height Needed to Draw All Text




49
50
51
52
53
54
55
# File 'lib/rgss3_default_scripts/Window_ScrollText.rb', line 49

def update_all_text_height
  @all_text_height = 1
  convert_escape_characters(@text).each_line do |line|
    @all_text_height += calc_line_height(line, false)
  end
  reset_font_settings
end

#update_messageObject


  • Update Message




65
66
67
68
69
# File 'lib/rgss3_default_scripts/Window_ScrollText.rb', line 65

def update_message
  @scroll_pos += scroll_speed
  self.oy = @scroll_pos
  terminate_message if @scroll_pos >= contents.height
end