Skip to content

Commit ddf314e

Browse files
committed
API Reference docs update
1 parent 25067b2 commit ddf314e

17 files changed

+310
-102
lines changed

docs/api/common_types.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ to get the same values, or you can reference them by name. The values shown here
88
will be in the final tuple.
99

1010

11-
pytiled_parser.Color
12-
^^^^^^^^^^^^^^^^^^^^
11+
Color
12+
^^^^^
1313

14-
.. autoclass:: pytiled_parser.Color
14+
.. autoclass:: pytiled_parser.common_types.Color
1515

16-
pytiled_parser.OrderedPair
17-
^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
OrderedPair
17+
^^^^^^^^^^^
1818

19-
.. autoclass:: pytiled_parser.OrderedPair
19+
.. autoclass:: pytiled_parser.common_types.OrderedPair
2020

21-
pytiled_parser.Size
22-
^^^^^^^^^^^^^^^^^^^
21+
Size
22+
^^^^
2323

24-
.. autoclass:: pytiled_parser.Size
24+
.. autoclass:: pytiled_parser.common_types.Size

docs/api/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ cover some of the concepts surrounding that module and it's usage within Tiled.
1515
:maxdepth: 1
1616
:caption: PyTiled Parser
1717

18+
parser
1819
common_types
1920
properties
21+
tileset
2022
layer
23+
objects
24+
map
25+
wang_set
26+
world

docs/api/layer.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,38 @@ and serves only as an abstract base for common elements between all types.
1111
For more information about Layers, see `Tiled's Manual <https://doc.mapeditor.org/en/stable/manual/layers/>`_
1212

1313

14-
pytiled_parser.Layer
15-
^^^^^^^^^^^^^^^^^^^^
14+
Layer
15+
^^^^^
1616

17-
.. autoclass:: pytiled_parser.Layer
17+
.. autoclass:: pytiled_parser.layer.Layer
1818
:members:
1919

20-
pytiled_parser.TileLayer
21-
^^^^^^^^^^^^^^^^^^^^^^^^
20+
TileLayer
21+
^^^^^^^^^
2222

23-
.. autoclass:: pytiled_parser.TileLayer
23+
.. autoclass:: pytiled_parser.layer.TileLayer
2424
:members:
2525

26-
pytiled_parser.Chunk
27-
^^^^^^^^^^^^^^^^^^^^
26+
Chunk
27+
^^^^^
2828

29-
.. autoclass:: pytiled_parser.Chunk
29+
.. autoclass:: pytiled_parser.layer.Chunk
3030
:members:
3131

32-
pytiled_parser.ObjectLayer
33-
^^^^^^^^^^^^^^^^^^^^^^^^^^
32+
ObjectLayer
33+
^^^^^^^^^^^
3434

35-
.. autoclass:: pytiled_parser.ObjectLayer
35+
.. autoclass:: pytiled_parser.layer.ObjectLayer
3636
:members:
3737

38-
pytiled_parser.ImageLayer
39-
^^^^^^^^^^^^^^^^^^^^^^^^^
38+
ImageLayer
39+
^^^^^^^^^^
4040

41-
.. autoclass:: pytiled_parser.ImageLayer
41+
.. autoclass:: pytiled_parser.layer.ImageLayer
4242
:members:
4343

44-
pytiled_parser.LayerGroup
45-
^^^^^^^^^^^^^^^^^^^^^^^^^
44+
LayerGroup
45+
^^^^^^^^^^
4646

47-
.. autoclass:: pytiled_parser.LayerGroup
47+
.. autoclass:: pytiled_parser.layer.LayerGroup
4848
:members:

docs/api/map.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. _map_api:
2+
Map
3+
===
4+
5+
This module provides the primary TiledMap class which represents a single map from Tiled.
6+
7+
TiledMap
8+
^^^^^^^^
9+
10+
.. autoclass:: pytiled_parser.tiled_map.TiledMap

docs/api/objects.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.. _objects_api:
2+
Objects
3+
=======
4+
5+
This module provides classes for all of the Tiled Object types.
6+
7+
There is the base TiledObject class, which all of the actual object types inherit from.
8+
The base TiledObject class is never directly used, and serves only as an abstract base
9+
for common elements between all types.
10+
11+
Some objects have no extra attributes over the base class, they exist as different classes anyways
12+
to denote the type of object, so that an implementation can load it in accordingly. For example, an
13+
Ellipse and a Point have no differing attributes from the base class, but obviously need to be handled
14+
very differently.
15+
16+
For more information about objects, see `Tiled's Manual <https://doc.mapeditor.org/en/stable/manual/objects/>`_
17+
18+
Also see the `TMX Reference <https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#object>`_
19+
and `JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#object>`_
20+
21+
TiledObject
22+
^^^^^^^^^^^
23+
24+
.. autoclass:: pytiled_parser.tiled_object.TiledObject
25+
26+
Ellipse
27+
^^^^^^^
28+
29+
.. autoclass:: pytiled_parser.tiled_object.Ellipse
30+
31+
Point
32+
^^^^^
33+
34+
.. autoclass:: pytiled_parser.tiled_object.Point
35+
36+
Polygon
37+
^^^^^^^
38+
39+
.. autoclass:: pytiled_parser.tiled_object.Polygon
40+
41+
Polyline
42+
^^^^^^^^
43+
44+
.. autoclass:: pytiled_parser.tiled_object.Polyline
45+
46+
Rectangle
47+
^^^^^^^^^
48+
49+
.. autoclass:: pytiled_parser.tiled_object.Rectangle
50+
51+
Text
52+
^^^^
53+
54+
.. autoclass:: pytiled_parser.tiled_object.Text
55+
56+
Tile
57+
^^^^
58+
59+
.. autoclass:: pytiled_parser.tiled_object.Tile

docs/api/parser.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. _parser_api:
2+
Parser
3+
======
4+
5+
This module exposes the actual parsing functions. If you are creating an implementation, this is
6+
what you will actually pass a file to and receive back a PyTiled Parser Map or World class depending
7+
on what you're parsing.
8+
9+
pytiled_parser.parse_map
10+
^^^^^^^^^^^^^^^^^^^^^^^^
11+
12+
.. autofunction:: pytiled_parser.parse_map
13+
14+
pytiled_parser.parse_world
15+
^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
17+
.. autofunction:: pytiled_parser.parse_world

docs/api/tileset.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. _tileset_api:
2+
Tileset
3+
=======
4+
5+
This module provides an interface for Tilesets and the various objects they contain.
6+
7+
Also see `Tiled's Docs for Editing Tilesets <https://doc.mapeditor.org/en/stable/manual/editing-tilesets/>`_
8+
and the `TMX Reference <https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#tileset>`_
9+
and `JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#tileset>`_
10+
11+
Tileset
12+
^^^^^^^
13+
14+
.. autoclass:: pytiled_parser.tileset.Tileset
15+
16+
Tile
17+
^^^^
18+
19+
.. autoclass:: pytiled_parser.tileset.Tile
20+
21+
Transformations
22+
^^^^^^^^^^^^^^^
23+
24+
.. autoclass:: pytiled_parser.tileset.Transformations
25+
26+
Frame
27+
^^^^^
28+
29+
.. autoclass:: pytiled_parser.tileset.Frame
30+
31+
Grid
32+
^^^^
33+
34+
.. autoclass:: pytiled_parser.tileset.Grid

docs/api/wang_set.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. _wang_set_api:
2+
Wang Set
3+
========
4+
5+
This module contains a number of classes related to Wang Sets.
6+
7+
Wang Sets are the underlying data used by Tiled's terrain system. It is unlikely this module will
8+
ever need touched for creating an implementation in a game engine. It is primarily data used by the
9+
editor during map creation.
10+
11+
See `Tiled's docs about terrain <https://doc.mapeditor.org/en/stable/manual/terrain/>`_
12+
and also the `TMX Reference <https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#wangsets>`_
13+
and the `JSON Reference <https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-set>`_
14+
15+
WangSet
16+
^^^^^^^
17+
18+
.. autoclass:: pytiled_parser.wang_set.WangSet
19+
20+
WangColor
21+
^^^^^^^^^
22+
23+
.. autoclass:: pytiled_parser.wang_set.WangColor
24+
25+
WangTile
26+
^^^^^^^^
27+
28+
.. autoclass:: pytiled_parser.wang_set.WangTile

docs/api/world.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.. _world_api:
2+
World
3+
=====
4+
5+
This module provides an implementation for the World files from Tiled.
6+
7+
See `Tiled's docs for Worlds <https://doc.mapeditor.org/en/stable/manual/worlds/>`_
8+
for more info about worlds and what they do.
9+
10+
The functionality within PyTiled Parser is to load the world and outline the size
11+
and position of each map, and provide the path to the map file. Loading a world
12+
does not automatically load each map within the world, this is so that the game
13+
or engine implementation can decide how to handle map loading.
14+
15+
WorldMap
16+
^^^^^^^^
17+
18+
.. autoclass:: pytiled_parser.world.WorldMap
19+
20+
World
21+
^^^^^
22+
23+
.. autoclass:: pytiled_parser.world.World

pytiled_parser/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
from .common_types import Color, OrderedPair, Size
1515
from .exception import UnknownFormat
1616
from .layer import Chunk, ImageLayer, Layer, LayerGroup, ObjectLayer, TileLayer
17-
from .parser import parse_map
17+
from .parser import parse_map, parse_world
1818
from .properties import Properties, Property
1919
from .tiled_map import TiledMap
20-
from .tileset import Tile, Tileset
20+
from .tileset import Frame, Grid, Tile, Tileset, Transformations
2121
from .version import __version__
22+
from .world import World, WorldMap

pytiled_parser/common_types.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
class Color(NamedTuple):
99
"""Represents an RGBA color value as a four value Tuple.
1010
11-
:param int red: Red value, between 0 and 255.
12-
:param int green: Green value, between 0 and 255.
13-
:param int blue: Blue value, between 0 and 255.
14-
:param int alpha: Alpha value, between 0 and 255.
11+
Attributes:
12+
red: Red value, between 0 and 255.
13+
green: Green value, between 0 and 255.
14+
blue: Blue value, between 0 and 255.
15+
alpha: Alpha value, between 0 and 255.
1516
"""
1617
red: int
1718
green: int
@@ -22,8 +23,9 @@ class Color(NamedTuple):
2223
class Size(NamedTuple):
2324
"""Represents a two dimensional size as a two value Tuple.
2425
25-
:param int width: The width of the object. Can be in either pixels or number of tiles.
26-
:param int height: The height of the object. Can be in either pixels or number of tiles.
26+
Attributes:
27+
width: The width of the object. Can be in either pixels or number of tiles.
28+
height: The height of the object. Can be in either pixels or number of tiles.
2729
"""
2830

2931
width: float
@@ -33,8 +35,9 @@ class Size(NamedTuple):
3335
class OrderedPair(NamedTuple):
3436
"""Represents a two dimensional position as a two value Tuple.
3537
36-
:param int x: X coordinate. Can be in either pixels or number of tiles.
37-
:param int y: Y coordinate. Can be in either pixels or number of tiles.
38+
Attributes:
39+
x: X coordinate. Can be in either pixels or number of tiles.
40+
y: Y coordinate. Can be in either pixels or number of tiles.
3841
"""
3942

4043
x: float

0 commit comments

Comments
 (0)