class DXRuby::Tiled::TextObject
Attributes
text[RW]
Public Class Methods
create_from_hash(hash)
click to toggle source
# File lib/dxruby_tiled/object.rb, line 138 def self.create_from_hash(hash) self.new(hash[:x], hash[:y], hash[:width], hash[:height], hash[:text][:text], hash[:text]) end
new(x, y, width, height, text, options = {})
click to toggle source
Calls superclass method
DXRuby::Tiled::TMEObject::new
# File lib/dxruby_tiled/object.rb, line 142 def initialize(x, y, width, height, text, options = {}) options[:width] = width options[:height] = height super x, y, options @text = text @fontfamily = options[:fontfamily] || "" @pixelsize = options[:pixelsize] || 16 @wrap = !!options[:wrap] # unsupported @color = (options[:color] || "000000").sub("#", "").scan(/../).map{ |c| c.to_i(16) } @bold = !!options[:bold] @italic = !!options[:italic] @underline = !!options[:underline] # unsupported @strikeout = !!options[:strikeout] # unsupported @kerning = options[:kerning] != false # unsupported @halign = options[:halign] || "left" # unsupported @valign = options[:valign] || "top" # unsupported @font = DXRuby::Font.new(@pixelsize, @fontfamily, weight: @bold, italic: @italic, auto_fitting: true ) self.collision = [0, 0, @width, @height] end
Public Instance Methods
draw()
click to toggle source
# File lib/dxruby_tiled/object.rb, line 165 def draw self.target.draw_font(self.x, self.y, @text, @font, color: @color, center_x: 0, center_y: 0, angle: self.angle, z: self.z ) end