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

Adds tint support #161

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
airsdk
flex
exporter/src/test/export
exporter/buildWithAnt.bat
exporter/debugWithAdl.bat
exporter/dist
exporter/flump-exporter.as3proj
runtime/dist
runtime/buildWithAnt.bat
runtime/Flump-runtime.as3proj
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public class MaxRectPackerImpl {

[Inline]
final protected function isContainedIn(a:Rectangle, b:Rectangle):Boolean {
return a.x >= b.x && a.y >= b.y && a.x + a.width <= b.x + b.width && a.y + a.height <= b.y + b.height;
return a.x >= b.x && a.y >= b.y && a.x + a.width <= b.x + b.width && a.y + a.height <= b.y + b.height;
}


Expand Down
2 changes: 2 additions & 0 deletions exporter/src/main/as/flump/xfl/XflInstance.as
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class XflInstance
public static const LIBRARY_ITEM_NAME :String = "libraryItemName";
public static const IS_VISIBLE :String = "isVisible";
public static const ALPHA :String = "alphaMultiplier";
public static const TINT_MULTIPLIER :String = "tintMultiplier";
public static const TINT :String = "tintColor";

public static function getColorXml (instanceXml :XML) :XML {
return (instanceXml.color != null ? instanceXml.color.Color[0] : null);
Expand Down
1 change: 1 addition & 0 deletions exporter/src/main/as/flump/xfl/XflKeyframe.as
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public class XflKeyframe
const colorXml :XML = XflInstance.getColorXml(instanceXml);
if (colorXml != null) {
kf.alpha = XmlUtil.getNumberAttr(colorXml, XflInstance.ALPHA, 1);
if (XmlUtil.hasAttr(colorXml,XflInstance.TINT_MULTIPLIER)) kf.tint = [XmlUtil.getNumberAttr(colorXml, XflInstance.TINT_MULTIPLIER, 1), XmlUtil.hasAttr(colorXml,XflInstance.TINT) ? XmlUtil.getStringAttr(colorXml, XflInstance.TINT): "#000000"];
}
return kf;
}
Expand Down
5 changes: 5 additions & 0 deletions runtime/src/main/as/flump/mold/KeyframeMold.as
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class KeyframeMold
public var pivotX :Number = 0.0, pivotY :Number = 0.0;

public var alpha :Number = 1;

public var tint :Array;

public var visible :Boolean = true;

Expand All @@ -50,6 +52,7 @@ public class KeyframeMold
extractFields(o, mold, "skew", "skewX", "skewY");
extractFields(o, mold, "pivot", "pivotX", "pivotY");
extractField(o, mold, "alpha");
extractField(o, mold, "tint");
extractField(o, mold, "visible");
extractField(o, mold, "ease");
extractField(o, mold, "tweened");
Expand Down Expand Up @@ -80,6 +83,7 @@ public class KeyframeMold
if (skewX != 0 || skewY != 0) json.skew = [round(skewX), round(skewY)];
if (pivotX != 0 || pivotY != 0) json.pivot = [round(pivotX), round(pivotY)];
if (alpha != 1) json.alpha = round(alpha);
if (tint != null) json.tint = tint;
if (!visible) json.visible = visible;
if (!tweened) json.tweened = tweened;
if (ease != 0) json.ease = round(ease);
Expand All @@ -97,6 +101,7 @@ public class KeyframeMold
if (skewX != 0 || skewY != 0) xml.@skew = "" + round(skewX) + "," + round(skewY);
if (pivotX != 0 || pivotY != 0) xml.@pivot = "" + round(pivotX) + "," + round(pivotY);
if (alpha != 1) xml.@alpha = round(alpha);
if (tint !=null) xml.@tint = "" + tint[0] + "," + tint[1];
if (!visible) xml.@visible = visible;
if (!tweened) xml.@tweened = tweened;
if (ease != 0) xml.@ease = round(ease);
Expand Down