Merge pull request #28 from Beefy-Swain/development

v1.3.0 Release
This commit is contained in:
Darren Eberly
2021-03-31 20:49:34 -04:00
committed by GitHub
5 changed files with 37 additions and 3 deletions

View File

@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased]
## [1.3.0] - 2021-03-31
- Added support for Parallax Scroll Factor on Layers. See https://doc.mapeditor.org/en/stable/manual/layers/#parallax-scrolling-factor
- Added support for Tint Colors on Layers. See https://doc.mapeditor.org/en/stable/manual/layers/#tinting-layers
## [1.2.0] - 2021-02-21
### Changed

View File

@@ -56,11 +56,13 @@ class Layer:
visible: bool
coordinates: OrderedPair = OrderedPair(0, 0)
parallax_factor: OrderedPair = OrderedPair(1, 1)
id: Optional[int] = None
size: Optional[Size] = None
offset: Optional[OrderedPair] = None
properties: Optional[properties_.Properties] = None
tint_color: Optional[Color] = None
TileLayerGrid = List[List[int]]
@@ -195,10 +197,13 @@ class RawLayer(TypedDict):
objects: List[tiled_object.RawTiledObject]
offsetx: float
offsety: float
parallaxx: float
parallaxy: float
opacity: float
properties: List[properties_.RawProperty]
startx: int
starty: int
tintcolor: str
transparentcolor: str
type: str
visible: bool
@@ -350,6 +355,14 @@ def _get_common_attributes(raw_layer: RawLayer) -> Layer:
if raw_layer.get("properties") is not None:
common_attributes.properties = properties_.cast(raw_layer["properties"])
if raw_layer.get("parallaxx") is not None:
common_attributes.parallax_factor = OrderedPair(
raw_layer["parallaxx"], raw_layer["parallaxy"]
)
if raw_layer.get("tintcolor") is not None:
common_attributes.tint_color = parse_color(raw_layer["tintcolor"])
return common_attributes

View File

@@ -1,3 +1,3 @@
"""pytiled_parser version"""
__version__ = "1.2.0"
__version__ = "1.3.0"

View File

@@ -10,9 +10,11 @@ EXPECTED = [
id=1,
size=common_types.Size(8, 6),
offset=common_types.OrderedPair(1, 3),
parallax_factor=common_types.OrderedPair(1.4, 1.3),
properties={
"test": "test property",
},
tint_color=common_types.Color(170, 255, 255, 255),
data=[
[
1,
@@ -81,6 +83,8 @@ EXPECTED = [
opacity=1,
visible=True,
id=4,
parallax_factor=common_types.OrderedPair(2.3, 1.2),
tint_color=common_types.Color(0, 0, 255, 255),
layers=[
layer.ObjectLayer(
name="Object Layer 1",
@@ -109,12 +113,14 @@ EXPECTED = [
id=3,
image=Path("../../images/tile_04.png"),
transparent_color=common_types.Color(0, 0, 0, 255),
tint_color=common_types.Color(255, 0, 0, 255),
),
layer.ImageLayer(
name="Image Layer 2",
opacity=1,
visible=True,
id=5,
parallax_factor=common_types.OrderedPair(1.5, 1.2),
image=Path("../../images/tile_04.png"),
),
]

View File

@@ -10,12 +10,15 @@
"offsetx":1,
"offsety":3,
"opacity":1,
"parallaxx":1.4,
"parallaxy":1.3,
"properties":[
{
"name":"test",
"type":"string",
"value":"test property"
}],
"tintcolor":"#aaffff",
"type":"tilelayer",
"visible":true,
"width":8,
@@ -49,6 +52,9 @@
}],
"name":"Group 1",
"opacity":1,
"parallaxx":2.3,
"parallaxy":1.2,
"tintcolor":"#0000ff",
"type":"group",
"visible":true,
"x":0,
@@ -59,6 +65,7 @@
"image":"..\/..\/images\/tile_04.png",
"name":"Image Layer 1",
"opacity":1,
"tintcolor":"#ff0000",
"transparentcolor":"#000000",
"type":"imagelayer",
"visible":true,
@@ -70,6 +77,8 @@
"image":"..\/..\/images\/tile_04.png",
"name":"Image Layer 2",
"opacity":1,
"parallaxx":1.5,
"parallaxy":1.2,
"type":"imagelayer",
"visible":true,
"x":0,
@@ -79,7 +88,7 @@
"nextobjectid":3,
"orientation":"orthogonal",
"renderorder":"right-down",
"tiledversion":"1.4.1",
"tiledversion":"1.5.0",
"tileheight":32,
"tilesets":[
{
@@ -88,6 +97,6 @@
}],
"tilewidth":32,
"type":"map",
"version":1.4,
"version":1.5,
"width":8
}