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

JSON Plugin #17

Closed
wants to merge 6 commits into from
Closed

JSON Plugin #17

wants to merge 6 commits into from

Conversation

porfirioribeiro
Copy link
Contributor

First preview of JSON plugin

Porfírio José Pereira Ribeiro and others added 6 commits May 23, 2011 22:31
This commit changes the TileLayer class to store Cell instances rather
than directly referring to Tile*. The Cell class contains the Tile* plus
information on whether the tile is horizontally or vertically flipped.

The MapReader and MapWriter have been adapted to store and restore the
flipped state as flags in the last bits of the global IDs (this means
older Tiled versions will refuse to load maps with flipped tiles).

The OrthogonalRenderer and IsometricRenderer have been adapted to render
the flipped tiles correctly.

This implements the first part of issue #3

Sponsored-by: Zipline Games, Inc.
The X key flips horizontally (along the X axis)
The Y key flips vertically (along the Y axis)

This closes #3

Sponsored-by: Zipline Games, Inc.
@bjorn
Copy link
Member

bjorn commented Jun 10, 2011

Porfirio, I just pushed the new Lua export plugin. To map the cells to gids I introduced a GidMapper class which is now used in both the TMX map reader/writer and the Lua exporter. Please use it also in the JSON exporter.

You may want to try getting some help with git on IRC to sort things out. Basically you should rebase your stuff on my latest master branch, dropping those commits that you duplicated somehow. There will be conflicts of course, but you'll just have to resolve them (though in the case of my commits, they should just be skipped).

@porfirioribeiro
Copy link
Contributor Author

How do i rebase to the last branch

@stefanbeller
Copy link
Contributor

Was this actually merged?

Porfirio, rebasing is this:
git fetch mainline/master #make sure you have the latest stuff from bjorn
git rebase mainline/master # this will put your commits on top of the master branch

@bjorn
Copy link
Member

bjorn commented Aug 21, 2011

Of course, those commands only work when you have your own master branch checked out and the remote pointing to my repository is called 'mainline'.

@porfirioribeiro
Copy link
Contributor Author

Ive been a bit busy this weeks sorry!

Next month i hope to have time to put code up.

2011/8/21 bjorn <
reply@reply.github.com>

Of course, those commands only work when you have your own master branch
checked out and the remote pointing to my repository is called 'mainline'.

Reply to this email directly or view it on GitHub:
#17 (comment)

Porfirio Ribeiro

@bjorn
Copy link
Member

bjorn commented Sep 30, 2011

I've pulled this plugin based on this commit:
https://github.com/porfirioribeiro/tiled/commit/d072cb7b057718631b8de63934654065954b826c

And now I'm doing a followup rewrite of the plugin to conform to Tiled coding standards and improve error handling, mostly.

I've taken this plugin first (out of three json plugins written so far) since it supported both reading and writing, and it didn't introduce a dependency on any external library. However, I'll probably combine it with the one by @Dchandaman for the export, since auto-generating a JSON file from a QVariantMap is producing some very ugly output (properties in alphabetical rather than logical order, and the auto-formatting is also quite bad in my opinion).

@porfirioribeiro
Copy link
Contributor Author

Hi.

Yeah, i used an existing class to read write json, but the generated code is
damn ugly :(

I was about to modify it to produce better JSON, but since someone already
did it, great!

Sorry for not updating it lately!

2011/10/1 Thorbjrn Lindeijer <
reply@reply.github.com>

I've pulled this plugin based on this commit:

https://github.com/porfirioribeiro/tiled/commit/d072cb7b057718631b8de63934654065954b826c

And now I'm doing a followup rewrite of the plugin to conform to Tiled
coding standards and improve error handling, mostly.

I've taken this plugin first (out of three json plugins written so far)
since it supported both reading and writing, and it didn't introduce a
dependency on any external library. However, I'll probably combine it with
the one by @Dchandaman for the export, since auto-generating a JSON file
from a QVariantMap is producing some very ugly output (properties in
alphabetical rather than logical order, and the auto-formatting is also
quite bad in my opinion).

Reply to this email directly or view it on GitHub:
#17 (comment)

Porfirio Ribeiro

@bjorn
Copy link
Member

bjorn commented Oct 1, 2011

The JSON plugin is pushed now, together with my improvements. The output still looks ugly, but I'll fix that later.

I noticed the code by @Dchandaman is actualy a direct copy of my LuaTableWriter and LuaPlugin, with small tweaks to change the format into JSON rather than a Lua table. Hence, I'm a bit hesitant to do the same since I don't like that level of code duplication. :-/

@porfirioribeiro
Copy link
Contributor Author

I see, how about create some class that could write the map with some
options, that would work for LUA, JSON or other.
It would remove the duplicated code, and open doors for other export
formats.
But might be complicated to do...

2011/10/1 Thorbjrn Lindeijer <
reply@reply.github.com>

The JSON plugin is pushed now, together with my improvements. The output
still looks ugly, but I'll fix that later.

I noticed the code by @Dchandaman is actualy a direct copy of my
LuaTableWriter and LuaPlugin, with small tweaks to change the format into
JSON rather than a Lua table. Hence, I'm a bit hesitant to do the same since
I don't like that level of code duplication. :-/

Reply to this email directly or view it on GitHub:
#17 (comment)

Porfirio Ribeiro

@bjorn
Copy link
Member

bjorn commented Oct 1, 2011

Yeah, that's probably what I'll try to do.

bjorn added a commit that referenced this pull request Jan 11, 2016
Apply sorting trick to windows dailies
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.

3 participants