Class: Window_Base
- Inherits:
-
Window
- Object
- Window
- Window_Base
- Defined in:
- lib/rgss3_default_scripts/Window_Base.rb
Overview
** Window_Base
This is a super class of all windows within the game.
Direct Known Subclasses
Window_EquipStatus, Window_Gold, Window_Help, Window_MapName, Window_Message, Window_NameEdit, Window_NumberInput, Window_SaveFile, Window_ScrollText, Window_Selectable, Window_ShopStatus, Window_SkillStatus
Instance Method Summary collapse
-
#activate ⇒ Object
————————————————————————– * Activate Window ————————————————————————–.
-
#actor_name(n) ⇒ Object
————————————————————————– * Get Name of Actor Number n ————————————————————————–.
-
#calc_line_height(text, restore_font_size = true) ⇒ Object
————————————————————————– * Calculate Line Height restore_font_size : Return to original font size after calculating ————————————————————————–.
-
#change_color(color, enabled = true) ⇒ Object
————————————————————————– * Change Text Drawing Color enabled : Enabled flag.
-
#close ⇒ Object
————————————————————————– * Close Window ————————————————————————–.
-
#contents_height ⇒ Object
————————————————————————– * Calculate Height of Window Contents ————————————————————————–.
-
#contents_width ⇒ Object
————————————————————————– * Calculate Width of Window Contents ————————————————————————–.
-
#convert_escape_characters(text) ⇒ Object
————————————————————————– * Preconvert Control Characters As a rule, replace only what will be changed into text strings before starting actual drawing.
-
#create_contents ⇒ Object
————————————————————————– * Create Window Contents ————————————————————————–.
-
#crisis_color ⇒ Object
Crisis.
-
#deactivate ⇒ Object
————————————————————————– * Deactivate Window ————————————————————————–.
-
#dispose ⇒ Object
————————————————————————– * Free ————————————————————————–.
-
#draw_actor_class(actor, x, y, width = 112) ⇒ Object
————————————————————————– * Draw Class ————————————————————————–.
-
#draw_actor_face(actor, x, y, enabled = true) ⇒ Object
————————————————————————– * Draw Actor Face Graphic ————————————————————————–.
-
#draw_actor_graphic(actor, x, y) ⇒ Object
————————————————————————– * Draw Actor Walking Graphic ————————————————————————–.
-
#draw_actor_hp(actor, x, y, width = 124) ⇒ Object
————————————————————————– * Draw HP ————————————————————————–.
-
#draw_actor_icons(actor, x, y, width = 96) ⇒ Object
————————————————————————– * Draw State and Buff/Debuff Icons ————————————————————————–.
-
#draw_actor_level(actor, x, y) ⇒ Object
————————————————————————– * Draw Level ————————————————————————–.
-
#draw_actor_mp(actor, x, y, width = 124) ⇒ Object
————————————————————————– * Draw MP ————————————————————————–.
-
#draw_actor_name(actor, x, y, width = 112) ⇒ Object
————————————————————————– * Draw Name ————————————————————————–.
-
#draw_actor_nickname(actor, x, y, width = 180) ⇒ Object
————————————————————————– * Draw Nickname ————————————————————————–.
-
#draw_actor_param(actor, x, y, param_id) ⇒ Object
————————————————————————– * Draw Parameters ————————————————————————–.
-
#draw_actor_simple_status(actor, x, y) ⇒ Object
————————————————————————– * Draw Simple Status ————————————————————————–.
-
#draw_actor_tp(actor, x, y, width = 124) ⇒ Object
————————————————————————– * Draw TP ————————————————————————–.
-
#draw_character(character_name, character_index, x, y) ⇒ Object
————————————————————————– * Draw Character Graphic ————————————————————————–.
-
#draw_currency_value(value, unit, x, y, width) ⇒ Object
————————————————————————– * Draw Number (Gold Etc.) with Currency Unit ————————————————————————–.
-
#draw_current_and_max_values(x, y, width, current, max, color1, color2) ⇒ Object
————————————————————————– * Draw Current Value/Maximum Value in Fractional Format current : Current value max : Maximum value color1 : Color of current value color2 : Color of maximum value ————————————————————————–.
-
#draw_face(face_name, face_index, x, y, enabled = true) ⇒ Object
————————————————————————– * Draw Face Graphic enabled : Enabled flag.
-
#draw_gauge(x, y, width, rate, color1, color2) ⇒ Object
————————————————————————– * Draw Gauge rate : Rate (full at 1.0) color1 : Left side gradation color2 : Right side gradation ————————————————————————–.
-
#draw_icon(icon_index, x, y, enabled = true) ⇒ Object
————————————————————————– * Draw Icon enabled : Enabled flag.
-
#draw_item_name(item, x, y, enabled = true, width = 172) ⇒ Object
————————————————————————– * Draw Item Name enabled : Enabled flag.
-
#draw_text(*args) ⇒ Object
————————————————————————– * Draw Text args : Same as Bitmap#draw_text.
-
#draw_text_ex(x, y, text) ⇒ Object
————————————————————————– * Draw Text with Control Characters ————————————————————————–.
-
#fitting_height(line_number) ⇒ Object
————————————————————————– * Calculate Height of Window Suited to Specified Number of Lines ————————————————————————–.
-
#gauge_back_color ⇒ Object
Gauge background.
-
#hide ⇒ Object
————————————————————————– * Hide Window ————————————————————————–.
-
#hp_color(actor) ⇒ Object
————————————————————————– * Get HP Text Color ————————————————————————–.
-
#hp_gauge_color1 ⇒ Object
HP gauge 1.
-
#hp_gauge_color2 ⇒ Object
HP gauge 2.
-
#initialize(x, y, width, height) ⇒ Window_Base
constructor
————————————————————————– * Object Initialization ————————————————————————–.
-
#knockout_color ⇒ Object
Knock out.
-
#line_height ⇒ Object
————————————————————————– * Get Line Height ————————————————————————–.
-
#make_font_bigger ⇒ Object
————————————————————————– * Increase Font Size ————————————————————————–.
-
#make_font_smaller ⇒ Object
————————————————————————– * Decrease Font Size ————————————————————————–.
-
#mp_color(actor) ⇒ Object
————————————————————————– * Get MP Text Color ————————————————————————–.
-
#mp_cost_color ⇒ Object
TP cost.
-
#mp_gauge_color1 ⇒ Object
MP gauge 1.
-
#mp_gauge_color2 ⇒ Object
MP gauge 2.
-
#normal_color ⇒ Object
————————————————————————– * Get Text Colors ————————————————————————–.
-
#obtain_escape_code(text) ⇒ Object
————————————————————————– * Destructively Get Control Code ————————————————————————–.
-
#obtain_escape_param(text) ⇒ Object
————————————————————————– * Destructively Get Control Code Argument ————————————————————————–.
-
#open ⇒ Object
————————————————————————– * Open Window ————————————————————————–.
-
#param_change_color(change) ⇒ Object
————————————————————————– * Get Parameter Change Color ————————————————————————–.
-
#party_member_name(n) ⇒ Object
————————————————————————– * Get Name of Party Member n ————————————————————————–.
-
#pending_color ⇒ Object
————————————————————————– * Get Background Color of Pending Item ————————————————————————–.
-
#power_down_color ⇒ Object
Equipment power down.
-
#power_up_color ⇒ Object
Equipment power up.
-
#process_character(c, text, pos) ⇒ Object
————————————————————————– * Character Processing c : Characters text : A character string buffer in drawing processing (destructive) pos : Draw position :y, :new_x, :height ————————————————————————–.
-
#process_draw_icon(icon_index, pos) ⇒ Object
————————————————————————– * Icon Drawing Process by Control Characters ————————————————————————–.
-
#process_escape_character(code, text, pos) ⇒ Object
————————————————————————– * Control Character Processing code : the core of the control character e.g.
-
#process_new_line(text, pos) ⇒ Object
————————————————————————– * New Line Character Processing ————————————————————————–.
-
#process_new_page(text, pos) ⇒ Object
————————————————————————– * New Page Character Processing ————————————————————————–.
-
#process_normal_character(c, pos) ⇒ Object
————————————————————————– * Normal Character Processing ————————————————————————–.
-
#reset_font_settings ⇒ Object
————————————————————————– * Reset Font Settings ————————————————————————–.
-
#show ⇒ Object
————————————————————————– * Show Window ————————————————————————–.
-
#standard_padding ⇒ Object
————————————————————————– * Get Standard Padding Size ————————————————————————–.
-
#system_color ⇒ Object
System.
-
#text_color(n) ⇒ Object
————————————————————————– * Get Text Color n : Text color number (0..31) ————————————————————————–.
-
#text_size(str) ⇒ Object
————————————————————————– * Get Text Size ————————————————————————–.
-
#tp_color(actor) ⇒ Object
————————————————————————– * Get TP Text Color ————————————————————————–.
-
#tp_cost_color ⇒ Object
TP cost.
-
#tp_gauge_color1 ⇒ Object
TP gauge 1.
-
#tp_gauge_color2 ⇒ Object
TP gauge 2.
-
#translucent_alpha ⇒ Object
————————————————————————– * Get Alpha Value of Translucent Drawing ————————————————————————–.
-
#update ⇒ Object
————————————————————————– * Frame Update ————————————————————————–.
-
#update_close ⇒ Object
————————————————————————– * Update Close Processing ————————————————————————–.
-
#update_open ⇒ Object
————————————————————————– * Update Open Processing ————————————————————————–.
-
#update_padding ⇒ Object
————————————————————————– * Update Padding ————————————————————————–.
-
#update_tone ⇒ Object
————————————————————————– * Update Tone ————————————————————————–.
Constructor Details
#initialize(x, y, width, height) ⇒ Window_Base
-
Object Initialization
11 12 13 14 15 16 17 18 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 11 def initialize(x, y, width, height) super self.windowskin = Cache.system("Window") update_padding update_tone create_contents @opening = @closing = false end |
Instance Method Details
#activate ⇒ Object
-
Activate Window
135 136 137 138 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 135 def activate self.active = true self end |
#actor_name(n) ⇒ Object
-
Get Name of Actor Number n
242 243 244 245 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 242 def actor_name(n) actor = n >= 1 ? $game_actors[n] : nil actor ? actor.name : "" end |
#calc_line_height(text, restore_font_size = true) ⇒ Object
-
Calculate Line Height
restore_font_size : Return to original font size after calculating
344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 344 def calc_line_height(text, restore_font_size = true) result = [line_height, contents.font.size].max last_font_size = contents.font.size text.slice(/^.*$/).scan(/\e[\{\}]/).each do |esc| make_font_bigger if esc == "\e{" make_font_smaller if esc == "\e}" result = [result, contents.font.size].max end contents.font.size = last_font_size if restore_font_size result end |
#change_color(color, enabled = true) ⇒ Object
-
Change Text Drawing Color
enabled : Enabled flag. When false, draw semi-transparently.
187 188 189 190 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 187 def change_color(color, enabled = true) contents.font.color.set(color) contents.font.color.alpha = translucent_alpha unless enabled end |
#close ⇒ Object
-
Close Window
113 114 115 116 117 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 113 def close @closing = true unless close? @opening = false self end |
#contents_height ⇒ Object
-
Calculate Height of Window Contents
53 54 55 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 53 def contents_height height - standard_padding * 2 end |
#contents_width ⇒ Object
-
Calculate Width of Window Contents
47 48 49 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 47 def contents_width width - standard_padding * 2 end |
#convert_escape_characters(text) ⇒ Object
-
Preconvert Control Characters
As a rule, replace only what will be changed into text strings before starting actual drawing. The character "\" is replaced with the escape character (\e).
228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 228 def convert_escape_characters(text) result = text.to_s.clone result.gsub!(/\\/) { "\e" } result.gsub!(/\e\e/) { "\\" } result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] } result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] } result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) } result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) } result.gsub!(/\eG/i) { Vocab::currency_unit } result end |
#create_contents ⇒ Object
-
Create Window Contents
71 72 73 74 75 76 77 78 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 71 def create_contents contents.dispose if contents_width > 0 && contents_height > 0 self.contents = Bitmap.new(contents_width, contents_height) else self.contents = Bitmap.new(1, 1) end end |
#crisis_color ⇒ Object
Crisis
158 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 158 def crisis_color; text_color(17); end |
#deactivate ⇒ Object
-
Deactivate Window
142 143 144 145 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 142 def deactivate self.active = false self end |
#dispose ⇒ Object
-
Free
22 23 24 25 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 22 def dispose contents.dispose unless disposed? super end |
#draw_actor_class(actor, x, y, width = 112) ⇒ Object
-
Draw Class
447 448 449 450 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 447 def draw_actor_class(actor, x, y, width = 112) change_color(normal_color) draw_text(x, y, width, line_height, actor.class.name) end |
#draw_actor_face(actor, x, y, enabled = true) ⇒ Object
-
Draw Actor Face Graphic
434 435 436 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 434 def draw_actor_face(actor, x, y, enabled = true) draw_face(actor.face_name, actor.face_index, x, y, enabled) end |
#draw_actor_graphic(actor, x, y) ⇒ Object
-
Draw Actor Walking Graphic
428 429 430 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 428 def draw_actor_graphic(actor, x, y) draw_character(actor.character_name, actor.character_index, x, y) end |
#draw_actor_hp(actor, x, y, width = 124) ⇒ Object
-
Draw HP
496 497 498 499 500 501 502 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 496 def draw_actor_hp(actor, x, y, width = 124) draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2) change_color(system_color) draw_text(x, y, 30, line_height, Vocab::hp_a) draw_current_and_max_values(x, y, width, actor.hp, actor.mhp, hp_color(actor), normal_color) end |
#draw_actor_icons(actor, x, y, width = 96) ⇒ Object
-
Draw State and Buff/Debuff Icons
470 471 472 473 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 470 def draw_actor_icons(actor, x, y, width = 96) icons = (actor.state_icons + actor.buff_icons)[0, width / 24] icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, y) } end |
#draw_actor_level(actor, x, y) ⇒ Object
-
Draw Level
461 462 463 464 465 466 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 461 def draw_actor_level(actor, x, y) change_color(system_color) draw_text(x, y, 32, line_height, Vocab::level_a) change_color(normal_color) draw_text(x + 32, y, 24, line_height, actor.level, 2) end |
#draw_actor_mp(actor, x, y, width = 124) ⇒ Object
-
Draw MP
506 507 508 509 510 511 512 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 506 def draw_actor_mp(actor, x, y, width = 124) draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2) change_color(system_color) draw_text(x, y, 30, line_height, Vocab::mp_a) draw_current_and_max_values(x, y, width, actor.mp, actor.mmp, mp_color(actor), normal_color) end |
#draw_actor_name(actor, x, y, width = 112) ⇒ Object
-
Draw Name
440 441 442 443 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 440 def draw_actor_name(actor, x, y, width = 112) change_color(hp_color(actor)) draw_text(x, y, width, line_height, actor.name) end |
#draw_actor_nickname(actor, x, y, width = 180) ⇒ Object
-
Draw Nickname
454 455 456 457 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 454 def draw_actor_nickname(actor, x, y, width = 180) change_color(normal_color) draw_text(x, y, width, line_height, actor.nickname) end |
#draw_actor_param(actor, x, y, param_id) ⇒ Object
-
Draw Parameters
537 538 539 540 541 542 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 537 def draw_actor_param(actor, x, y, param_id) change_color(system_color) draw_text(x, y, 120, line_height, Vocab::param(param_id)) change_color(normal_color) draw_text(x + 120, y, 36, line_height, actor.param(param_id), 2) end |
#draw_actor_simple_status(actor, x, y) ⇒ Object
-
Draw Simple Status
526 527 528 529 530 531 532 533 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 526 def draw_actor_simple_status(actor, x, y) draw_actor_name(actor, x, y) draw_actor_level(actor, x, y + line_height * 1) draw_actor_icons(actor, x, y + line_height * 2) draw_actor_class(actor, x + 120, y) draw_actor_hp(actor, x + 120, y + line_height * 1) draw_actor_mp(actor, x + 120, y + line_height * 2) end |
#draw_actor_tp(actor, x, y, width = 124) ⇒ Object
-
Draw TP
516 517 518 519 520 521 522 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 516 def draw_actor_tp(actor, x, y, width = 124) draw_gauge(x, y, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2) change_color(system_color) draw_text(x, y, 30, line_height, Vocab::tp_a) change_color(tp_color(actor)) draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2) end |
#draw_character(character_name, character_index, x, y) ⇒ Object
-
Draw Character Graphic
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 389 def draw_character(character_name, character_index, x, y) return unless character_name bitmap = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign && sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end n = character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) contents.blt(x - cw / 2, y - ch, bitmap, src_rect) end |
#draw_currency_value(value, unit, x, y, width) ⇒ Object
-
Draw Number (Gold Etc.) with Currency Unit
556 557 558 559 560 561 562 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 556 def draw_currency_value(value, unit, x, y, width) cx = text_size(unit).width change_color(normal_color) draw_text(x, y, width - cx - 2, line_height, value, 2) change_color(system_color) draw_text(x, y, width, line_height, unit, 2) end |
#draw_current_and_max_values(x, y, width, current, max, color1, color2) ⇒ Object
-
Draw Current Value/Maximum Value in Fractional Format
current : Current value max : Maximum value color1 : Color of current value color2 : Color of maximum value
481 482 483 484 485 486 487 488 489 490 491 492 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 481 def draw_current_and_max_values(x, y, width, current, max, color1, color2) change_color(color1) xr = x + width if width < 96 draw_text(xr - 40, y, 42, line_height, current, 2) else draw_text(xr - 92, y, 42, line_height, current, 2) change_color(color2) draw_text(xr - 52, y, 12, line_height, "/", 2) draw_text(xr - 42, y, 42, line_height, max, 2) end end |
#draw_face(face_name, face_index, x, y, enabled = true) ⇒ Object
-
Draw Face Graphic
enabled : Enabled flag. When false, draw semi-transparently.
380 381 382 383 384 385 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 380 def draw_face(face_name, face_index, x, y, enabled = true) bitmap = Cache.face(face_name) rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96) contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha) bitmap.dispose end |
#draw_gauge(x, y, width, rate, color1, color2) ⇒ Object
-
Draw Gauge
rate : Rate (full at 1.0) color1 : Left side gradation color2 : Right side gradation
361 362 363 364 365 366 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 361 def draw_gauge(x, y, width, rate, color1, color2) fill_w = (width * rate).to_i gauge_y = y + line_height - 8 contents.fill_rect(x, gauge_y, width, 6, gauge_back_color) contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2) end |
#draw_icon(icon_index, x, y, enabled = true) ⇒ Object
-
Draw Icon
enabled : Enabled flag. When false, draw semi-transparently.
371 372 373 374 375 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 371 def draw_icon(icon_index, x, y, enabled = true) bitmap = Cache.system("Iconset") rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha) end |
#draw_item_name(item, x, y, enabled = true, width = 172) ⇒ Object
-
Draw Item Name
enabled : Enabled flag. When false, draw semi-transparently.
547 548 549 550 551 552 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 547 def draw_item_name(item, x, y, enabled = true, width = 172) return unless item draw_icon(item.icon_index, x, y, enabled) change_color(normal_color, enabled) draw_text(x + 24, y, width, line_height, item.name) end |
#draw_text(*args) ⇒ Object
-
Draw Text
args : Same as Bitmap#draw_text.
195 196 197 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 195 def draw_text(*args) contents.draw_text(*args) end |
#draw_text_ex(x, y, text) ⇒ Object
-
Draw Text with Control Characters
207 208 209 210 211 212 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 207 def draw_text_ex(x, y, text) reset_font_settings text = convert_escape_characters(text) pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)} process_character(text.slice!(0, 1), text, pos) until text.empty? end |
#fitting_height(line_number) ⇒ Object
-
Calculate Height of Window Suited to Specified Number of Lines
59 60 61 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 59 def fitting_height(line_number) line_number * line_height + standard_padding * 2 end |
#gauge_back_color ⇒ Object
Gauge background
160 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 160 def gauge_back_color; text_color(19); end |
#hide ⇒ Object
-
Hide Window
128 129 130 131 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 128 def hide self.visible = false self end |
#hp_color(actor) ⇒ Object
-
Get HP Text Color
407 408 409 410 411 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 407 def hp_color(actor) return knockout_color if actor.hp == 0 return crisis_color if actor.hp < actor.mhp / 4 return normal_color end |
#hp_gauge_color1 ⇒ Object
HP gauge 1
161 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 161 def hp_gauge_color1; text_color(20); end |
#hp_gauge_color2 ⇒ Object
HP gauge 2
162 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 162 def hp_gauge_color2; text_color(21); end |
#knockout_color ⇒ Object
Knock out
159 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 159 def knockout_color; text_color(18); end |
#line_height ⇒ Object
-
Get Line Height
29 30 31 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 29 def line_height return 24 end |
#make_font_bigger ⇒ Object
-
Increase Font Size
331 332 333 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 331 def make_font_bigger contents.font.size += 8 if contents.font.size <= 64 end |
#make_font_smaller ⇒ Object
-
Decrease Font Size
337 338 339 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 337 def make_font_smaller contents.font.size -= 8 if contents.font.size >= 16 end |
#mp_color(actor) ⇒ Object
-
Get MP Text Color
415 416 417 418 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 415 def mp_color(actor) return crisis_color if actor.mp < actor.mmp / 4 return normal_color end |
#mp_cost_color ⇒ Object
TP cost
165 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 165 def mp_cost_color; text_color(23); end |
#mp_gauge_color1 ⇒ Object
MP gauge 1
163 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 163 def mp_gauge_color1; text_color(22); end |
#mp_gauge_color2 ⇒ Object
MP gauge 2
164 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 164 def mp_gauge_color2; text_color(23); end |
#normal_color ⇒ Object
-
Get Text Colors
156 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 156 def normal_color; text_color(0); end |
#obtain_escape_code(text) ⇒ Object
-
Destructively Get Control Code
295 296 297 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 295 def obtain_escape_code(text) text.slice!(/^[\$\.\|\^!><\{\}\\]|^[A-Z]+/i) end |
#obtain_escape_param(text) ⇒ Object
-
Destructively Get Control Code Argument
301 302 303 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 301 def obtain_escape_param(text) text.slice!(/^\[\d+\]/)[/\d+/].to_i rescue 0 end |
#open ⇒ Object
-
Open Window
105 106 107 108 109 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 105 def open @opening = true unless open? @closing = false self end |
#param_change_color(change) ⇒ Object
-
Get Parameter Change Color
566 567 568 569 570 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 566 def param_change_color(change) return power_up_color if change > 0 return power_down_color if change < 0 return normal_color end |
#party_member_name(n) ⇒ Object
-
Get Name of Party Member n
249 250 251 252 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 249 def party_member_name(n) actor = n >= 1 ? $game_party.members[n - 1] : nil actor ? actor.name : "" end |
#pending_color ⇒ Object
-
Get Background Color of Pending Item
174 175 176 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 174 def pending_color windowskin.get_pixel(80, 80) end |
#power_down_color ⇒ Object
Equipment power down
167 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 167 def power_down_color; text_color(25); end |
#power_up_color ⇒ Object
Equipment power up
166 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 166 def power_up_color; text_color(24); end |
#process_character(c, text, pos) ⇒ Object
-
Character Processing
c : Characters text : A character string buffer in drawing processing (destructive) pos : Draw position {:x, :y, :new_x, :height}
259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 259 def process_character(c, text, pos) case c when "\n" # New line process_new_line(text, pos) when "\f" # New page process_new_page(text, pos) when "\e" # Control character process_escape_character(obtain_escape_code(text), text, pos) else # Normal character process_normal_character(c, pos) end end |
#process_draw_icon(icon_index, pos) ⇒ Object
-
Icon Drawing Process by Control Characters
324 325 326 327 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 324 def process_draw_icon(icon_index, pos) draw_icon(icon_index, pos[:x], pos[:y]) pos[:x] += 24 end |
#process_escape_character(code, text, pos) ⇒ Object
-
Control Character Processing
code : the core of the control character e.g. "C" in the case of the control character \C[1].
309 310 311 312 313 314 315 316 317 318 319 320 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 309 def process_escape_character(code, text, pos) case code.upcase when 'C' change_color(text_color(obtain_escape_param(text))) when 'I' process_draw_icon(obtain_escape_param(text), pos) when '{' make_font_bigger when '}' make_font_smaller end end |
#process_new_line(text, pos) ⇒ Object
-
New Line Character Processing
282 283 284 285 286 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 282 def process_new_line(text, pos) pos[:x] = pos[:new_x] pos[:y] += pos[:height] pos[:height] = calc_line_height(text) end |
#process_new_page(text, pos) ⇒ Object
-
New Page Character Processing
290 291 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 290 def process_new_page(text, pos) end |
#process_normal_character(c, pos) ⇒ Object
-
Normal Character Processing
274 275 276 277 278 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 274 def process_normal_character(c, pos) text_width = text_size(c).width draw_text(pos[:x], pos[:y], text_width * 2, pos[:height], c) pos[:x] += text_width end |
#reset_font_settings ⇒ Object
-
Reset Font Settings
216 217 218 219 220 221 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 216 def reset_font_settings change_color(normal_color) contents.font.size = Font.default_size contents.font.bold = Font.default_bold contents.font.italic = Font.default_italic end |
#show ⇒ Object
-
Show Window
121 122 123 124 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 121 def show self.visible = true self end |
#standard_padding ⇒ Object
-
Get Standard Padding Size
35 36 37 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 35 def standard_padding return 12 end |
#system_color ⇒ Object
System
157 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 157 def system_color; text_color(16); end |
#text_color(n) ⇒ Object
-
Get Text Color
n : Text color number (0..31)
150 151 152 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 150 def text_color(n) windowskin.get_pixel(64 + (n % 8) * 8, 96 + (n / 8) * 8) end |
#text_size(str) ⇒ Object
-
Get Text Size
201 202 203 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 201 def text_size(str) contents.text_size(str) end |
#tp_color(actor) ⇒ Object
-
Get TP Text Color
422 423 424 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 422 def tp_color(actor) return normal_color end |
#tp_cost_color ⇒ Object
TP cost
170 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 170 def tp_cost_color; text_color(29); end |
#tp_gauge_color1 ⇒ Object
TP gauge 1
168 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 168 def tp_gauge_color1; text_color(28); end |
#tp_gauge_color2 ⇒ Object
TP gauge 2
169 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 169 def tp_gauge_color2; text_color(29); end |
#translucent_alpha ⇒ Object
-
Get Alpha Value of Translucent Drawing
180 181 182 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 180 def translucent_alpha return 160 end |
#update ⇒ Object
-
Frame Update
82 83 84 85 86 87 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 82 def update super update_tone update_open if @opening update_close if @closing end |
#update_close ⇒ Object
-
Update Close Processing
98 99 100 101 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 98 def update_close self.openness -= 48 @closing = false if close? end |
#update_open ⇒ Object
-
Update Open Processing
91 92 93 94 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 91 def update_open self.openness += 48 @opening = false if open? end |
#update_padding ⇒ Object
-
Update Padding
41 42 43 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 41 def update_padding self.padding = standard_padding end |
#update_tone ⇒ Object
-
Update Tone
65 66 67 |
# File 'lib/rgss3_default_scripts/Window_Base.rb', line 65 def update_tone self.tone.set($game_system.window_tone) end |