mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-05-08 15:06:04 +03:00
Read new image size properties in tmj from Tiled 1.11.1
This commit is contained in:
parent
c27049780a
commit
58bb446e2b
4 changed files with 11 additions and 7 deletions
|
@ -19,7 +19,7 @@ public partial class TestData
|
||||||
CompressionLevel = -1,
|
CompressionLevel = -1,
|
||||||
BackgroundColor = new TiledColor { R = 0, G = 0, B = 0, A = 0 },
|
BackgroundColor = new TiledColor { R = 0, G = 0, B = 0, A = 0 },
|
||||||
Version = "1.10",
|
Version = "1.10",
|
||||||
TiledVersion = "1.11.0",
|
TiledVersion = "1.11.2",
|
||||||
NextLayerID = 8,
|
NextLayerID = 8,
|
||||||
NextObjectID = 7,
|
NextObjectID = 7,
|
||||||
Tilesets = [
|
Tilesets = [
|
||||||
|
@ -172,8 +172,8 @@ public partial class TestData
|
||||||
{
|
{
|
||||||
Format = ImageFormat.Png,
|
Format = ImageFormat.Png,
|
||||||
Source = "tileset.png",
|
Source = "tileset.png",
|
||||||
Width = fileExt == "tmx" ? 256 : 0, // Currently, json format does not
|
Width = 256,
|
||||||
Height = fileExt == "tmx" ? 96 : 0 // include image dimensions in image layer https://github.com/mapeditor/tiled/issues/4028
|
Height = 96
|
||||||
},
|
},
|
||||||
RepeatX = true
|
RepeatX = true
|
||||||
},
|
},
|
||||||
|
|
|
@ -114,6 +114,8 @@
|
||||||
{
|
{
|
||||||
"id":4,
|
"id":4,
|
||||||
"image":"tileset.png",
|
"image":"tileset.png",
|
||||||
|
"imageheight":96,
|
||||||
|
"imagewidth":256,
|
||||||
"name":"ImageLayer",
|
"name":"ImageLayer",
|
||||||
"opacity":1,
|
"opacity":1,
|
||||||
"repeatx":true,
|
"repeatx":true,
|
||||||
|
@ -149,7 +151,7 @@
|
||||||
"nextobjectid":7,
|
"nextobjectid":7,
|
||||||
"orientation":"orthogonal",
|
"orientation":"orthogonal",
|
||||||
"renderorder":"right-down",
|
"renderorder":"right-down",
|
||||||
"tiledversion":"1.11.0",
|
"tiledversion":"1.11.2",
|
||||||
"tileheight":32,
|
"tileheight":32,
|
||||||
"tilesets":[
|
"tilesets":[
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="5" height="5" tilewidth="32" tileheight="32" infinite="0" nextlayerid="8" nextobjectid="7">
|
<map version="1.10" tiledversion="1.11.2" orientation="orthogonal" renderorder="right-down" width="5" height="5" tilewidth="32" tileheight="32" infinite="0" nextlayerid="8" nextobjectid="7">
|
||||||
<tileset firstgid="1" source="tileset.tsx"/>
|
<tileset firstgid="1" source="tileset.tsx"/>
|
||||||
<group id="2" name="Root">
|
<group id="2" name="Root">
|
||||||
<objectgroup id="3" name="Objects">
|
<objectgroup id="3" name="Objects">
|
||||||
|
|
|
@ -19,6 +19,8 @@ public abstract partial class TmjReaderBase
|
||||||
var properties = ResolveAndMergeProperties(@class, element.GetOptionalPropertyCustom("properties", ReadProperties).GetValueOr([]));
|
var properties = ResolveAndMergeProperties(@class, element.GetOptionalPropertyCustom("properties", ReadProperties).GetValueOr([]));
|
||||||
|
|
||||||
var image = element.GetRequiredProperty<string>("image");
|
var image = element.GetRequiredProperty<string>("image");
|
||||||
|
var imageWidth = element.GetOptionalProperty<int>("imagewidth").GetValueOr(0);
|
||||||
|
var imageHeight = element.GetOptionalProperty<int>("imageheight").GetValueOr(0);
|
||||||
var repeatX = element.GetOptionalProperty<bool>("repeatx").GetValueOr(false);
|
var repeatX = element.GetOptionalProperty<bool>("repeatx").GetValueOr(false);
|
||||||
var repeatY = element.GetOptionalProperty<bool>("repeaty").GetValueOr(false);
|
var repeatY = element.GetOptionalProperty<bool>("repeaty").GetValueOr(false);
|
||||||
var transparentColor = element.GetOptionalPropertyParseable<TiledColor>("transparentcolor");
|
var transparentColor = element.GetOptionalPropertyParseable<TiledColor>("transparentcolor");
|
||||||
|
@ -28,8 +30,8 @@ public abstract partial class TmjReaderBase
|
||||||
var imgModel = new Image
|
var imgModel = new Image
|
||||||
{
|
{
|
||||||
Format = Helpers.ParseImageFormatFromSource(image),
|
Format = Helpers.ParseImageFormatFromSource(image),
|
||||||
Height = 0,
|
Height = imageHeight,
|
||||||
Width = 0,
|
Width = imageWidth,
|
||||||
Source = image,
|
Source = image,
|
||||||
TransparentColor = transparentColor
|
TransparentColor = transparentColor
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue