Permalink
Browse files

GmxPlugin: Added support for setting the creation code

For object instances and the map.
  • Loading branch information...
bjorn committed Nov 29, 2017
1 parent 6cafc55 commit 27fd639a884f5bef91fbbfab67d4dc1769bc483d
Showing with 9 additions and 0 deletions.
  1. +2 −0 docs/manual/export.rst
  2. +7 −0 src/plugins/gmx/gmxplugin.cpp
View
@@ -94,6 +94,7 @@ combination with rotation doesn't appear to work in GameMaker).
The following custom properties can be set on objects to affect the
exported instance:
* string ``code`` (instance creation code, default: "")
* float ``scaleX`` (default: derived from tile or 1.0)
* float ``scaleY`` (default: derived from tile or 1.0)
* int ``originX`` (default: 0)
@@ -169,6 +170,7 @@ General
* bool ``persistent`` (default: false)
* bool ``clearDisplayBuffer`` (default: true)
* bool ``clearViewBackground`` (default: false)
* string ``code`` (map creation code, default: "")
Physics
^^^^^^^
@@ -53,6 +53,11 @@ static QString toString(bool b)
return QString::number(b ? -1 : 0);
}
static QString toString(const QString &string)
{
return string;
}
template <typename T>
static void writeProperty(QXmlStreamWriter &writer,
const Object *object,
@@ -121,6 +126,7 @@ bool GmxPlugin::write(const Map *map, const QString &fileName)
writeProperty(stream, map, "persistent", false);
writeProperty(stream, map, "clearDisplayBuffer", true);
writeProperty(stream, map, "clearViewBackground", false);
writeProperty(stream, map, "code", QString());
// Check if views are defined
bool enableViews = checkIfViewsDefined(map);
@@ -262,6 +268,7 @@ bool GmxPlugin::write(const Map *map, const QString &fileName)
stream.writeAttribute("name", name);
}
stream.writeAttribute("code", optionalProperty(object, "code", QString()));
stream.writeAttribute("scaleX", QString::number(scaleX));
stream.writeAttribute("scaleY", QString::number(scaleY));
stream.writeAttribute("rotation", QString::number(-object->rotation()));

0 comments on commit 27fd639

Please sign in to comment.