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
4884a1cc
Commit
4884a1cc
authored
7 years ago
by
Matthew Hall
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #36 from Nnubes256/Nnubes256-patch-1
Parse rotation on entities
parents
dfedaa63
b25445da
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
+6
-2
6 additions, 2 deletions
src/lib.rs
with
6 additions
and
2 deletions
src/lib.rs
+
6
−
2
View file @
4884a1cc
...
...
@@ -578,6 +578,7 @@ pub struct Object {
pub
obj_type
:
String
,
pub
x
:
f32
,
pub
y
:
f32
,
pub
rotation
:
f32
,
pub
visible
:
bool
,
pub
shape
:
ObjectShape
,
pub
properties
:
Properties
,
...
...
@@ -585,7 +586,7 @@ pub struct Object {
impl
Object
{
fn
new
<
R
:
Read
>
(
parser
:
&
mut
EventReader
<
R
>
,
attrs
:
Vec
<
OwnedAttribute
>
)
->
Result
<
Object
,
TiledError
>
{
let
((
id
,
gid
,
n
,
t
,
w
,
h
,
v
),
(
x
,
y
))
=
get_attrs!
(
let
((
id
,
gid
,
n
,
t
,
w
,
h
,
v
,
r
),
(
x
,
y
))
=
get_attrs!
(
attrs
,
optionals
:
[(
"id"
,
id
,
|
v
:
String
|
v
.parse
()
.ok
()),
(
"gid"
,
gid
,
|
v
:
String
|
v
.parse
()
.ok
()),
...
...
@@ -593,13 +594,15 @@ impl Object {
(
"type"
,
obj_type
,
|
v
:
String
|
v
.parse
()
.ok
()),
(
"width"
,
width
,
|
v
:
String
|
v
.parse
()
.ok
()),
(
"height"
,
height
,
|
v
:
String
|
v
.parse
()
.ok
()),
(
"visible"
,
visible
,
|
v
:
String
|
v
.parse
()
.ok
())],
(
"visible"
,
visible
,
|
v
:
String
|
v
.parse
()
.ok
()),
(
"rotation"
,
rotation
,
|
v
:
String
|
v
.parse
()
.ok
())],
required
:
[(
"x"
,
x
,
|
v
:
String
|
v
.parse
()
.ok
()),
(
"y"
,
y
,
|
v
:
String
|
v
.parse
()
.ok
())],
TiledError
::
MalformedAttributes
(
"objects must have an x and a y number"
.to_string
()));
let
v
=
v
.unwrap_or
(
true
);
let
w
=
w
.unwrap_or
(
0f32
);
let
h
=
h
.unwrap_or
(
0f32
);
let
r
=
r
.unwrap_or
(
0f32
);
let
id
=
id
.unwrap_or
(
0u32
);
let
gid
=
gid
.unwrap_or
(
0u32
);
let
n
=
n
.unwrap_or
(
String
::
new
());
...
...
@@ -642,6 +645,7 @@ impl Object {
obj_type
:
t
.clone
(),
x
:
x
,
y
:
y
,
rotation
:
r
,
visible
:
v
,
shape
:
shape
,
properties
:
properties
,
...
...
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