Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A Dart Tiled library.

## Install from Dart Pub Repository

To include the package as a depencency in your `pubspec.yaml`, run the following (or add it manually):
To include the package as a dependency in your `pubspec.yaml`, run the following (or add it manually):

```sh
dart pub add tiled
Expand All @@ -29,7 +29,7 @@ Load a TMX file into a string by any means, and then pass the string to TileMapP
final TiledMap mapTmx = TileMapParser.parseTmx(tmxBody);
```

If your tmx file includes a external tsx reference, you have to add a CustomParser
If your tmx file includes an external tsx reference, you have to add a CustomParser
```dart
class CustomTsxProvider extends TsxProvider {
@override
Expand Down
7 changes: 4 additions & 3 deletions packages/tiled/lib/src/chunk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:tiled/tiled.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <chunk>
/// `<chunk>`
///
/// * x: The x coordinate of the chunk in tiles.
/// * y: The y coordinate of the chunk in tiles.
Expand All @@ -26,10 +26,11 @@ class Chunk {
int width;
int height;

/// This is not part of the tiled definitions; this is just a convinient
/// This is not part of the tiled definitions; this is just a convenience
/// wrapper over the [data] field that simplifies two things:
///
/// * represents the matrix as a matrix (List<List<X>>) instead of a flat list
/// * represents the matrix as a matrix (`List<List<X>>`) instead of a flat
/// list
/// * wraps the gid integer into the [Gid] class for easy access of properties
List<List<Gid>> tileData;

Expand Down
4 changes: 2 additions & 2 deletions packages/tiled/lib/src/common/frame.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import 'package:tiled/src/parser.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <frame>
/// `<frame>`
///
/// * tileid: The local ID of a tile within the parent <tileset>.
/// * tileid: The local ID of a tile within the parent `<tileset>`.
/// * duration: How long (in milliseconds) this frame should be displayed
/// before advancing to the next frame.
class Frame {
Expand Down
2 changes: 1 addition & 1 deletion packages/tiled/lib/src/common/point.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:tiled/src/parser.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <point>
/// `<point>`
/// Used to mark an object as a point.
/// The existing x and y attributes are used to determine the position of the
/// point.
Expand Down
6 changes: 3 additions & 3 deletions packages/tiled/lib/src/common/property.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:xml/xml.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <property>
/// `<property>`
/// * name: The name of the property.
/// * type: The type of the property.
/// Can be string (default), int, float, bool, color, file or object
Expand Down Expand Up @@ -79,7 +79,7 @@ class Property<T> {
return attrString;
} else {
// In tmx files, multi-line text property values can be stored
// inside the <property> node itself instead of in the 'value'
// inside the `<property>` node itself instead of in the 'value'
// attribute
return xml.element.innerText;
}
Expand Down Expand Up @@ -195,7 +195,7 @@ class IntProperty extends Property<int> {
}) : super(type: PropertyType.int);
}

/// [value] is the double-percision floating-point number
/// [value] is the double-precision floating-point number
class FloatProperty extends Property<double> {
FloatProperty({
required super.name,
Expand Down
2 changes: 1 addition & 1 deletion packages/tiled/lib/src/common/tiled_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:tiled/src/parser.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <image>
/// `<image>`
///
/// * format: Used for embedded images, in combination with a data child
/// element.
Expand Down
2 changes: 1 addition & 1 deletion packages/tiled/lib/src/editor_setting/chunk_size.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:tiled/src/parser.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <chunksize>
/// `<chunksize>`
///
/// * width: The width of chunks used for infinite maps (default to 16).
/// * height: The width of chunks used for infinite maps (default to 16).
Expand Down
4 changes: 2 additions & 2 deletions packages/tiled/lib/src/editor_setting/editor_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import 'package:tiled/tiled.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <editorsettings>
/// `<editorsettings>`
/// This element contains various editor-specific settings,
/// which are generally not relevant when reading a map.
///
/// Can contain: <chunksize>, <export>
/// Can contain: `<chunksize>`, `<export>`
class EditorSetting {
ChunkSize? chunkSize;
Export? export;
Expand Down
2 changes: 1 addition & 1 deletion packages/tiled/lib/src/editor_setting/export.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:tiled/src/parser.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <export>
/// `<export>`
///
/// * target: The last file this map was exported to.
/// * format: The short name of the last format this map was exported as.
Expand Down
11 changes: 6 additions & 5 deletions packages/tiled/lib/src/layer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import 'package:xml/xml.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// All <tileset> tags shall occur before the first <layer> tag so that parsers
/// may rely on having the tilesets before needing to resolve tiles.
/// All `<tileset>` tags shall occur before the first `<layer>` tag so that
/// parsers may rely on having the tilesets before needing to resolve tiles.
///
/// * id: Unique ID of the layer. Each layer that added to a map gets a unique
/// id. Even if a layer is deleted, no layer ever gets the same ID.
Expand All @@ -36,7 +36,7 @@ import 'package:xml/xml.dart';
/// * parallaxy: Vertical parallax factor for this layer.
/// Defaults to 1. (since 1.5)
///
/// Can contain at most one: <properties>, <data>
/// Can contain at most one: `<properties>`, `<data>`
abstract class Layer {
/// Incremental ID - unique across all layers
int? id;
Expand Down Expand Up @@ -377,10 +377,11 @@ class TileLayer extends Layer {
/// See [tileData] for a better representation.
List<int>? data;

/// This is not part of the tiled definitions; this is just a convinient
/// This is not part of the tiled definitions; this is just a convenience
/// wrapper over the [data] field that simplifies two things:
///
/// * represents the matrix as a matrix (List<List<X>>) instead of a flat list
/// * represents the matrix as a matrix (`List<List<X>>`) instead of a flat
/// list
/// * wraps the gid integer into the [Gid] class for easy access of properties
List<List<Gid>>? tileData;

Expand Down
2 changes: 1 addition & 1 deletion packages/tiled/lib/src/objects/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:tiled/tiled.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <text>
/// `<text>`
///
/// * fontfamily: The font family used (defaults to "sans-serif")
/// * pixelsize: The size of the font in pixels (not using points, because
Expand Down
8 changes: 4 additions & 4 deletions packages/tiled/lib/src/objects/tiled_object.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:tiled/tiled.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <object>
/// `<object>`
///
/// * id: Unique ID of the object. Each object that is placed on a map gets a
/// unique id. Even if an object was deleted, no object gets the same ID.
Expand Down Expand Up @@ -41,8 +41,8 @@ import 'package:tiled/tiled.dart';
/// the specified template, properties saved with the object will have higher
/// priority, i.e. they will override the template properties.
///
/// Can contain at most one: <properties>, <ellipse> (since 0.9),
/// <point> (since 1.1), <polygon>, <polyline>, <text> (since 1.0)
/// Can contain at most one: `<properties>`, `<ellipse>` (since 0.9),
/// `<point>` (since 1.1), `<polygon>`, `<polyline>`, `<text>` (since 1.0)
class TiledObject {
int id;
String name;
Expand Down Expand Up @@ -109,7 +109,7 @@ class TiledObject {
final gid = parser.getIntOrNull('gid');
final name = parser.getString('name', defaults: '');

// Tiled 1.9 and above versions running in compatibilty mode set to
// Tiled 1.9 and above versions running in compatibility mode set to
// "Tiled 1.8" will still write out "Class" property as "type". So try both
// before using default value.
final type = parser.getString(
Expand Down
4 changes: 2 additions & 2 deletions packages/tiled/lib/src/template.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:tiled/tiled.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <template>
/// `<template>`
///
/// The template root element contains the saved map object and a tileset
/// element that points to an external tileset, if the object is a tile object.
Expand All @@ -18,7 +18,7 @@ import 'package:tiled/tiled.dart';
/// </template>
/// ```
///
/// Can contain at most one: <tileset>, <object>
/// Can contain at most one: `<tileset>`, `<object>`
class Template {
Tileset? tileSet;
TiledObject? object;
Expand Down
8 changes: 4 additions & 4 deletions packages/tiled/lib/src/tiled_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:xml/xml.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <map>
/// `<map>`
///
/// * version: The TMX format version. Was “1.0” so far, and will be incremented
/// to match minor Tiled releases.
Expand Down Expand Up @@ -55,10 +55,10 @@ import 'package:xml/xml.dart';
///
/// The staggered orientation refers to an isometric map using staggered axes.
///
/// Can contain at most one: <properties>
/// Can contain at most one: `<properties>`
///
/// Can contain any number: <tileset>, <layer>, <objectgroup>, <imagelayer>,
/// <group> (since 1.0), <editorsettings> (since 1.3)
/// Can contain any number: `<tileset>`, `<layer>`, `<objectgroup>`,
/// `<imagelayer>`, `<group>` (since 1.0), `<editorsettings>` (since 1.3)
class TiledMap {
TileMapType type;
String version;
Expand Down
2 changes: 1 addition & 1 deletion packages/tiled/lib/src/tileset/grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:tiled/tiled.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <grid>
/// `<grid>`
///
/// * orientation: Orientation of the grid for the tiles in this tileset
/// (orthogonal or isometric, defaults to orthogonal)
Expand Down
4 changes: 2 additions & 2 deletions packages/tiled/lib/src/tileset/terrain.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import 'package:tiled/tiled.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <terrain>
/// `<terrain>`
///
/// * name: The name of the terrain type.
/// * tile: The local tile-id of the tile that represents the terrain visually.
///
/// Can contain at most one: <properties>
/// Can contain at most one: `<properties>`
class Terrain {
String name;
int tile;
Expand Down
6 changes: 3 additions & 3 deletions packages/tiled/lib/src/tileset/tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:tiled/tiled.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <tile>
/// `<tile>`
///
/// * id: The local tile ID within its tileset.
/// * type: The type of the tile. Refers to an object type and is used by tile
Expand All @@ -18,8 +18,8 @@ import 'package:tiled/tiled.dart';
/// chosen when it competes with others while editing with the terrain tool.
/// (defaults to 0)
///
/// Can contain at most one: <properties>, <image> (since 0.9), <objectgroup>,
/// <animation>.
/// Can contain at most one: `<properties>`, `<image>` (since 0.9),
/// `<objectgroup>`, `<animation>`.
class Tile {
int localId;
String? type;
Expand Down
2 changes: 1 addition & 1 deletion packages/tiled/lib/src/tileset/tile_offset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:tiled/src/parser.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <tileoffset>
/// `<tileoffset>`
///
/// x: Horizontal offset in pixels. (defaults to 0)
/// y: Vertical offset in pixels (positive is down, defaults to 0)
Expand Down
22 changes: 11 additions & 11 deletions packages/tiled/lib/src/tileset/tileset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import 'package:tiled/tiled.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <tileset>
/// `<tileset>`
///
/// * firstgid: The first global tile ID of this tileset (this global ID maps
/// to the first tile in this tileset).
/// * source: If this tileset is stored in an external TSX (Tile Set XML) file,
/// this attribute refers to that file. That TSX file has the same structure
/// as the <tileset> element described here. (There is the firstgid attribute
/// missing and this source attribute is also not there. These two attributes
/// are kept in the TMX map, since they are map specific.)
/// as the `<tileset>` element described here. (There is the firstgid
/// attribute missing and this source attribute is also not there. These two
/// attributes are kept in the TMX map, since they are map specific.)
/// * name: The name of this tileset.
/// * tilewidth: The (maximum) width of the tiles in this tileset.
/// * tileheight: The (maximum) height of the tiles in this tileset.
Expand All @@ -31,19 +31,19 @@ import 'package:tiled/tiled.dart';
/// compatibility reasons. When unspecified, tile objects use bottomleft in
/// orthogonal mode and bottom in isometric mode. (since 1.4)
///
/// If there are multiple <tileset> elements, they are in ascending order of
/// If there are multiple `<tileset>` elements, they are in ascending order of
/// their firstgid attribute. The first tileset always has a firstgid value of
/// 1. Since Tiled 0.15, image collection tilesets do not necessarily number
/// their tiles consecutively since gaps can occur when removing tiles.
///
/// Image collection tilesets have no <image> tag. Instead, each tile has an
/// <image> tag.
/// Image collection tilesets have no `<image>` tag. Instead, each tile has an
/// `<image>` tag.
///
/// Can contain at most one: <image>, <tileoffset>, <grid> (since 1.0),
/// <properties>, <terraintypes>, <wangsets> (since 1.1), <transformations>
/// (since 1.5)
/// Can contain at most one: `<image>`, `<tileoffset>`, `<grid>` (since 1.0),
/// `<properties>`, `<terraintypes>`, `<wangsets>` (since 1.1),
/// `<transformations>` (since 1.5)
///
/// Can contain any number: <tile>
/// Can contain any number: `<tile>`
class Tileset {
int? firstGid;
String? source;
Expand Down
4 changes: 2 additions & 2 deletions packages/tiled/lib/src/tileset/wang/wang_color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:tiled/tiled.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <wangcolor>
/// `<wangcolor>`
/// A color that can be used to define the corner and/or edge of a Wang tile.
///
/// * name: The name of this color.
Expand All @@ -12,7 +12,7 @@ import 'package:tiled/tiled.dart';
/// * probability: The relative probability that this color is chosen over
/// others in case of multiple options. (defaults to 0)
///
/// Can contain at most one: <properties>
/// Can contain at most one: `<properties>`
class WangColor {
String name;
String color;
Expand Down
8 changes: 4 additions & 4 deletions packages/tiled/lib/src/tileset/wang/wang_set.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import 'package:tiled/tiled.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <wangset>
/// `<wangset>`
///
/// Defines a list of corner colors and a list of edge colors, and any number
/// of Wang tiles using these colors.
///
/// name: The name of the Wang set.
/// tile: The tile ID of the tile representing this Wang set.
/// Can contain at most one: <properties>
/// Can contain at most one: `<properties>`
///
/// Can contain up to 255: <wangcolor> (since Tiled 1.5)
/// Can contain up to 255: `<wangcolor>` (since Tiled 1.5)
///
/// Can contain any number: <wangtile>
/// Can contain any number: `<wangtile>`
class WangSet {
String name;
int tile;
Expand Down
2 changes: 1 addition & 1 deletion packages/tiled/lib/src/tileset/wang/wang_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:tiled/src/parser.dart';
/// Below is Tiled's documentation about how this structure is represented
/// on XML files:
///
/// <wangtile>
/// `<wangtile>`
///
/// Defines a Wang tile, by referring to a tile in the tileset and associating
/// it with a certain Wang ID.
Expand Down
Loading