mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2025-12-26 17:02:28 +01:00
refactor(tileset): Renamed TileSet class to Tileset
This commit is contained in:
@@ -6,4 +6,4 @@ from .common_types import OrderedPair, Size
|
||||
from .layer import Layer
|
||||
from .properties import Properties
|
||||
from .tiled_map import Map
|
||||
from .tileset import TileSet
|
||||
from .tileset import Tileset
|
||||
|
||||
@@ -12,9 +12,9 @@ from . import layer, properties, tileset
|
||||
from .common_types import Color, Size
|
||||
from .layer import Layer, RawLayer
|
||||
from .properties import Properties, RawProperty
|
||||
from .tileset import RawTileSet, TileSet
|
||||
from .tileset import RawTileSet, Tileset
|
||||
|
||||
TilesetDict = Dict[int, TileSet]
|
||||
TilesetDict = Dict[int, Tileset]
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
|
||||
@@ -7,7 +7,6 @@ from typing_extensions import TypedDict
|
||||
|
||||
from . import layer
|
||||
from . import properties as properties_
|
||||
from . import tiled_object
|
||||
from .common_types import Color, OrderedPair
|
||||
|
||||
|
||||
@@ -102,15 +101,14 @@ class Tile:
|
||||
image_width: Optional[int] = None
|
||||
image_height: Optional[int] = None
|
||||
properties: Optional[properties_.Properties] = None
|
||||
tileset: Optional["TileSet"] = None
|
||||
tileset: Optional["Tileset"] = None
|
||||
flipped_horizontally: bool = False
|
||||
flipped_diagonally: bool = False
|
||||
flipped_vertically: bool = False
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
class TileSet:
|
||||
# FIXME: rename to Tileset
|
||||
class Tileset:
|
||||
"""Object for storing a TSX with all associated collision data.
|
||||
|
||||
Args:
|
||||
@@ -353,7 +351,7 @@ def _cast_grid(raw_grid: RawGrid) -> Grid:
|
||||
)
|
||||
|
||||
|
||||
def cast(raw_tileset: RawTileSet) -> TileSet:
|
||||
def cast(raw_tileset: RawTileSet) -> Tileset:
|
||||
""" Cast the raw tileset into a pytiled_parser type
|
||||
|
||||
Args:
|
||||
@@ -363,7 +361,7 @@ def cast(raw_tileset: RawTileSet) -> TileSet:
|
||||
TileSet: a properly typed TileSet.
|
||||
"""
|
||||
|
||||
tileset = TileSet(
|
||||
tileset = Tileset(
|
||||
name=raw_tileset["name"],
|
||||
tile_count=raw_tileset["tilecount"],
|
||||
tile_width=raw_tileset["tilewidth"],
|
||||
|
||||
@@ -14,7 +14,7 @@ EXPECTED = tiled_map.Map(
|
||||
tile_size=common_types.Size(32, 32),
|
||||
version=1.4,
|
||||
tilesets={
|
||||
1: tileset.TileSet(
|
||||
1: tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path("../../images/tmw_desert_spacing.png"),
|
||||
image_width=265,
|
||||
|
||||
@@ -127,7 +127,7 @@ EXPECTED = tiled_map.Map(
|
||||
tile_size=common_types.Size(14, 12),
|
||||
version=1.4,
|
||||
tilesets={
|
||||
1: tileset.TileSet(
|
||||
1: tileset.Tileset(
|
||||
columns=5,
|
||||
image=Path("../../images/hexmini.png"),
|
||||
image_width=106,
|
||||
|
||||
@@ -14,7 +14,7 @@ EXPECTED = tiled_map.Map(
|
||||
tile_size=common_types.Size(32, 32),
|
||||
version=1.4,
|
||||
tilesets={
|
||||
1: tileset.TileSet(
|
||||
1: tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path("../../images/tmw_desert_spacing.png"),
|
||||
image_width=265,
|
||||
|
||||
@@ -15,7 +15,7 @@ EXPECTED = tiled_map.Map(
|
||||
version=1.4,
|
||||
background_color=common_types.Color("#ff0004"),
|
||||
tilesets={
|
||||
1: tileset.TileSet(
|
||||
1: tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path("../../images/tmw_desert_spacing.png"),
|
||||
image_width=265,
|
||||
|
||||
@@ -2,7 +2,7 @@ from pathlib import Path
|
||||
|
||||
from pytiled_parser import tileset
|
||||
|
||||
EXPECTED = tileset.TileSet(
|
||||
EXPECTED = tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path("../../images/tmw_desert_spacing.png"),
|
||||
image_height=199,
|
||||
|
||||
@@ -3,7 +3,7 @@ from pathlib import Path
|
||||
from pytiled_parser import tileset
|
||||
from pytiled_parser.common_types import Color
|
||||
|
||||
EXPECTED = tileset.TileSet(
|
||||
EXPECTED = tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path("../../images/tmw_desert_spacing.png"),
|
||||
image_height=199,
|
||||
|
||||
@@ -2,7 +2,7 @@ from pathlib import Path
|
||||
|
||||
from pytiled_parser import tileset
|
||||
|
||||
EXPECTED = tileset.TileSet(
|
||||
EXPECTED = tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path("../../images/tmw_desert_spacing.png"),
|
||||
image_height=199,
|
||||
|
||||
@@ -3,7 +3,7 @@ from pathlib import Path
|
||||
from pytiled_parser import tileset
|
||||
from pytiled_parser.common_types import Color
|
||||
|
||||
EXPECTED = tileset.TileSet(
|
||||
EXPECTED = tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path("../../images/tmw_desert_spacing.png"),
|
||||
image_height=199,
|
||||
|
||||
@@ -3,7 +3,7 @@ from pathlib import Path
|
||||
from pytiled_parser import tileset
|
||||
from pytiled_parser.common_types import Color, OrderedPair
|
||||
|
||||
EXPECTED = tileset.TileSet(
|
||||
EXPECTED = tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path("../../images/tmw_desert_spacing.png"),
|
||||
image_height=199,
|
||||
|
||||
@@ -3,7 +3,7 @@ from pathlib import Path
|
||||
from pytiled_parser import tileset
|
||||
from pytiled_parser.common_types import Color
|
||||
|
||||
EXPECTED = tileset.TileSet(
|
||||
EXPECTED = tileset.Tileset(
|
||||
columns=8,
|
||||
image=Path("../../images/tmw_desert_spacing.png"),
|
||||
image_height=199,
|
||||
|
||||
@@ -2,7 +2,7 @@ from pathlib import Path
|
||||
|
||||
from pytiled_parser import common_types, layer, tiled_object, tileset
|
||||
|
||||
EXPECTED = tileset.TileSet(
|
||||
EXPECTED = tileset.Tileset(
|
||||
columns=0,
|
||||
margin=0,
|
||||
spacing=0,
|
||||
|
||||
@@ -2,7 +2,7 @@ from pathlib import Path
|
||||
|
||||
from pytiled_parser import common_types, layer, tileset
|
||||
|
||||
EXPECTED = tileset.TileSet(
|
||||
EXPECTED = tileset.Tileset(
|
||||
columns=8,
|
||||
margin=1,
|
||||
spacing=1,
|
||||
|
||||
Reference in New Issue
Block a user