lib/cyberarm_engine/text.rb in cyberarm_engine-0.13.1 vs lib/cyberarm_engine/text.rb in cyberarm_engine-0.14.0
- old
+ new
@@ -7,11 +7,11 @@
def initialize(text, options={})
@text = text.to_s || ""
@options = options
@size = options[:size] || 18
- @font = options[:font] || "sans-serif"#Gosu.default_font_name
+ @font = options[:font] || Gosu.default_font_name
@x = options[:x] || 0
@y = options[:y] || 0
@z = options[:z] || 1025
@factor_x = options[:factor_x] || 1
@factor_y = options[:factor_y] || 1
@@ -96,15 +96,15 @@
def shadow_color=(n)
@rendered_shadow = nil
@shadow_color = n
end
- def width
- textobject.text_width(@text)
+ def width(text = @text)
+ textobject.text_width(text)
end
- def height
- @text.lines.count > 0 ? (@text.lines.count) * textobject.height : @textobject.height
+ def height(text = @text)
+ text.lines.count > 0 ? (text.lines.count) * textobject.height : @textobject.height
end
def draw
if @shadow && !ARGV.join.include?("--no-shadow")
shadow_alpha = @color.alpha <= 30 ? @color.alpha : @shadow_alpha