From f9d1ca989330c73b97c0eb9fa7d8ad56aa24624c Mon Sep 17 00:00:00 2001 From: Benjamin Kirkbride Date: Sat, 6 Jun 2020 18:00:50 -0400 Subject: [PATCH 1/7] rf(map): don't mess with the default of the format --- pytiled_parser/map.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pytiled_parser/map.py b/pytiled_parser/map.py index 1a40fcb..7da73f8 100644 --- a/pytiled_parser/map.py +++ b/pytiled_parser/map.py @@ -43,8 +43,7 @@ class Map: background_color: The background color of the map. next_layer_id: Stores the next available ID for new layers. next_object_id: Stores the next available ID for new objects. - tile_sets: Dict of tile sets used in this map. Key is the first GID for the - tile set. The value is a TileSet object. + tile_sets: Tilesets used in this map. layers: List of layer objects by draw order. """ @@ -61,7 +60,7 @@ class Map: next_layer_id: Optional[int] next_object_id: int - tile_sets: TileSetDict + tile_sets: List[TileSet] layers: List[Layer] hex_side_length: Optional[int] = None From cb22d613b09e430bf32acd4becd93d8266200258 Mon Sep 17 00:00:00 2001 From: Benjamin Kirkbride Date: Sat, 6 Jun 2020 18:01:10 -0400 Subject: [PATCH 2/7] rf(map): this feature will need rethought --- pytiled_parser/map.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pytiled_parser/map.py b/pytiled_parser/map.py index 7da73f8..a3220d6 100644 --- a/pytiled_parser/map.py +++ b/pytiled_parser/map.py @@ -47,9 +47,6 @@ class Map: layers: List of layer objects by draw order. """ - parent_dir: Path - tmx_file: Union[str, Path] - version: str tiled_version: str orientation: str From 373204eb862f5eb5c1ff7aceb6b1f96d56b9c642 Mon Sep 17 00:00:00 2001 From: Benjamin Kirkbride Date: Sat, 6 Jun 2020 18:08:25 -0400 Subject: [PATCH 3/7] rf(map): alphabetize --- pytiled_parser/map.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/pytiled_parser/map.py b/pytiled_parser/map.py index a3220d6..809b10a 100644 --- a/pytiled_parser/map.py +++ b/pytiled_parser/map.py @@ -47,25 +47,23 @@ class Map: layers: List of layer objects by draw order. """ - version: str - tiled_version: str - orientation: str - render_order: str - map_size: Size - tile_size: Size infinite: bool + layers: List[Layer] + map_size: Size next_layer_id: Optional[int] next_object_id: int - + orientation: str + render_order: str + tiled_version: str + tile_size: Size tile_sets: List[TileSet] - layers: List[Layer] + version: str + background_color: Optional[Color] = None + properties: Optional[Properties] = None hex_side_length: Optional[int] = None stagger_axis: Optional[int] = None stagger_index: Optional[int] = None - background_color: Optional[Color] = None - - properties: Optional[Properties] = None class _RawTiledMap(TypedDict): From 27f4cd86a0167b8f168a7551536c7b19b9a3f8cc Mon Sep 17 00:00:00 2001 From: Benjamin Kirkbride Date: Sat, 6 Jun 2020 18:22:36 -0400 Subject: [PATCH 4/7] doc(map): switch TMX to JSON --- pytiled_parser/map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytiled_parser/map.py b/pytiled_parser/map.py index 809b10a..16b1967 100644 --- a/pytiled_parser/map.py +++ b/pytiled_parser/map.py @@ -23,7 +23,7 @@ class Map: Attributes: parent_dir: The directory the TMX file is in. Used for finding relative paths to TSX files and other assets. - version: The TMX format version. + version: The JSON format version. tiled_version: The Tiled version used to save the file. May be a date (for snapshot builds). orientation: Map orientation. Tiled supports "orthogonal", "isometric", From b820dc5a4d1d966972076e7a202ac179757694a2 Mon Sep 17 00:00:00 2001 From: Benjamin Kirkbride Date: Sat, 6 Jun 2020 18:29:41 -0400 Subject: [PATCH 5/7] doc(map): alphabetize the attributes --- pytiled_parser/map.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pytiled_parser/map.py b/pytiled_parser/map.py index 16b1967..6f616c1 100644 --- a/pytiled_parser/map.py +++ b/pytiled_parser/map.py @@ -21,30 +21,29 @@ class Map: See: https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#map Attributes: - parent_dir: The directory the TMX file is in. Used for finding relative paths - to TSX files and other assets. - version: The JSON format version. - tiled_version: The Tiled version used to save the file. May be a date (for - snapshot builds). + infinite: If the map is infinite or not. + layers: List of layer objects by draw order. + map_size: The map width in tiles. + next_layer_id: Stores the next available ID for new layers. + next_object_id: Stores the next available ID for new objects. orientation: Map orientation. Tiled supports "orthogonal", "isometric", "staggered" and "hexagonal" render_order: The order in which tiles on tile layers are rendered. Valid values are right-down, right-up, left-down and left-up. In all cases, the map is + tiled_version: The Tiled version used to save the file. May be a date (for + snapshot builds). drawn row-by-row. (only supported for orthogonal maps at the moment) - map_size: The map width in tiles. tile_size: The width of a tile. - infinite: If the map is infinite or not. + tile_sets: Tilesets used in this map. + version: The JSON format version. + background_color: The background color of the map. + properties: The properties of the Map. hex_side_length: Only for hexagonal maps. Determines the width or height (depending on the staggered axis) of the tile's edge, in pixels. stagger_axis: For staggered and hexagonal maps, determines which axis ("x" or "y") is staggered. stagger_index: For staggered and hexagonal maps, determines whether the "even" or "odd" indexes along the staggered axis are shifted. - background_color: The background color of the map. - next_layer_id: Stores the next available ID for new layers. - next_object_id: Stores the next available ID for new objects. - tile_sets: Tilesets used in this map. - layers: List of layer objects by draw order. """ infinite: bool From 1b3e0e1e848c50dd72e24930c07a1a6d8a616f4c Mon Sep 17 00:00:00 2001 From: Benjamin Kirkbride Date: Sat, 6 Jun 2020 18:31:23 -0400 Subject: [PATCH 6/7] doc(map): size of a tile, not width --- pytiled_parser/map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytiled_parser/map.py b/pytiled_parser/map.py index 6f616c1..e0be958 100644 --- a/pytiled_parser/map.py +++ b/pytiled_parser/map.py @@ -33,7 +33,7 @@ class Map: tiled_version: The Tiled version used to save the file. May be a date (for snapshot builds). drawn row-by-row. (only supported for orthogonal maps at the moment) - tile_size: The width of a tile. + tile_size: The size of a tile. tile_sets: Tilesets used in this map. version: The JSON format version. background_color: The background color of the map. From 3087842cca687eb4a369681602345432aed48171 Mon Sep 17 00:00:00 2001 From: Benjamin Kirkbride Date: Sat, 6 Jun 2020 18:37:31 -0400 Subject: [PATCH 7/7] feat(layer): stub cast --- pytiled_parser/layer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pytiled_parser/layer.py b/pytiled_parser/layer.py index 4b6e1f3..5bf5592 100644 --- a/pytiled_parser/layer.py +++ b/pytiled_parser/layer.py @@ -164,3 +164,7 @@ class RawLayer(TypedDict): width: int x: int y: int + + +def cast(*args, **kwargs): + pass