Sha256: 17251d4d9c8531661748d29685c805f83817e8b38eeb2a67a6f15311b17248f7
Contents?: true
Size: 877 Bytes
Versions: 1
Compression:
Stored size: 877 Bytes
Contents
# Ruby2D::Text module Ruby2D class Text include Renderable attr_reader :text, :size, :width, :height, :font, :color attr_accessor :x, :y, :rotate, :data def initialize(text, opts = {}) @x = opts[:x] || 0 @y = opts[:y] || 0 @z = opts[:z] || 0 @text = text.to_s @size = opts[:size] || 20 @rotate = opts[:rotate] || 0 @font = opts[:font] || Font.default unless RUBY_ENGINE == 'opal' unless File.exists? @font raise Error, "Cannot find font file `#{@font}`" end end self.color = opts[:color] || 'white' ext_init add end def text=(msg) @text = msg.to_s ext_set(@text) end def color=(c) @color = Color.new(c) end def contains?(x, y) @x < x and @x + @width > x and @y < y and @y + @height > y end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby2d-0.7.0 | lib/ruby2d/text.rb |