Sha256: 51b838d10001874372bba8bf92ac89a9f5afef52a1f10af7b550ef812642ff83
Contents?: true
Size: 992 Bytes
Versions: 1
Compression:
Stored size: 992 Bytes
Contents
# Copyright (c) 2020 Jean-Sebastien Gelinas, see LICENSE.txt # frozen_string_literal: true # Class representing a TileSet's information class ::TilesetTooling::Data::Tile < ::Dry::Struct attribute :top, ::TilesetTooling::Data::Types::Integer attribute :left, ::TilesetTooling::Data::Types::Integer attribute :height, ::TilesetTooling::Data::Types::Integer attribute :width, ::TilesetTooling::Data::Types::Integer attribute :margin_top, ::TilesetTooling::Data::Types::Integer attribute :margin_left, ::TilesetTooling::Data::Types::Integer attribute :margin_bottom, ::TilesetTooling::Data::Types::Integer attribute :margin_right, ::TilesetTooling::Data::Types::Integer # Helper to print the information of the tile def to_s "#{top},#{left} [#{margin_top},#{margin_left},#{margin_bottom},#{margin_right}]" end # Helper to get the bottom coordinate def bottom top + height end # Helper to get the right coordinate def right left + width end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tileset_tooling-0.0.2 | lib/tileset_tooling/data/tile.rb |