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

Allow tmxrasterizer to support additional map formats #2152

Merged
merged 7 commits into from Jul 10, 2019

Conversation

@gauauu
Copy link
Contributor

gauauu commented Jul 9, 2019

A simple change that loads the plugin manager, and uses readMap from mapformat.h to allow reading other map types in addition to tmx.

I don't have a great grasp of how the plugin system works, so if I should do something different other than

 PluginManager::instance()->loadPlugins();

to load the plugins, let me know. (Or feel free to reject the PR if I'm way off the mark)

Copy link
Owner

bjorn left a comment

Wow, that looks even easier than I expected. :-)

@@ -32,9 +32,11 @@
#include "imagelayer.h"
#include "isometricrenderer.h"
#include "map.h"
#include "mapformat.h"

This comment has been minimized.

Copy link
@bjorn

bjorn Jul 9, 2019

Owner

You don't seem to need this include.

This comment has been minimized.

Copy link
@gauauu

gauauu Jul 10, 2019

Author Contributor

Hmm, the build fails for me without it (MapReader.readMap doesn't seem to look for all the different map types from plugins, so I'm using the readMap from mapformat.cpp which does). That said, now that you mention this, I should remove the now-unnecessary MapReader instances that get created.

This comment has been minimized.

Copy link
@bjorn

bjorn Jul 10, 2019

Owner

Whoops, I didn't realize I put readMap in mapformat.h!

@@ -116,6 +118,8 @@ bool TmxRasterizer::shouldDrawLayer(const Layer *layer) const
int TmxRasterizer::render(const QString &fileName,
const QString &imageFileName)
{
PluginManager::instance()->loadPlugins();

This comment has been minimized.

Copy link
@bjorn

bjorn Jul 9, 2019

Owner

I'd prefer if this was put in the main function rather than in the TmxRasterizer.

This comment has been minimized.

Copy link
@gauauu

gauauu Jul 10, 2019

Author Contributor

Will do. I'll drop it in right after the app initialization calls in main unless you have another convention of where it should go.

gauauu and others added 2 commits Jul 10, 2019
* Don't mention TMX format, since plugins can add support for other
  formats (JSON and tBIN are now supported, for example).

* Make it more clear that world files are also accepted.
@bjorn bjorn merged commit 711bbfa into bjorn:master Jul 10, 2019
1 of 3 checks passed
1 of 3 checks passed
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
WIP Ready for review
Details
@bjorn

This comment has been minimized.

Copy link
Owner

bjorn commented Jul 10, 2019

Great improvement, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.