mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2025-12-29 07:40:11 +01:00
Initial work on mkdocs documentation
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line, and also
|
||||
# from the environment for the first two.
|
||||
SPHINXOPTS ?=
|
||||
SPHINXBUILD ?= sphinx-build
|
||||
SOURCEDIR = source
|
||||
BUILDDIR = build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
.PHONY: help Makefile
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
7
docs/index.md
Normal file
7
docs/index.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# PyTiled Parser
|
||||
|
||||
PyTiled Parser is a Python Library for parsing maps made with the [Tiled Map Editor](https://www.mapeditor.org) for 2D games in a strictly typed fashion.
|
||||
|
||||
PyTiled Parser is not tied to any particular graphics library, and as such could be used with [Arcade](https://api.arcade.academy), [Pyglet](https://pyglet.readthedocs.io), [Pygame](https://www.pygame.org/news), or any other Python graphics library.
|
||||
|
||||
While we don't offer any direct integrations to other libraries/frameworks, [Arcade](https://api.arcade.academy) has full integration for PyTiled Parser out of the box, and would be a good resource to use as an example implementation.
|
||||
@@ -1,35 +0,0 @@
|
||||
@ECHO OFF
|
||||
|
||||
pushd %~dp0
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set SOURCEDIR=source
|
||||
set BUILDDIR=build
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.http://sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
|
||||
:end
|
||||
popd
|
||||
3
docs/reference/common_types.md
Normal file
3
docs/reference/common_types.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Common Types
|
||||
|
||||
::: pytiled_parser.common_types
|
||||
1
docs/reference/layer.md
Normal file
1
docs/reference/layer.md
Normal file
@@ -0,0 +1 @@
|
||||
# Layer
|
||||
3
docs/reference/parser.md
Normal file
3
docs/reference/parser.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Parser
|
||||
|
||||
::: pytiled_parser.parser
|
||||
1
docs/reference/properties.md
Normal file
1
docs/reference/properties.md
Normal file
@@ -0,0 +1 @@
|
||||
# Properties
|
||||
3
docs/reference/tiled_map.md
Normal file
3
docs/reference/tiled_map.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# tiled_map
|
||||
|
||||
::: pytiled_parser.tiled_map
|
||||
1
docs/reference/tiled_object.md
Normal file
1
docs/reference/tiled_object.md
Normal file
@@ -0,0 +1 @@
|
||||
# Tiled Object
|
||||
1
docs/reference/tileset.md
Normal file
1
docs/reference/tileset.md
Normal file
@@ -0,0 +1 @@
|
||||
# TileSet
|
||||
5
docs/reference/wang_set.md
Normal file
5
docs/reference/wang_set.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# wang_set
|
||||
|
||||
::: pytiled_parser.wang_set
|
||||
rendering:
|
||||
members_order: source
|
||||
3
docs/reference/world.md
Normal file
3
docs/reference/world.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Worlds
|
||||
|
||||
::: pytiled_parser.world
|
||||
@@ -1,59 +0,0 @@
|
||||
PyTiled Parser API
|
||||
==================
|
||||
|
||||
pytiled\_parser.common\_types
|
||||
------------------------------------
|
||||
|
||||
.. automodule:: pytiled_parser.common_types
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pytiled\_parser.layer
|
||||
----------------------------
|
||||
|
||||
.. automodule:: pytiled_parser.layer
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pytiled\_parser.properties
|
||||
---------------------------------
|
||||
|
||||
.. automodule:: pytiled_parser.properties
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
pytiled\_parser.tiled\_map
|
||||
---------------------------------
|
||||
|
||||
.. automodule:: pytiled_parser.tiled_map
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pytiled\_parser.tiled\_object
|
||||
------------------------------------
|
||||
|
||||
.. automodule:: pytiled_parser.tiled_object
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pytiled\_parser.tileset
|
||||
------------------------------
|
||||
|
||||
.. automodule:: pytiled_parser.tileset
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
pytiled\_parser.util
|
||||
---------------------------
|
||||
|
||||
.. automodule:: pytiled_parser.util
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
@@ -1,64 +0,0 @@
|
||||
# Configuration file for the Sphinx documentation builder.
|
||||
#
|
||||
# This file only contains a selection of the most common options. For a full
|
||||
# list see the documentation:
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||
|
||||
# -- Path setup --------------------------------------------------------------
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.abspath('../..'))
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = 'PyTiled Parser'
|
||||
copyright = '2021, Beefy-Swain, Cleptomania'
|
||||
author = 'Beefy-Swain, Cleptomania'
|
||||
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = '1.0.0'
|
||||
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.coverage',
|
||||
'sphinx.ext.viewcode',
|
||||
'sphinx.ext.napoleon',
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This pattern also affects html_static_path and html_extra_path.
|
||||
exclude_patterns = []
|
||||
|
||||
source_suffix = '.rst'
|
||||
|
||||
master_doc = 'index'
|
||||
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
@@ -1,20 +0,0 @@
|
||||
PyTiled Parser
|
||||
==============
|
||||
|
||||
PyTiled Parser is a Python library for parsing `Tiled Map Editor`_ (`.json`) files used to generate maps and levels for 2D games.
|
||||
|
||||
PyTiled Parser is not tied to any particular graphics library, and can be used with Arcade_, Pyglet_, Pygame_, and more.
|
||||
|
||||
API documentation
|
||||
-----------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
api
|
||||
|
||||
For More Info
|
||||
-------------
|
||||
|
||||
* `PyTiled Parser on Github <https://github.com/beefy-swain/pytiled_parser>`_
|
||||
* `PyTiled Parser on PyPi <https://pypi.org/project/pytiled-parser/>`_
|
||||
44
mkdocs.yml
Normal file
44
mkdocs.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
site_name: PyTiled Parser
|
||||
site_url: https://learn-arcade.dev/
|
||||
repo_url: https://github.com/benjamin-kirkbride/pytiled_parser
|
||||
repo_name: benjamin-kirkbride/pytiled_parser
|
||||
theme:
|
||||
features:
|
||||
- search.suggest
|
||||
name: material
|
||||
palette:
|
||||
- media: "(prefers-color-scheme: light)"
|
||||
scheme: default
|
||||
toggle:
|
||||
icon: material/lightbulb-outline
|
||||
name: Switch to dark mode
|
||||
- media: "(prefers-color-scheme: dark)"
|
||||
scheme: slate
|
||||
primary: cyan
|
||||
accent: pink
|
||||
toggle:
|
||||
icon: material/lightbulb
|
||||
name: Switch to light mode
|
||||
plugins:
|
||||
- search
|
||||
- mkdocstrings:
|
||||
handlers:
|
||||
python:
|
||||
selection:
|
||||
filters:
|
||||
- "!^__"
|
||||
- "!^_"
|
||||
watch:
|
||||
- pytiled_parser
|
||||
nav:
|
||||
- PyTiled Parser: index.md
|
||||
- API Reference:
|
||||
- reference/common_types.md
|
||||
- reference/layer.md
|
||||
- reference/parser.md
|
||||
- reference/properties.md
|
||||
- reference/tiled_map.md
|
||||
- reference/tiled_object.md
|
||||
- reference/tileset.md
|
||||
- reference/wang_set.md
|
||||
- reference/world.md
|
||||
@@ -11,7 +11,7 @@ PyTiled Parser is not tied to any particular graphics library or game engine.
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
|
||||
from .common_types import OrderedPair, Size
|
||||
from .common_types import Color, OrderedPair, Size
|
||||
from .exception import UnknownFormat
|
||||
from .layer import ImageLayer, Layer, LayerGroup, ObjectLayer, TileLayer
|
||||
from .parser import parse_map
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
|
||||
from typing import NamedTuple
|
||||
|
||||
import attr
|
||||
|
||||
|
||||
class Color(NamedTuple):
|
||||
"""Color NamedTuple.
|
||||
"""Represents an RGBA color value as a four value Tuple.
|
||||
|
||||
Attributes:
|
||||
red: Red, between 1 and 255.
|
||||
@@ -23,13 +21,8 @@ class Color(NamedTuple):
|
||||
alpha: int
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class Template:
|
||||
"""FIXME TODO"""
|
||||
|
||||
|
||||
class Size(NamedTuple):
|
||||
"""Size NamedTuple.
|
||||
"""Represents a two dimensional size as a two value Tuple.
|
||||
|
||||
Attributes:
|
||||
width: The width of the object in pixels.
|
||||
@@ -41,7 +34,7 @@ class Size(NamedTuple):
|
||||
|
||||
|
||||
class OrderedPair(NamedTuple):
|
||||
"""OrderedPair NamedTuple.
|
||||
"""Represents a two dimensional position as a two value Tuple.
|
||||
|
||||
Attributes:
|
||||
x: X coordinate.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""The tiled_map module contains the primary TiledMap class which represents a single
|
||||
map from Tiled.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
@@ -13,9 +17,15 @@ TilesetDict = Dict[int, Tileset]
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class TiledMap:
|
||||
"""Object for storing a TMX with all associated layers and properties.
|
||||
"""Object for storing a Tiled map with all associated objects.
|
||||
|
||||
See: https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#map
|
||||
This object is the top level object for a map. It contains all layers within a map,
|
||||
as well as all Tiesets used by the map. When creating an implementation, this will
|
||||
be the primary class to work with to pull all data relating to a map.
|
||||
|
||||
[TMX Reference](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#map)
|
||||
|
||||
[JSON Reference](https://doc.mapeditor.org/en/stable/reference/json-map-format/#map)
|
||||
|
||||
Attributes:
|
||||
infinite: If the map is infinite or not.
|
||||
|
||||
@@ -9,6 +9,9 @@ from pytiled_parser.common_types import Color
|
||||
|
||||
def parse_color(color: str) -> Color:
|
||||
"""Convert Tiled color format into PyTiled's.
|
||||
|
||||
Tiled's color format is #AARRGGBB and PyTiled's is an RGBA tuple.
|
||||
|
||||
Args:
|
||||
color (str): Tiled formatted color string.
|
||||
Returns:
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
"""This module contains a number of classes related to Wang Sets.
|
||||
|
||||
Wang Sets are the underlying data used by Tiled's terrain system.
|
||||
See [Tiled's docs about terrain](https://doc.mapeditor.org/en/stable/manual/terrain/)
|
||||
and also the [TMX Reference](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#wangsets)
|
||||
and the [JSON Reference](https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-set)
|
||||
"""
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
import attr
|
||||
@@ -8,6 +15,18 @@ from pytiled_parser.properties import Properties
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class WangTile:
|
||||
"""Defines a Wang tile by linking a tile in the tileset to a Wang ID.
|
||||
|
||||
[TMX Reference](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#wangtile)
|
||||
|
||||
[JSON Reference](https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-tile)
|
||||
|
||||
Attributes:
|
||||
tile_id: The ID of the tile this WangTile maps to
|
||||
wang_id: The wang color indexes for this tile. This is a list of IDs referring
|
||||
to colors within the wang set. In the order of top, top right, right,
|
||||
bottom right, bottom, bottom left, left, top left.
|
||||
"""
|
||||
|
||||
tile_id: int
|
||||
wang_id: List[int]
|
||||
@@ -15,6 +34,19 @@ class WangTile:
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class WangColor:
|
||||
"""A color that can be used to define the corner and/or edge of a Wang tile
|
||||
|
||||
[TMX Reference](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#wangcolor)
|
||||
|
||||
[JSON Reference](https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-color)
|
||||
|
||||
Attributes:
|
||||
color: An RGBA color used to identify this Wang color
|
||||
name: The name for this color
|
||||
probability: The probability used when randomizing tiles
|
||||
properties: The properties for this wang color
|
||||
tile: Tile ID of the tile representing this color
|
||||
"""
|
||||
|
||||
color: Color
|
||||
name: str
|
||||
@@ -25,6 +57,22 @@ class WangColor:
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class WangSet:
|
||||
"""A complete Wang Set defining a list of corner and edge
|
||||
[WangColors][pytiled_parser.wang_set.WangColor], and any number of
|
||||
[WangTiles][pytiled_parser.wang_set.WangTile]
|
||||
|
||||
[TMX Reference](https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#wangset)
|
||||
|
||||
[JSON Reference](https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-set)
|
||||
|
||||
Attributes:
|
||||
name: Name of the WangSet
|
||||
properties: The properties for this wang set
|
||||
tile: Tile ID of the tile representing this Wang Set
|
||||
wang_colors: A list of [WangColors][pytiled_parser.wang_set.WangColor]
|
||||
wang_tiles: A list of [WangTiles][pytiled_parser.wang_set.WangTile]
|
||||
wang_type: A string noting the type of this wang set
|
||||
"""
|
||||
|
||||
name: str
|
||||
tile: int
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
"""This module provides an implementation for World files from Tiled.
|
||||
|
||||
See [Tiled's docs for Worlds](https://doc.mapeditor.org/en/stable/manual/worlds/)
|
||||
for more info about worlds and how to use them.
|
||||
|
||||
The functionality within PyTiled Parser is to load the world and outline the size
|
||||
and position of each map, and provide the path to the map file. Loading a world
|
||||
does not automatically load each map within the world, this is so that the game
|
||||
or engine implementation can decide how to handle map loading.
|
||||
"""
|
||||
|
||||
import json
|
||||
import re
|
||||
from os import listdir
|
||||
@@ -9,28 +20,49 @@ import attr
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
from pytiled_parser.common_types import OrderedPair, Size
|
||||
from pytiled_parser.parser import parse_map
|
||||
from pytiled_parser.tiled_map import TiledMap
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class WorldMap:
|
||||
"""Represents a map within a world.
|
||||
|
||||
tiled_map: TiledMap
|
||||
This object can be accessed to load in a map after loading the world.
|
||||
|
||||
This class translates to each object within the `maps` list of a
|
||||
World file
|
||||
|
||||
Attributes:
|
||||
map_file: A Path object to the map file, can be passed to
|
||||
[parse_map][pytiled_parser.parser.parse_map]
|
||||
size: The size of the map in pixels
|
||||
coordinates: The position of the map within the world in pixels
|
||||
"""
|
||||
|
||||
map_file: Path
|
||||
size: Size
|
||||
coordinates: OrderedPair
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class World:
|
||||
"""Represents a world file.
|
||||
|
||||
Attributes:
|
||||
maps: The list of maps within the world. These are not fully parsed
|
||||
[TiledMap][pytiled_parser.tiled_map.TiledMap] objects, but rather
|
||||
[WorldMap][pytiled_parser.world.WorldMap] objects which can be used
|
||||
to later parse each individual map.
|
||||
only_show_adjacent: Largely only used by the Tiled editor to determine
|
||||
if only maps adjacent to the active one should be displayed. This
|
||||
could be used to determine implementation behavior as well though
|
||||
to toggle auto-loading of adjacent maps or something of the sort.
|
||||
"""
|
||||
|
||||
maps: List[WorldMap]
|
||||
only_show_adjacent: bool = False
|
||||
|
||||
|
||||
class RawPattern(TypedDict):
|
||||
"""The keys and their types that appear in a Pattern JSON Object."""
|
||||
|
||||
regexp: str
|
||||
multiplierX: float
|
||||
multiplierY: float
|
||||
@@ -39,8 +71,6 @@ class RawPattern(TypedDict):
|
||||
|
||||
|
||||
class RawWorldMap(TypedDict):
|
||||
"""The keys and their types that appear in a WorldMap JSON Object."""
|
||||
|
||||
fileName: str
|
||||
height: float
|
||||
width: float
|
||||
@@ -49,8 +79,6 @@ class RawWorldMap(TypedDict):
|
||||
|
||||
|
||||
class RawWorld(TypedDict):
|
||||
"""The keys and their types that appear in a World JSON Object."""
|
||||
|
||||
maps: List[RawWorldMap]
|
||||
patterns: List[RawPattern]
|
||||
onlyShowAdjacentMaps: bool
|
||||
@@ -66,10 +94,8 @@ def _parse_world_map(raw_world_map: RawWorldMap, map_file: Path) -> WorldMap:
|
||||
Returns:
|
||||
WorldMap: The parsed WorldMap object
|
||||
"""
|
||||
tiled_map = parse_map(map_file)
|
||||
|
||||
return WorldMap(
|
||||
tiled_map=tiled_map,
|
||||
map_file=map_file,
|
||||
size=Size(raw_world_map["width"], raw_world_map["height"]),
|
||||
coordinates=OrderedPair(raw_world_map["x"], raw_world_map["y"]),
|
||||
)
|
||||
@@ -82,7 +108,7 @@ def parse_world(file: Path) -> World:
|
||||
file: Path to the world's file
|
||||
|
||||
Returns:
|
||||
World: A properly parsed World
|
||||
World: A properly parsed [World][pytiled_parser.world.World]
|
||||
"""
|
||||
|
||||
with open(file) as world_file:
|
||||
|
||||
13
setup.cfg
13
setup.cfg
@@ -52,16 +52,9 @@ build =
|
||||
pep517
|
||||
|
||||
docs =
|
||||
sphinx
|
||||
sphinx_rtd_theme
|
||||
|
||||
[build_sphinx]
|
||||
source-dir = docs
|
||||
build-dir = docs/build
|
||||
all_files = 1
|
||||
|
||||
[upload-sphinx]
|
||||
upload-dir = docs/build/html
|
||||
mkdocs
|
||||
mkdocs-material
|
||||
mkdocstrings
|
||||
|
||||
[bdist_wheel]
|
||||
universal=0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from pathlib import Path
|
||||
|
||||
from pytiled_parser import common_types, layer, tiled_map, tileset, world
|
||||
from pytiled_parser import common_types, world
|
||||
|
||||
EXPECTED = world.World(
|
||||
only_show_adjacent=False,
|
||||
@@ -8,173 +8,23 @@ EXPECTED = world.World(
|
||||
world.WorldMap(
|
||||
size=common_types.Size(160, 160),
|
||||
coordinates=common_types.OrderedPair(-160, 0),
|
||||
tiled_map=tiled_map.TiledMap(
|
||||
map_file=Path(Path(__file__).parent / "map_manual_one.json")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
infinite=False,
|
||||
map_size=common_types.Size(5, 5),
|
||||
next_layer_id=2,
|
||||
next_object_id=1,
|
||||
orientation="orthogonal",
|
||||
render_order="right-down",
|
||||
tiled_version="1.6.0",
|
||||
tile_size=common_types.Size(32, 32),
|
||||
version="1.6",
|
||||
tilesets={
|
||||
1: tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path(
|
||||
Path(__file__).parent
|
||||
/ "../../images/tmw_desert_spacing.png"
|
||||
)
|
||||
.absolute()
|
||||
.resolve(),
|
||||
image_width=265,
|
||||
image_height=199,
|
||||
firstgid=1,
|
||||
margin=1,
|
||||
spacing=1,
|
||||
name="tileset",
|
||||
tile_count=48,
|
||||
tiled_version="1.6.0",
|
||||
tile_height=32,
|
||||
tile_width=32,
|
||||
version="1.6",
|
||||
type="tileset",
|
||||
)
|
||||
},
|
||||
layers=[
|
||||
layer.TileLayer(
|
||||
name="Tile Layer 1",
|
||||
opacity=1,
|
||||
visible=True,
|
||||
id=1,
|
||||
size=common_types.Size(5, 5),
|
||||
data=[
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
map_file=Path(Path(__file__).parent / "map_manual_one.json")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
),
|
||||
world.WorldMap(
|
||||
size=common_types.Size(160, 160),
|
||||
coordinates=common_types.OrderedPair(0, 0),
|
||||
tiled_map=tiled_map.TiledMap(
|
||||
map_file=Path(Path(__file__).parent / "map_p0-n0.json")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
infinite=False,
|
||||
map_size=common_types.Size(5, 5),
|
||||
next_layer_id=2,
|
||||
next_object_id=1,
|
||||
orientation="orthogonal",
|
||||
render_order="right-down",
|
||||
tiled_version="1.6.0",
|
||||
tile_size=common_types.Size(32, 32),
|
||||
version="1.6",
|
||||
tilesets={
|
||||
1: tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path(
|
||||
Path(__file__).parent
|
||||
/ "../../images/tmw_desert_spacing.png"
|
||||
)
|
||||
.absolute()
|
||||
.resolve(),
|
||||
image_width=265,
|
||||
image_height=199,
|
||||
firstgid=1,
|
||||
margin=1,
|
||||
spacing=1,
|
||||
name="tileset",
|
||||
tile_count=48,
|
||||
tiled_version="1.6.0",
|
||||
tile_height=32,
|
||||
tile_width=32,
|
||||
version="1.6",
|
||||
type="tileset",
|
||||
)
|
||||
},
|
||||
layers=[
|
||||
layer.TileLayer(
|
||||
name="Tile Layer 1",
|
||||
opacity=1,
|
||||
visible=True,
|
||||
id=1,
|
||||
size=common_types.Size(5, 5),
|
||||
data=[
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
map_file=Path(Path(__file__).parent / "map_p0-n0.json")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
),
|
||||
world.WorldMap(
|
||||
size=common_types.Size(160, 160),
|
||||
coordinates=common_types.OrderedPair(0, 160),
|
||||
tiled_map=tiled_map.TiledMap(
|
||||
map_file=Path(Path(__file__).parent / "map_p0-n1.json")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
infinite=False,
|
||||
map_size=common_types.Size(5, 5),
|
||||
next_layer_id=2,
|
||||
next_object_id=1,
|
||||
orientation="orthogonal",
|
||||
render_order="right-down",
|
||||
tiled_version="1.6.0",
|
||||
tile_size=common_types.Size(32, 32),
|
||||
version="1.6",
|
||||
tilesets={
|
||||
1: tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path(
|
||||
Path(__file__).parent
|
||||
/ "../../images/tmw_desert_spacing.png"
|
||||
)
|
||||
.absolute()
|
||||
.resolve(),
|
||||
image_width=265,
|
||||
image_height=199,
|
||||
firstgid=1,
|
||||
margin=1,
|
||||
spacing=1,
|
||||
name="tileset",
|
||||
tile_count=48,
|
||||
tiled_version="1.6.0",
|
||||
tile_height=32,
|
||||
tile_width=32,
|
||||
version="1.6",
|
||||
type="tileset",
|
||||
)
|
||||
},
|
||||
layers=[
|
||||
layer.TileLayer(
|
||||
name="Tile Layer 1",
|
||||
opacity=1,
|
||||
visible=True,
|
||||
id=1,
|
||||
size=common_types.Size(5, 5),
|
||||
data=[
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
map_file=Path(Path(__file__).parent / "map_p0-n1.json")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -8,116 +8,16 @@ EXPECTED = world.World(
|
||||
world.WorldMap(
|
||||
size=common_types.Size(160, 160),
|
||||
coordinates=common_types.OrderedPair(0, 0),
|
||||
tiled_map=tiled_map.TiledMap(
|
||||
map_file=Path(Path(__file__).parent / "map_p0-n0.json")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
infinite=False,
|
||||
map_size=common_types.Size(5, 5),
|
||||
next_layer_id=2,
|
||||
next_object_id=1,
|
||||
orientation="orthogonal",
|
||||
render_order="right-down",
|
||||
tiled_version="1.6.0",
|
||||
tile_size=common_types.Size(32, 32),
|
||||
version="1.6",
|
||||
tilesets={
|
||||
1: tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path(
|
||||
Path(__file__).parent
|
||||
/ "../../images/tmw_desert_spacing.png"
|
||||
)
|
||||
.absolute()
|
||||
.resolve(),
|
||||
image_width=265,
|
||||
image_height=199,
|
||||
firstgid=1,
|
||||
margin=1,
|
||||
spacing=1,
|
||||
name="tileset",
|
||||
tile_count=48,
|
||||
tiled_version="1.6.0",
|
||||
tile_height=32,
|
||||
tile_width=32,
|
||||
version="1.6",
|
||||
type="tileset",
|
||||
)
|
||||
},
|
||||
layers=[
|
||||
layer.TileLayer(
|
||||
name="Tile Layer 1",
|
||||
opacity=1,
|
||||
visible=True,
|
||||
id=1,
|
||||
size=common_types.Size(5, 5),
|
||||
data=[
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
map_file=Path(Path(__file__).parent / "map_p0-n0.json")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
),
|
||||
world.WorldMap(
|
||||
size=common_types.Size(160, 160),
|
||||
coordinates=common_types.OrderedPair(0, 160),
|
||||
tiled_map=tiled_map.TiledMap(
|
||||
map_file=Path(Path(__file__).parent / "map_p0-n1.json")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
infinite=False,
|
||||
map_size=common_types.Size(5, 5),
|
||||
next_layer_id=2,
|
||||
next_object_id=1,
|
||||
orientation="orthogonal",
|
||||
render_order="right-down",
|
||||
tiled_version="1.6.0",
|
||||
tile_size=common_types.Size(32, 32),
|
||||
version="1.6",
|
||||
tilesets={
|
||||
1: tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path(
|
||||
Path(__file__).parent
|
||||
/ "../../images/tmw_desert_spacing.png"
|
||||
)
|
||||
.absolute()
|
||||
.resolve(),
|
||||
image_width=265,
|
||||
image_height=199,
|
||||
firstgid=1,
|
||||
margin=1,
|
||||
spacing=1,
|
||||
name="tileset",
|
||||
tile_count=48,
|
||||
tiled_version="1.6.0",
|
||||
tile_height=32,
|
||||
tile_width=32,
|
||||
version="1.6",
|
||||
type="tileset",
|
||||
)
|
||||
},
|
||||
layers=[
|
||||
layer.TileLayer(
|
||||
name="Tile Layer 1",
|
||||
opacity=1,
|
||||
visible=True,
|
||||
id=1,
|
||||
size=common_types.Size(5, 5),
|
||||
data=[
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
map_file=Path(Path(__file__).parent / "map_p0-n1.json")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -8,116 +8,12 @@ EXPECTED = world.World(
|
||||
world.WorldMap(
|
||||
size=common_types.Size(160, 160),
|
||||
coordinates=common_types.OrderedPair(0, 0),
|
||||
tiled_map=tiled_map.TiledMap(
|
||||
map_file=Path(Path(__file__).parent / "map_01.json")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
infinite=False,
|
||||
map_size=common_types.Size(5, 5),
|
||||
next_layer_id=2,
|
||||
next_object_id=1,
|
||||
orientation="orthogonal",
|
||||
render_order="right-down",
|
||||
tiled_version="1.6.0",
|
||||
tile_size=common_types.Size(32, 32),
|
||||
version="1.6",
|
||||
tilesets={
|
||||
1: tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path(
|
||||
Path(__file__).parent
|
||||
/ "../../images/tmw_desert_spacing.png"
|
||||
)
|
||||
.absolute()
|
||||
.resolve(),
|
||||
image_width=265,
|
||||
image_height=199,
|
||||
firstgid=1,
|
||||
margin=1,
|
||||
spacing=1,
|
||||
name="tileset",
|
||||
tile_count=48,
|
||||
tiled_version="1.6.0",
|
||||
tile_height=32,
|
||||
tile_width=32,
|
||||
version="1.6",
|
||||
type="tileset",
|
||||
)
|
||||
},
|
||||
layers=[
|
||||
layer.TileLayer(
|
||||
name="Tile Layer 1",
|
||||
opacity=1,
|
||||
visible=True,
|
||||
id=1,
|
||||
size=common_types.Size(5, 5),
|
||||
data=[
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
map_file=Path(Path(__file__).parent / "map_01.json").absolute().resolve(),
|
||||
),
|
||||
world.WorldMap(
|
||||
size=common_types.Size(160, 160),
|
||||
coordinates=common_types.OrderedPair(160, 0),
|
||||
tiled_map=tiled_map.TiledMap(
|
||||
map_file=Path(Path(__file__).parent / "map_02.json")
|
||||
.absolute()
|
||||
.resolve(),
|
||||
infinite=False,
|
||||
map_size=common_types.Size(5, 5),
|
||||
next_layer_id=2,
|
||||
next_object_id=1,
|
||||
orientation="orthogonal",
|
||||
render_order="right-down",
|
||||
tiled_version="1.6.0",
|
||||
tile_size=common_types.Size(32, 32),
|
||||
version="1.6",
|
||||
tilesets={
|
||||
1: tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path(
|
||||
Path(__file__).parent
|
||||
/ "../../images/tmw_desert_spacing.png"
|
||||
)
|
||||
.absolute()
|
||||
.resolve(),
|
||||
image_width=265,
|
||||
image_height=199,
|
||||
firstgid=1,
|
||||
margin=1,
|
||||
spacing=1,
|
||||
name="tileset",
|
||||
tile_count=48,
|
||||
tiled_version="1.6.0",
|
||||
tile_height=32,
|
||||
tile_width=32,
|
||||
version="1.6",
|
||||
type="tileset",
|
||||
)
|
||||
},
|
||||
layers=[
|
||||
layer.TileLayer(
|
||||
name="Tile Layer 1",
|
||||
opacity=1,
|
||||
visible=True,
|
||||
id=1,
|
||||
size=common_types.Size(5, 5),
|
||||
data=[
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
[30, 30, 30, 30, 30],
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
map_file=Path(Path(__file__).parent / "map_02.json").absolute().resolve(),
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user