module DXRuby::Tiled
Constants
- VERSION
Public Instance Methods
load(file, encoding = Encoding::UTF_8, dir = nil)
click to toggle source
# File lib/dxruby_tiled.rb, line 26 def load(file, encoding = Encoding::UTF_8, dir = nil) case File.extname(file) when ".tmx", ".xml" TMXLoader.load_tmx(file, encoding, dir) else load_json(file, encoding, dir) end end
load_json(jsonfile, encoding = Encoding::UTF_8, dir = nil)
click to toggle source
# File lib/dxruby_tiled.rb, line 39 def load_json(jsonfile, encoding = Encoding::UTF_8, dir = nil) Map.new(read_jsonfile(jsonfile, encoding), dir || File.dirname(jsonfile)) end
read_file(file, encoding = Encoding::UTF_8)
click to toggle source
# File lib/dxruby_tiled.rb, line 35 def read_file(file, encoding = Encoding::UTF_8) File.read(file, encoding: encoding) end
read_jsonfile(jsonfile, encoding = Encoding::UTF_8)
click to toggle source
# File lib/dxruby_tiled.rb, line 43 def read_jsonfile(jsonfile, encoding = Encoding::UTF_8) JSON.parse( read_file(jsonfile, encoding), symbolize_names: true, create_additions: false ) end