@@ -39,60 +39,60 @@ type ObjectGroup struct {
3939 // Unique ID of the layer.
4040 // Each layer that added to a map gets a unique id. Even if a layer is deleted,
4141 // no layer ever gets the same ID. Can not be changed in Tiled. (since Tiled 1.2)
42- ID uint32 `xml:"id,attr"`
42+ ID uint32 `xml:"id,attr,omitempty "`
4343 // The name of the object group.
44- Name string `xml:"name,attr"`
44+ Name string `xml:"name,attr,omitempty "`
4545 // The color used to display the objects in this group.
46- Color * HexColor `xml:"color,attr"`
46+ Color * HexColor `xml:"color,attr,omitempty "`
4747 // The opacity of the layer as a value from 0 to 1. Defaults to 1.
48- Opacity float32 `xml:"opacity,attr"`
48+ Opacity float32 `xml:"opacity,attr,omitempty "`
4949 // Whether the layer is shown (1) or hidden (0). Defaults to 1.
50- Visible bool `xml:"visible,attr"`
50+ Visible * bool `xml:"visible,attr"`
5151 // Rendering offset for this layer in pixels. Defaults to 0. (since 0.14)
52- OffsetX int `xml:"offsetx,attr"`
52+ OffsetX int `xml:"offsetx,attr,omitempty "`
5353 // Rendering offset for this layer in pixels. Defaults to 0. (since 0.14)
54- OffsetY int `xml:"offsety,attr"`
54+ OffsetY int `xml:"offsety,attr,omitempty "`
5555 // Whether the objects are drawn according to the order of appearance ("index") or sorted by their y-coordinate ("topdown"). Defaults to "topdown".
56- DrawOrder string `xml:"draworder,attr"`
56+ DrawOrder string `xml:"draworder,attr,omitempty "`
5757 // Custom properties
58- Properties Properties `xml:"properties>property "`
58+ Properties * Properties `xml:"properties,omitempty "`
5959 // Group objects
60- Objects []* Object `xml:"object"`
60+ Objects []* Object `xml:"object,omitempty "`
6161}
6262
6363// Object is used to add custom information to your tile map, such as spawn points, warps, exits, etc.
6464type Object struct {
6565 // Unique ID of the object. Each object that is placed on a map gets a unique id. Even if an object was deleted, no object gets the same ID.
6666 // Can not be changed in Tiled Qt. (since Tiled 0.11)
67- ID uint32 `xml:"id,attr"`
67+ ID uint32 `xml:"id,attr,omitempty "`
6868 // The name of the object. An arbitrary string.
69- Name string `xml:"name,attr"`
69+ Name string `xml:"name,attr,omitempty "`
7070 // The type of the object. An arbitrary string.
71- Type string `xml:"type,attr"`
71+ Type string `xml:"type,attr,omitempty "`
7272 // The x coordinate of the object.
73- X float64 `xml:"x,attr"`
73+ X float64 `xml:"x,attr,omitempty "`
7474 // The y coordinate of the object.
75- Y float64 `xml:"y,attr"`
75+ Y float64 `xml:"y,attr,omitempty "`
7676 // The width of the object (defaults to 0).
77- Width float64 `xml:"width,attr"`
77+ Width float64 `xml:"width,attr,omitempty "`
7878 // The height of the object (defaults to 0).
79- Height float64 `xml:"height,attr"`
79+ Height float64 `xml:"height,attr,omitempty "`
8080 // The rotation of the object in degrees clockwise (defaults to 0). (since 0.10)
81- Rotation float64 `xml:"rotation,attr"`
81+ Rotation float64 `xml:"rotation,attr,omitempty "`
8282 // An reference to a tile (optional).
83- GID uint32 `xml:"gid,attr"`
83+ GID uint32 `xml:"gid,attr,omitempty "`
8484 // Whether the object is shown (1) or hidden (0). Defaults to 1. (since 0.9)
85- Visible bool `xml:"visible,attr"`
85+ Visible * bool `xml:"visible,attr"`
8686 // Custom properties
87- Properties Properties `xml:"properties>property "`
87+ Properties * Properties `xml:"properties,omitempty "`
8888 // Used to mark an object as an ellipse. The existing x, y, width and height attributes are used to determine the size of the ellipse.
89- Ellipses []* Ellipse `xml:"ellipse"`
89+ Ellipses []* Ellipse `xml:"ellipse,omitempty "`
9090 // Polygons
91- Polygons []* Polygon `xml:"polygon"`
91+ Polygons []* Polygon `xml:"polygon,omitempty "`
9292 // Poly lines
93- PolyLines []* PolyLine `xml:"polyline"`
93+ PolyLines []* PolyLine `xml:"polyline,omitempty "`
9494 // Text
95- Text * Text `xml:"text"`
95+ Text * Text `xml:"text,omitempty "`
9696}
9797
9898// Ellipse is used to mark an object as an ellipse.
@@ -162,27 +162,27 @@ type Text struct {
162162 // The actual text
163163 Text string `xml:",chardata"`
164164 // The font family used (default: "sans-serif")
165- FontFamily string `xml:"fontfamily,attr"`
165+ FontFamily string `xml:"fontfamily,attr,omitempty "`
166166 // The size of the font in pixels (not using points, because other sizes in the TMX format are also using pixels) (default: 16)
167- Size int `xml:"pixelsize,attr"`
167+ Size int `xml:"pixelsize,attr,omitempty "`
168168 // Whether word wrapping is enabled (1) or disabled (0). Defaults to 0.
169- Wrap bool `xml:"wrap,attr"`
169+ Wrap bool `xml:"wrap,attr,omitempty "`
170170 // Color of the text in #AARRGGBB or #RRGGBB format (default: #000000)
171- Color * HexColor `xml:"color,attr"`
171+ Color * HexColor `xml:"color,attr,omitempty "`
172172 // Whether the font is bold (1) or not (0). Defaults to 0.
173- Bold bool `xml:"bold,attr"`
173+ Bold bool `xml:"bold,attr,omitempty "`
174174 // Whether the font is italic (1) or not (0). Defaults to 0.
175- Italic bool `xml:"italic,attr"`
175+ Italic bool `xml:"italic,attr,omitempty "`
176176 // Whether a line should be drawn below the text (1) or not (0). Defaults to 0.
177- Underline bool `xml:"underline,attr"`
177+ Underline bool `xml:"underline,attr,omitempty "`
178178 // Whether a line should be drawn through the text (1) or not (0). Defaults to 0.
179- Strikethrough bool `xml:"strikeout,attr"`
179+ Strikethrough bool `xml:"strikeout,attr,omitempty "`
180180 // Whether kerning should be used while rendering the text (1) or not (0). Default to 1.
181- Kerning bool `xml:"kerning,attr"`
181+ Kerning * bool `xml:"kerning,attr,omitempty "`
182182 // Horizontal alignment of the text within the object (left (default), center, right or justify (since Tiled 1.2.1))
183- HAlign string `xml:"halign,attr"`
183+ HAlign string `xml:"halign,attr,omitempty "`
184184 // Vertical alignment of the text within the object (top (default), center or bottom)
185- VAlign string `xml:"valign,attr"`
185+ VAlign string `xml:"valign,attr,omitempty "`
186186}
187187
188188// UnmarshalXML decodes a single XML element beginning with the given start element.
@@ -192,7 +192,7 @@ func (t *Text) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
192192 item := Alias {
193193 FontFamily : "sans-serif" ,
194194 Size : 16 ,
195- Kerning : true ,
195+ Kerning : b ( true ) ,
196196 HAlign : "left" ,
197197 VAlign : "top" ,
198198 Color : & HexColor {},
0 commit comments