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

Are .tsx resources supported? #1

Open
andrewrk opened this issue Aug 6, 2014 · 5 comments
Open

Are .tsx resources supported? #1

andrewrk opened this issue Aug 6, 2014 · 5 comments
Labels

Comments

@andrewrk
Copy link
Collaborator

andrewrk commented Aug 6, 2014

https://code.google.com/p/tmx-parser/issues/detail?id=5

What steps will reproduce the problem?

  1. Use Tiled to export a tileset as .tsx file
  2. Use Tiled to create a new .tmx map and add the .tsx file as a tileset
  3. Use tmx-parser to load the map in the usual way.

What is the expected output? What do you see instead?

Are map files that link to external .tsx tileset resources supported? When I use these, the parser causes a crash. When I just move the resources from the .tsx file back into the .tmx file, everything works correctly.

Thanks,
Fritz

@andrewrk andrewrk added the bug label Aug 6, 2014
@mwhiter
Copy link

mwhiter commented Sep 6, 2014

I didn't see a fix posted for this, so I wrote one myself. I changed the code in Tmx::Tileset::Parse() to this:

http://pastebin.com/HBDMYUqn

Please let me know if you have any issues, I tested it out with both external and normal tilesets but it's always possible I made a mistake. :)

@andrewrk
Copy link
Collaborator Author

andrewrk commented Sep 9, 2014

@mwhiter want to turn this into a pull request? I'll merge it.

@mwhiter
Copy link

mwhiter commented Sep 9, 2014

@andrewrk I'm having trouble cloning my fork onto my computer, so you'll have to wait on that. Github just doesn't want to do it right now. I'll try again sometime this week and keep you updated. But yeah that's fine.

As I commented in the code, I highly recommend that we have access to the maps directory (where the map .tmx is stored) in a string variable that's easy to access. Because the tileset source attribute only refers to the url in relation to that directory, it needs to find that. I did it manually in my code, but that's not pretty.

If that's too much of a problem I'll see about writing it myself. This is just a fix to get it working (assuming your .tmx is in "../maps".

@andrewrk
Copy link
Collaborator Author

andrewrk commented Sep 9, 2014

I haven't yet gone over all this code for quality checking, so I'm sure that there is some weird stuff going on here, such as the maps thing you just mentioned. By all means if you make any improvements, let's merge them in. I'd like this to be a community-maintained project.

@mwhiter
Copy link

mwhiter commented Sep 9, 2014

Okay, I fixed the clone issue and got the repo on my desktop. Submitted a pull request. That's just a phase 1 fix. I'm sure it could be cleaned up better.

Let me know if any issues arise.

edit: also above I said it's not pretty. No, I mean it's wrong, because everyone's map folder might be in a different directory. I remember a different library had the user load the filepath of the .tmx file and it stored it in a variable. That seems much more elegant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants