Skip to content

Commit c7d5f35

Browse files
committed
New docs structure
1 parent 62202b3 commit c7d5f35

26 files changed

+365
-147
lines changed

.readthedocs.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
version: 2
22

3-
mkdocs:
4-
configuration: mkdocs.yml
5-
fail_on_warning: true
3+
build:
4+
os: ubuntu-20.04
5+
tools:
6+
python: "3.10"
7+
8+
sphinx:
9+
configuration: docs/conf.py
10+
formats:
11+
- pdf
612

713
python:
814
install:

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/api/common_types.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. _common_types_api:
2+
Common Types
3+
============
4+
5+
This module provides some common types used throughout PyTiled Parser. These are all just NamedTuple
6+
classes provided to make sets of data more clear. As such they can be subscripted like a normal tuple
7+
to get the same values, or you can reference them by name. The values shown here are in the order they
8+
will be in the final tuple.
9+
10+
11+
pytiled_parser.Color
12+
^^^^^^^^^^^^^^^^^^^^
13+
14+
.. autoclass:: pytiled_parser.Color
15+
16+
pytiled_parser.OrderedPair
17+
^^^^^^^^^^^^^^^^^^^^^^^^^^
18+
19+
.. autoclass:: pytiled_parser.OrderedPair
20+
21+
pytiled_parser.Size
22+
^^^^^^^^^^^^^^^^^^^
23+
24+
.. autoclass:: pytiled_parser.Size

docs/api/index.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. _api:
2+
API Reference
3+
=============
4+
5+
This page documents the Application Programming Interface (API) for the PyTiled Parser library.
6+
7+
Throughout the API documentation you will see links labeled both TMX Reference and JSON Reference.
8+
These links go to the official Tiled documentation for that specific type. Sometimes there is not a
9+
one to one mapping, so it may lead to the closest thing in the Tiled format.
10+
11+
At some points certain classes modules may have links to other parts of the Tiled documentation which
12+
cover some of the concepts surrounding that module and it's usage within Tiled.
13+
14+
.. toctree::
15+
:maxdepth: 1
16+
:caption: PyTiled Parser
17+
18+
common_types
19+
properties
20+
layer

docs/api/layer.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.. _layer_api:
2+
Layer
3+
=====
4+
5+
This module provides classes for all layer types
6+
7+
There is the base Layer class, which TileLayer, ObjectLayer, ImageLayer,
8+
and LayerGroup all derive from. The base Layer class is never directly used,
9+
and serves only as an abstract base for common elements between all types.
10+
11+
For more information about Layers, see `Tiled's Manual <https://doc.mapeditor.org/en/stable/manual/layers/>`_
12+
13+
14+
pytiled_parser.Layer
15+
^^^^^^^^^^^^^^^^^^^^
16+
17+
.. autoclass:: pytiled_parser.Layer
18+
:members:
19+
20+
pytiled_parser.TileLayer
21+
^^^^^^^^^^^^^^^^^^^^^^^^
22+
23+
.. autoclass:: pytiled_parser.TileLayer
24+
:members:
25+
26+
pytiled_parser.Chunk
27+
^^^^^^^^^^^^^^^^^^^^
28+
29+
.. autoclass:: pytiled_parser.Chunk
30+
:members:
31+
32+
pytiled_parser.ObjectLayer
33+
^^^^^^^^^^^^^^^^^^^^^^^^^^
34+
35+
.. autoclass:: pytiled_parser.ObjectLayer
36+
:members:
37+
38+
pytiled_parser.ImageLayer
39+
^^^^^^^^^^^^^^^^^^^^^^^^^
40+
41+
.. autoclass:: pytiled_parser.ImageLayer
42+
:members:
43+
44+
pytiled_parser.LayerGroup
45+
^^^^^^^^^^^^^^^^^^^^^^^^^
46+
47+
.. autoclass:: pytiled_parser.LayerGroup
48+
:members:

docs/api/properties.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.. _properties_api:
2+
Properties
3+
==========
4+
5+
This module provides some common types used throughout PyTiled Parser. These are all just NamedTuple
6+
classes provided to make sets of data more clear. As such they can be subscripted like a normal tuple
7+
to get the same values, or you can reference them by name. The values shown here are in the order they
8+
will be in the final tuple.
9+
10+
Properties do not have a special class or anything associated with them. They are simply type aliases for
11+
built-in Python types.
12+
13+
pytiled_parser.Property
14+
^^^^^^^^^^^^^^^^^^^^^^^
15+
16+
The ``pytiled_parser.Property`` type is a Union of the `float`, `str`, and `bool` built-in types, as well as
17+
`Path` class from pathlib, and the `pytiled_parser.Color` common type.
18+
19+
A property may be any one of these types.
20+
21+
pytiled_parser.Properties
22+
^^^^^^^^^^^^^^^^^^^^^^^^^
23+
24+
The ``pytiled_parser.Properties`` type is a Dictionary mapping of `str` to `pytiled_parser.Property` objects.
25+
26+
When the map is parsed, all properties will be loaded in as a Property, and stored in a Properties dictionary
27+
with the name being it's key in the dictionary.

docs/conf.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
import sys
15+
16+
sys.path.insert(0, os.path.abspath(".."))
17+
18+
19+
# -- Project information -----------------------------------------------------
20+
21+
project = "PyTiled Parser"
22+
copyright = "2022, Benjamin Kirkbride, Darren Eberly"
23+
author = "Benjamin Kirkbride, Darren Eberly"
24+
25+
26+
# -- General configuration ---------------------------------------------------
27+
28+
# Add any Sphinx extension module names here, as strings. They can be
29+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
30+
# ones.
31+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.coverage", "sphinx.ext.napoleon"]
32+
33+
# Add any paths that contain templates here, relative to this directory.
34+
templates_path = ["_templates"]
35+
36+
# List of patterns, relative to source directory, that match files and
37+
# directories to ignore when looking for source files.
38+
# This pattern also affects html_static_path and html_extra_path.
39+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
40+
41+
42+
# -- Options for HTML output -------------------------------------------------
43+
44+
# The theme to use for HTML and HTML Help pages. See the documentation for
45+
# a list of builtin themes.
46+
#
47+
html_theme = "furo"
48+
49+
# Add any paths that contain custom static files (such as style sheets) here,
50+
# relative to this directory. They are copied after the builtin static files,
51+
# so a file named "default.css" will overwrite the builtin "default.css".
52+
html_static_path = ["_static"]

docs/guide/index.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.. _api:
2+
Programming Guide
3+
=================
4+
5+
This section will guide you through the implementation details of using PyTiled Parser. This is not
6+
an exact science, and will depend heavily on the library you are trying to integrate with. A lot of
7+
the techniques here will show some general concepts and sort of pseudo code, as well as compare to the
8+
`Arcade <https://api.arcade.academy/>`_ implementation as it is the most complete implementation of this
9+
library to date.
10+
11+
Many liberties are taken when implementing with a game engine to suit that engines needs specifically. It
12+
is a double edged sword of using Tiled, it is very flexible and can be implemented in a lot of different ways.
13+
This comes at the cost of making a guide like this not as straight forward as it otherwise would be.
14+
15+
.. toctree::
16+
:maxdepth: 1
17+
18+
map_loading

docs/guide/map_loading.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Loading A Map
2+
=============
3+
4+
Hello World

docs/index.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/index.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
PyTiled Parser
2+
==============
3+
4+
PyTiled Parser is a Python Library for parsing `Tiled Map Editor <https://www.mapeditor.org/>`_ maps and tilesets
5+
to be used as maps and levels for 2D games in a strictly typed fashion.
6+
7+
PyTiled Parser is not tied to any particular graphics library or game engine. It parses map files and returns arbitrary
8+
Python types(for example, ``Path`` objects for image files rather than a ``Sprite`` from a specific engine). This means
9+
it can be used to aide in implementing Tiled support into a wide variety of tools.
10+
11+
* Documentation available at: https://pytiled-parser.readthedocs.io/
12+
* GitHub Project: https://github.com/pythonarcade/pytiled_parser
13+
* PyPi: https://pypi.org/project/pytiled-parser/
14+
15+
The `Arcade <https://api.arcade.academy/>`_ library has `supporting code <https://api.arcade.academy/en/latest/api/tilemap.html>`_
16+
to integrate PyTiled Parser, as well as `example code <https://api.arcade.academy/en/latest/examples/index.html#using-tiled-map-editor-to-create-maps>`_
17+
showing it's use.
18+
19+
Installation
20+
^^^^^^^^^^^^
21+
22+
Simply install with pip::
23+
24+
pip install pytiled-parser
25+
26+
Quick Links
27+
^^^^^^^^^^^
28+
29+
.. toctree::
30+
:maxdepth: 1
31+
32+
guide/index
33+
api/index
34+
35+
36+
37+
Indices and tables
38+
==================
39+
40+
* :ref:`genindex`
41+
* :ref:`modindex`
42+
* :ref:`search`

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/reference/common_types.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/reference/layer.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/reference/parser.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/reference/properties.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/reference/tiled_map.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/reference/tiled_object.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/reference/tileset.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/reference/wang_set.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/reference/world.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)