class Scene_TextScroll
def initialize(filename, scroll_speed = 4, transition_frames = 40)
@filename = filename
@scroll_speed = scroll_speed
@transtion_frames = transition_frames
@last_scene = $scene.class
end
def main
@textscroll_window = Window_TextScroll.new(@filename)
Graphics.transition(@transtion_frames)
loop do
Graphics.update
Input.update
@textscroll_window.y -= @scroll_speed
if @textscroll_window.y == 0 - @textscroll_window.height
break
end
end
Graphics.freeze
@textscroll_window.dispose
$scene = @last_scene.new
end
end
class Window_TextScroll < Window_Base
def initialize(filename)
file = "TextScroll/#{filename}"
lines = IO.readlines(file)
super(0, 480, 640, lines.size * 24 + 32)
self.contents = Bitmap.new(width - 32, height - 32)
for i in 0...lines.size
self.contents.draw_text(0, i * 24, 640, 24, lines[i], 1)
end
end
end