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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, that looks even easier than I expected. :-)
@@ -32,9 +32,11 @@ | |||
#include "imagelayer.h" | |||
#include "isometricrenderer.h" | |||
#include "map.h" | |||
#include "mapformat.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't seem to need this include.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, I didn't realize I put readMap
in mapformat.h
!
src/tmxrasterizer/tmxrasterizer.cpp
Outdated
@@ -116,6 +118,8 @@ bool TmxRasterizer::shouldDrawLayer(const Layer *layer) const | |||
int TmxRasterizer::render(const QString &fileName, | |||
const QString &imageFileName) | |||
{ | |||
PluginManager::instance()->loadPlugins(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if this was put in the main
function rather than in the TmxRasterizer
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
* 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.
Great improvement, thanks! |
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
to load the plugins, let me know. (Or feel free to reject the PR if I'm way off the mark)