From fe1d0192b97dacf282e8fd60a1edd0db10b57b1d Mon Sep 17 00:00:00 2001 From: Luan Nico Date: Mon, 24 May 2021 13:52:13 -0400 Subject: [PATCH 1/6] Address comments --- lib/src/chunk.dart | 3 ++ lib/src/common/frame.dart | 3 ++ lib/src/common/point.dart | 3 ++ lib/src/common/property.dart | 3 ++ lib/src/common/tiled_image.dart | 3 ++ lib/src/editor_setting/chunk_size.dart | 3 ++ lib/src/editor_setting/editor_setting.dart | 3 ++ lib/src/editor_setting/export.dart | 3 ++ lib/src/layer.dart | 5 ++- lib/src/objects/text.dart | 37 ++++++++++++++++++++++ lib/src/objects/tiled_object.dart | 3 ++ lib/src/template.dart | 4 +++ lib/src/tiled_map.dart | 4 +++ lib/src/tileset/grid.dart | 3 ++ lib/src/tileset/terrain.dart | 3 ++ lib/src/tileset/tile.dart | 3 ++ lib/src/tileset/tile_offset.dart | 3 ++ lib/src/tileset/tileset.dart | 9 ++++-- lib/src/tileset/wang/wang_color.dart | 3 ++ lib/src/tileset/wang/wang_set.dart | 3 ++ lib/src/tileset/wang/wang_tile.dart | 3 ++ lib/tiled.dart | 2 +- test/parser_test.dart | 14 ++++---- 23 files changed, 111 insertions(+), 12 deletions(-) diff --git a/lib/src/chunk.dart b/lib/src/chunk.dart index 1eace6e..fc0c13f 100644 --- a/lib/src/chunk.dart +++ b/lib/src/chunk.dart @@ -1,5 +1,8 @@ part of tiled; +/// Below is Tiled's documentation about how this structure is represented +/// on XML files: +/// /// /// /// * x: The x coordinate of the chunk in tiles. diff --git a/lib/src/common/frame.dart b/lib/src/common/frame.dart index a6b009a..ffd6228 100644 --- a/lib/src/common/frame.dart +++ b/lib/src/common/frame.dart @@ -1,5 +1,8 @@ part of tiled; +/// Below is Tiled's documentation about how this structure is represented +/// on XML files: +/// /// /// /// * tileid: The local ID of a tile within the parent . diff --git a/lib/src/common/point.dart b/lib/src/common/point.dart index 719a5d9..6676038 100644 --- a/lib/src/common/point.dart +++ b/lib/src/common/point.dart @@ -1,5 +1,8 @@ part of tiled; +/// Below is Tiled's documentation about how this structure is represented +/// on XML files: +/// /// /// Used to mark an object as a point. /// The existing x and y attributes are used to determine the position of the diff --git a/lib/src/common/property.dart b/lib/src/common/property.dart index a334d92..7e0762f 100644 --- a/lib/src/common/property.dart +++ b/lib/src/common/property.dart @@ -1,5 +1,8 @@ part of tiled; +/// Below is Tiled's documentation about how this structure is represented +/// on XML files: +/// /// /// * name: The name of the property. /// * type: The type of the property. diff --git a/lib/src/common/tiled_image.dart b/lib/src/common/tiled_image.dart index 7991c0a..eb8dbce 100644 --- a/lib/src/common/tiled_image.dart +++ b/lib/src/common/tiled_image.dart @@ -1,5 +1,8 @@ part of tiled; +/// Below is Tiled's documentation about how this structure is represented +/// on XML files: +/// /// /// /// * format: Used for embedded images, in combination with a data child element. diff --git a/lib/src/editor_setting/chunk_size.dart b/lib/src/editor_setting/chunk_size.dart index b0f93ca..1b62ca2 100644 --- a/lib/src/editor_setting/chunk_size.dart +++ b/lib/src/editor_setting/chunk_size.dart @@ -1,5 +1,8 @@ part of tiled; +/// Below is Tiled's documentation about how this structure is represented +/// on XML files: +/// /// /// /// * width: The width of chunks used for infinite maps (default to 16). diff --git a/lib/src/editor_setting/editor_setting.dart b/lib/src/editor_setting/editor_setting.dart index 9d82046..8778a01 100644 --- a/lib/src/editor_setting/editor_setting.dart +++ b/lib/src/editor_setting/editor_setting.dart @@ -1,5 +1,8 @@ part of tiled; +/// Below is Tiled's documentation about how this structure is represented +/// on XML files: +/// /// /// This element contains various editor-specific settings, /// which are generally not relevant when reading a map. diff --git a/lib/src/editor_setting/export.dart b/lib/src/editor_setting/export.dart index c8e7806..840af79 100644 --- a/lib/src/editor_setting/export.dart +++ b/lib/src/editor_setting/export.dart @@ -1,5 +1,8 @@ part of tiled; +/// Below is Tiled's documentation about how this structure is represented +/// on XML files: +/// /// /// /// * target: The last file this map was exported to. diff --git a/lib/src/layer.dart b/lib/src/layer.dart index ceea17f..2d6fb50 100644 --- a/lib/src/layer.dart +++ b/lib/src/layer.dart @@ -1,5 +1,8 @@ part of tiled; +/// Below is Tiled's documentation about how this structure is represented +/// on XML files: +/// /// All tags shall occur before the first tag so that parsers /// may rely on having the tilesets before needing to resolve tiles. /// @@ -280,7 +283,7 @@ abstract class Layer { List decompressed; switch (compression) { case Compression.zlib: - decompressed = const ZLibDecoder().decodeBytes(decodedString); + decompressed = ZLibDecoder().decodeBytes(decodedString); break; case Compression.gzip: decompressed = GZipDecoder().decodeBytes(decodedString); diff --git a/lib/src/objects/text.dart b/lib/src/objects/text.dart index e3e9016..c4ad220 100644 --- a/lib/src/objects/text.dart +++ b/lib/src/objects/text.dart @@ -1,5 +1,42 @@ part of tiled; +/// Below is Tiled's documentation about how this structure is represented +/// on XML files: +/// +/// +/// +/// * fontfamily: The font family used (defaults to "sans-serif") +/// * pixelsize: The size of the font in pixels (not using points, because +/// other sizes in the TMX format are also using pixels) (defaults to 16) +/// * wrap: Whether word wrapping is enabled (1) or disabled (0). +/// (defaults to 0) +/// * color: Color of the text in #AARRGGBB or #RRGGBB format +/// (defaults to #000000) +/// * bold: Whether the font is bold (1) or not (0). (defaults to 0) +/// * italic: Whether the font is italic (1) or not (0). (defaults to 0) +/// * underline: Whether a line should be drawn below the text (1) or not (0). +/// (defaults to 0) +/// * strikeout: Whether a line should be drawn through the text (1) or not (0). +/// (defaults to 0) +/// * kerning: Whether kerning should be used while rendering the text (1) or +/// not (0). (defaults to 1) +/// * halign: Horizontal alignment of the text within the object (left, center, +/// right or justify, defaults to left) (since Tiled 1.2.1) +/// * valign: Vertical alignment of the text within the object (top , center +/// or bottom, defaults to top) +/// +/// Used to mark an object as a text object. Contains the actual text as +/// character data. +/// +/// For alignment purposes, the bottom of the text is the descender height of +/// the font, and the top of the text is the ascender height of the font. +/// For example, bottom alignment of the word “cat” will leave some space below +/// the text, even though it is unused for this word with most fonts. +/// Similarly, top alignment of the word “cat” will leave some space above the +/// "t" with most fonts, because this space is used for diacritics. +/// +/// If the text is larger than the object’s bounds, it is clipped to the bounds +/// of the object. class Text { String fontFamily; int pixelSize; diff --git a/lib/src/objects/tiled_object.dart b/lib/src/objects/tiled_object.dart index baaba9b..2d48505 100644 --- a/lib/src/objects/tiled_object.dart +++ b/lib/src/objects/tiled_object.dart @@ -1,5 +1,8 @@ part of tiled; +/// Below is Tiled's documentation about how this structure is represented +/// on XML files: +/// /// /// /// * id: Unique ID of the object. Each object that is placed on a map gets a diff --git a/lib/src/template.dart b/lib/src/template.dart index 3e75e32..8cc34c4 100644 --- a/lib/src/template.dart +++ b/lib/src/template.dart @@ -1,6 +1,10 @@ part of tiled; +/// Below is Tiled's documentation about how this structure is represented +/// on XML files: +/// ///