Sha256: 3948100e702b60d15dd83a873c1b8e1ee2d95a75657eca1d67cb82b739bd9c33
Contents?: true
Size: 1.87 KB
Versions: 2
Compression:
Stored size: 1.87 KB
Contents
class Systems class Render def self.run Components::Renderable.data.sort_by { |v| v[1].z }.each do |key, data| if !(Components::Sprite.id & Entity.signatures[key]).zero? $gtk.args.outputs.sprites << Components::Sprite.data[key].set elsif !(Components::Label.id & Entity.signatures[key]).zero? $gtk.args.outputs.labels << Components::Label.data[key].set elsif !(Components::Map.id & Entity.signatures[key]).zero? Components::Map.data[key].json['layers'].each do |layer| layer['chunks'].each do |chunk| chunk['data'].each_slice(chunk['width']).with_index do |row, row_index| row.each_with_index do |tile, column_index| unless tile.zero? iter = 0 loop do tile = Helper.get_tile(json_name: Components::Map.data[key].json['tilesets'][iter]['source'].split('/').last.delete('\\').delete_suffix('.tsx'), tile_index: tile) break if tile.is_a?(Hash) raise Exception.new "#{Components::Map.data[key].json['json_name']} not valid map, exceeded tile range" if (iter += 1) >= Components::Map.data[key].json['tilesets'].count end unless tile.empty? tile[:x] = Components::Map.data[key].x + (Components::Map.data[key].tilewidth * column_index) + chunk['x'] tile[:y] = Components::Map.data[key].y + (Components::Map.data[key].tileheight * row_index) + chunk['y'] tile[:w] = Components::Map.data[key].tilewidth tile[:h] = Components::Map.data[key].tileheight $gtk.args.outputs.sprites << tile end end end end end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
felflame-1.0.1 | deprecated/systems/99_render.rb |
felflame-1.0.0 | deprecated/systems/99_render.rb |