/examples/example24_enter_name.rb
Ruby | 21 lines | 17 code | 3 blank | 1 comment | 0 complexity | 8125d7a3273276772eba7d366d64fba9 MD5 | raw file
Possible License(s): LGPL-2.1
1#!/usr/bin/env ruby 2require 'rubygems' 3require File.join(File.dirname($0), "..", "lib", "chingu") 4include Gosu 5include Chingu 6 7class Game < Chingu::Window 8 def initialize 9 super(800,400,false) # leave it blank and it will be 800,600,non fullscreen 10 self.input = { :escape => :exit } # exits example on Escape 11 self.caption = "Demonstration of GameStates::EnterName" 12 push_game_state(GameStates::EnterName.new(:callback => method(:got_name))) 13 end 14 15 def got_name(name) 16 puts "Got name: #{name}" 17 exit 18 end 19end 20 21Game.new.show