Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for reading tile properties. #5

Merged
merged 3 commits into from
May 1, 2015
Merged

Added support for reading tile properties. #5

merged 3 commits into from
May 1, 2015

Conversation

adtennant
Copy link
Contributor

Add support for reading tile properties from the tileset for both XML and JSON.

@baylej
Copy link
Owner

baylej commented Apr 27, 2015

Hi @adtennant,

Thank you for your contribution.

My feedback on your pull request:

Rename _tmx_tile_props → _tmx_tile (tmx_tile_props → tmx_tile)

As you can see in the TMX file format page, section <tile>, there is a <tile> node that may contain properties, an image, an objectgroup.
I believe I or someone else will add these features someday.
As the <tile> node is not dedicated to properties, I think you should remove the '_props' suffix.

If you agree with me, don't forget to rename the alloc, free, json and xml functions too.

Otherwise, everything looks good to me.

} else {
/* Unknow element, skipping it's tree */
if (xmlTextReaderNext(reader) != 1) return 0;
printf("skipped %s\n", name);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line.

@adtennant
Copy link
Contributor Author

@baylej Thanks for the feedback, I'll make the changes sometime later this week. I missed the line in the documentation that mentioned it could also contain an image or objectgroup.

So far I've only implemented what I need for my current project, but if someone else doesn't get around to it I'm sure when I have the time I will add the other features.

@@ -129,6 +136,8 @@ void tmx_map_free(tmx_map *map);
of the tile associated with this gid, returns NULL if it fails */
tmx_tileset* tmx_get_tile(tmx_map *map, unsigned int gid, unsigned int *x, unsigned int *y);

tmx_tile_prop* tmx_get_tile_props(tmx_map *map, unsigned int gid);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment to describe what the function does.

@adtennant
Copy link
Contributor Author

@baylej The last commit should incorporate all of your feedback.

baylej added a commit that referenced this pull request May 1, 2015
Added support for reading tile properties.
@baylej baylej merged commit b85d805 into baylej:master May 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants