class Window_Text < Window_Base
def initialize(x, y, var_id)
super(x, y, 120, 64)
self.contents = Bitmap.new(self.width-32,self.height-32)
self.opacity = 0
@var_id = var_id
@state = $game_variables[@var_id]
self.contents.draw_text(0,-16,self.width,self.height,@state.to_s)
end
def update
if @state != $game_variables[@var_id].to_s
if self.contents != nil
self.contents.clear
end
@state = $game_variables[@var_id]
self.contents = Bitmap.new(self.width-32,self.height-32)
self.contents.draw_text(0,-16,self.width,self.height,@state.to_s)
end
end
end
class Game_System
alias initlz_os_wind_text initialize
alias update_os_wind_text update
def initialize
@text_windows = []
initlz_os_wind_text
end
def update
i = 0
if @text_windows.length > 0
while i < @text_windows.length
@text_windows[i].update
i += 1
end
end
update_os_wind_text
end
def new_window(x, y, var_id)
@text_windows.push(Window_Text.new(x,y,var_id))
end
def dispose_a_window(index)
@text_windows[index].dispose
@text_windows.delete_at(index)
end
def dispose_all_windows
i = @text_windows.length - 1
while i >= 0
@text_windows[0].dispose
@text_windows.delete_at(0)
i -= 1
end
end
end