mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 05:02:34 +00:00
Added to_h (to hash) method to Vector, Text now tries to convert given text to string instead of assuming it is a string
This commit is contained in:
@@ -160,5 +160,9 @@ module CyberarmEngine
|
||||
def to_s
|
||||
"X: #{@x}, Y: #{@y}, Z: #{@z}, Weight: #{@weight}"
|
||||
end
|
||||
|
||||
def to_h
|
||||
{x: @x, y: @y, z: @z, weight: @weight}
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -6,7 +6,7 @@ module CyberarmEngine
|
||||
attr_reader :text, :textobject
|
||||
|
||||
def initialize(text, options={})
|
||||
@text = text || ""
|
||||
@text = text.to_s || ""
|
||||
@options = options
|
||||
@size = options[:size] || 18
|
||||
@font = options[:font] || "sans-serif"#Gosu.default_font_name
|
||||
|
||||
Reference in New Issue
Block a user