Sha256: 1c5fa55ab68a9ac21b6bdc825b43a4af30f88660e32813d778d1bffce5dd3fda
Contents?: true
Size: 795 Bytes
Versions: 1
Compression:
Stored size: 795 Bytes
Contents
#!/usr/bin/env ruby LIB_PATH = File.join(File.dirname(__FILE__), '..', '..', 'lib', 'lotu.rb') require File.expand_path(LIB_PATH) include Gosu::Button class MovingRuby < Lotu::Actor def initialize(opts={}) super set_image 'CptnRuby Gem.png' set_keys(KbRight => :move_right, KbLeft => :move_left, KbUp => :move_up, KbDown => :move_down) end def move_right @x += 1 end def move_left @x -= 1 end def move_up @y -= 1 end def move_down @y += 1 end end class Example < Lotu::Window def initialize super set_keys(KbEscape => :close) with_path_from_file(__FILE__) do load_images '../media' end @ruby = MovingRuby.new(:x => width/2, :y => height/2) end end Example.new.show
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lotu-0.1.6 | examples/hello_world/hello_world.rb |