begin # In case you use Gosu via RubyGems. require 'rubygems' rescue LoadError # In case you don't. end #Load Gosu require "gosu" #Load GGLib require "../gglib" #Load extra widgets (for ThemeButton) require "../ext/widgets" class FadeExample < GGLib::GUIWindow def initialize super(640, 480, false, 20) self.caption = "GGLib Tutorial" self.state = StartMenu.new end end #The menu we will fade from class StartMenu < GGLib::StateObject def onStart $window.setBackground("img/splash.png") GGLib::ThemeButton.new("button1", "Fade", 270, 200, Proc.new{ |widget| $window.state = GGLib::FadeScreen.new(EndMenu.new, 2) }) end end #The menu we will fade to class EndMenu < GGLib::StateObject def onStart $window.setBackground("img/bg.png") GGLib::ThemeButton.new("button1", "Fade Back", 270, 200, Proc.new{ |widget| $window.state = GGLib::FadeScreen.new(StartMenu.new, 2) }) end end #Launch the window FadeExample.new.show