Sha256: 26d2405f350779001bdae5f2ef9d019890219594faabe4d808b741ca84410077
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
# -*- coding: utf-8 -*- require 'reflex/native' require 'reflex/bounds' require 'reflex/helpers' require 'rays/painter' module Reflex class Window include Hookable include Setter attr_reader :painter def initialize (opts = {}, &block) @painter = Rays::Painter.new.canvas 0, 0, 1, 1 opts.each {|key, value| set key.intern, *value} instance_eval &block if block end def paint () @painter.begin yield @painter if block_given? @painter.end end def bounds (*args) b = Bounds.new *get_bounds b.offset_to! *args unless args.empty? b end def bounds= (*args) case args[0] when Bounds set_bounds *args[0].to_a when Point set_bounds *args.map{|p| p.to_a}.flatten when Array set_bounds *args[0] when Integer, Float set_bounds *args end end def draw () paint end alias org_resized resized def resized (width, height) @painter.canvas 0, 0, width, height org_resized width, height end end# Window end# Reflex
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reflexion-0.1.3 | lib/reflex/window.rb |
reflexion-0.1.2 | lib/reflex/window.rb |
reflexion-0.1.1 | lib/reflex/window.rb |