Sha256: 97456fbbea1a1554698bbef037f43216dc7260ace906b466cb4f2cc4b3b19da3
Contents?: true
Size: 995 Bytes
Versions: 4
Compression:
Stored size: 995 Bytes
Contents
# -*- coding: utf-8 -*- $:.unshift File.expand_path(File.dirname(__FILE__) + "/../../lib") $:.unshift File.expand_path(File.dirname(__FILE__) + "/../../ext") require 'ray' Ray.game "all events", :resizable => true do register { add_hook :quit, method(:exit!) } scene :main do [ :quit, :focus_gain, :focus_loss, :mouse_entered, :mouse_left, :mouse_motion, :wheel_motion, :mouse_press, :mouse_release, :key_press, :key_release, :window_resize, :text_entered ].each do |name| name_array = [name] on name do |*args| puts "received event: #{(name_array + args).inspect}" end end on :window_resize do window.view = window.default_view end on :text_entered do |text| puts Ray::TextHelper.convert(text) end @obj = Ray::Polygon.rectangle [50, 100, 100, 50], Ray::Color.red render do window.clear Ray::Color.green window.draw @obj end end scenes << :main end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ray-0.2.1 | samples/window/all_events.rb |
ray-0.2.0 | samples/window/all_events.rb |
ray-0.1.1 | samples/window/all_events.rb |
ray-0.1.0 | samples/window/all_events.rb |