Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
rs-tiled
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
rs-tiled
Commits
d603b761
Unverified
Commit
d603b761
authored
5 years ago
by
Matt Hall
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #78 from JoNil/pr2
Added Optional tilecount to Tileset
parents
290d805c
c0390646
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib.rs
+7
-2
7 additions, 2 deletions
src/lib.rs
with
7 additions
and
2 deletions
src/lib.rs
+
7
−
2
View file @
d603b761
...
...
@@ -353,6 +353,7 @@ pub struct Tileset {
pub
tile_height
:
u32
,
pub
spacing
:
u32
,
pub
margin
:
u32
,
pub
tilecount
:
Option
<
u32
>
,
/// The Tiled spec says that a tileset can have mutliple images so a `Vec`
/// is used. Usually you will only use one.
pub
images
:
Vec
<
Image
>
,
...
...
@@ -372,11 +373,12 @@ impl Tileset {
parser
:
&
mut
EventReader
<
R
>
,
attrs
:
&
Vec
<
OwnedAttribute
>
,
)
->
Result
<
Tileset
,
TiledError
>
{
let
((
spacing
,
margin
),
(
first_gid
,
name
,
width
,
height
))
=
get_attrs!
(
let
((
spacing
,
margin
,
tilecount
),
(
first_gid
,
name
,
width
,
height
))
=
get_attrs!
(
attrs
,
optionals
:
[
(
"spacing"
,
spacing
,
|
v
:
String
|
v
.parse
()
.ok
()),
(
"margin"
,
margin
,
|
v
:
String
|
v
.parse
()
.ok
()),
(
"tilecount"
,
tilecount
,
|
v
:
String
|
v
.parse
()
.ok
()),
],
required
:
[
(
"firstgid"
,
first_gid
,
|
v
:
String
|
v
.parse
()
.ok
()),
...
...
@@ -407,6 +409,7 @@ impl Tileset {
tile_height
:
height
,
spacing
:
spacing
.unwrap_or
(
0
),
margin
:
margin
.unwrap_or
(
0
),
tilecount
:
tilecount
,
images
:
images
,
tiles
:
tiles
,
})
...
...
@@ -469,11 +472,12 @@ impl Tileset {
parser
:
&
mut
EventReader
<
R
>
,
attrs
:
&
Vec
<
OwnedAttribute
>
,
)
->
Result
<
Tileset
,
TiledError
>
{
let
((
spacing
,
margin
),
(
name
,
width
,
height
))
=
get_attrs!
(
let
((
spacing
,
margin
,
tilecount
),
(
name
,
width
,
height
))
=
get_attrs!
(
attrs
,
optionals
:
[
(
"spacing"
,
spacing
,
|
v
:
String
|
v
.parse
()
.ok
()),
(
"margin"
,
margin
,
|
v
:
String
|
v
.parse
()
.ok
()),
(
"tilecount"
,
tilecount
,
|
v
:
String
|
v
.parse
()
.ok
()),
],
required
:
[
(
"name"
,
name
,
|
v
|
Some
(
v
)),
...
...
@@ -503,6 +507,7 @@ impl Tileset {
tile_height
:
height
,
spacing
:
spacing
.unwrap_or
(
0
),
margin
:
margin
.unwrap_or
(
0
),
tilecount
:
tilecount
,
images
:
images
,
tiles
:
tiles
,
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment