#==============================================================================
# ** Window_Status
#------------------------------------------------------------------------------
# Author Me™
# Version 1.0
#==============================================================================
class Window_Status < Window_Base
attr_reader :text
#--------------------------------------------------------------------------
# * Initializes window.
#--------------------------------------------------------------------------
def initialize(text,color=normal_color, x=172, y=70, width=240, heigth=72)
super(x, y, width, heigth)
self.contents = Bitmap.new(self.width-32, height-32)
self.contents.font.size = 16
self.opacity = 0
self.contents_opacity = 255
self.contents.font.color = color
@text = []
@fade = false
@text = text
@x = @y = 0
end
#--------------------------------------------------------------------------
# * Refreshes window.
#--------------------------------------------------------------------------
def refresh
if @text != nil and not @fade
text = @text
if ((c = text.slice!(/./m)) != nil)
# Draw text
self.contents.draw_text(@x, -2, 40, 32, c, 4)
# Add x to drawn text width
@x += self.contents.text_size(c).width
@text = text
if ((c = text.slice!(/./m)) != nil)
# Draw text
self.contents.draw_text(@x, -2, 40, 32, c, 4)
# Add x to drawn text width
@x += self.contents.text_size(c).width
@text = text
else
@text = nil
end
else
@text = nil
end
elsif @fade
self.contents_opacity -= 20
if self.contents_opacity <= 0
self.contents.clear
@fade = false
self.contents_opacity = 255
end
end
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super()
refresh
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def new_text(text,color=normal_color)
self.contents.font.color = color
@text = text
@x = @y = 0
@fade = true
refresh
end
end