Permalink
Browse files

Split exporter and runtime files

  • Loading branch information...
1 parent 262a4ee commit 94af2ce1d45c0a5f264609b8db2f096e1c24d9ea @groves groves committed Feb 19, 2012
Showing with 72 additions and 40 deletions.
  1. +2 −2 { → exporter}/build.xml
  2. +1 −1 { → exporter}/etc/airdesc.xml
  3. +28 −0 exporter/pom.xml
  4. 0 { → exporter}/src/main/as/flump/export/Atlas.as
  5. 0 { → exporter}/src/main/as/flump/export/BetwixtPublisher.as
  6. 0 { → exporter}/src/main/as/flump/export/DirChooser.as
  7. 0 { → exporter}/src/main/as/flump/export/Exporter.as
  8. 0 { → exporter}/src/main/as/flump/export/ExporterWindow.mxml
  9. 0 { → exporter}/src/main/as/flump/export/Files.as
  10. 0 { → exporter}/src/main/as/flump/export/Packer.as
  11. +2 −11 { → exporter}/src/main/as/flump/export/PngPublisher.as
  12. 0 { → exporter}/src/main/as/flump/export/Preview.as
  13. 0 { → exporter}/src/main/as/flump/export/PreviewController.as
  14. 0 { → exporter}/src/main/as/flump/export/PreviewControlsWindow.mxml
  15. 0 { → exporter}/src/main/as/flump/export/PreviewWindow.mxml
  16. 0 { → exporter}/src/main/as/flump/export/Ternary.as
  17. 0 { → exporter}/src/main/as/flump/export/XflLoader.as
  18. BIN { → exporter}/src/test/resources/guybrush.swf
  19. 0 { → exporter}/src/test/resources/guybrush/DOMDocument.xml
  20. BIN { → exporter}/src/test/resources/guybrush/LIBRARY/gb_walk_0.png
  21. BIN { → exporter}/src/test/resources/guybrush/LIBRARY/gb_walk_1.png
  22. BIN { → exporter}/src/test/resources/guybrush/LIBRARY/gb_walk_2.png
  23. BIN { → exporter}/src/test/resources/guybrush/LIBRARY/gb_walk_3.png
  24. BIN { → exporter}/src/test/resources/guybrush/LIBRARY/gb_walk_4.png
  25. BIN { → exporter}/src/test/resources/guybrush/LIBRARY/gb_walk_5.png
  26. 0 { → exporter}/src/test/resources/guybrush/LIBRARY/guybrush.xml
  27. 0 { → exporter}/src/test/resources/guybrush/META-INF/metadata.xml
  28. 0 { → exporter}/src/test/resources/guybrush/MobileSettings.xml
  29. 0 { → exporter}/src/test/resources/guybrush/PublishSettings.xml
  30. BIN { → exporter}/src/test/resources/guybrush/bin/M 10 1329343460.dat
  31. BIN { → exporter}/src/test/resources/guybrush/bin/M 11 1329343460.dat
  32. BIN { → exporter}/src/test/resources/guybrush/bin/M 12 1329343460.dat
  33. BIN { → exporter}/src/test/resources/guybrush/bin/M 13 1329343461.dat
  34. BIN { → exporter}/src/test/resources/guybrush/bin/M 14 1329343461.dat
  35. BIN { → exporter}/src/test/resources/guybrush/bin/M 9 1329343460.dat
  36. 0 { → exporter}/src/test/resources/guybrush/guybrush.xfl
  37. BIN { → exporter}/src/test/resources/shapes.swf
  38. 0 { → exporter}/src/test/resources/shapes/DOMDocument.xml
  39. 0 { → exporter}/src/test/resources/shapes/LIBRARY/Shapes/hexagon.xml
  40. 0 { → exporter}/src/test/resources/shapes/LIBRARY/Shapes/pentagon.xml
  41. 0 { → exporter}/src/test/resources/shapes/LIBRARY/Shapes/pentagonparty.xml
  42. 0 { → exporter}/src/test/resources/shapes/LIBRARY/Shapes/square.xml
  43. 0 { → exporter}/src/test/resources/shapes/LIBRARY/Shapes/triangle.xml
  44. 0 { → exporter}/src/test/resources/shapes/LIBRARY/allshapes.xml
  45. 0 { → exporter}/src/test/resources/shapes/META-INF/metadata.xml
  46. 0 { → exporter}/src/test/resources/shapes/MobileSettings.xml
  47. 0 { → exporter}/src/test/resources/shapes/PublishSettings.xml
  48. 0 { → exporter}/src/test/resources/shapes/shapes.xfl
  49. BIN { → exporter}/src/test/resources/squaredance.swf
  50. 0 { → exporter}/src/test/resources/squaredance/DOMDocument.xml
  51. 0 { → exporter}/src/test/resources/squaredance/LIBRARY/bluesquare.xml
  52. 0 { → exporter}/src/test/resources/squaredance/LIBRARY/nesteddance.xml
  53. 0 { → exporter}/src/test/resources/squaredance/LIBRARY/redsquare.xml
  54. 0 { → exporter}/src/test/resources/squaredance/LIBRARY/squaredance.xml
  55. 0 { → exporter}/src/test/resources/squaredance/META-INF/metadata.xml
  56. 0 { → exporter}/src/test/resources/squaredance/MobileSettings.xml
  57. 0 { → exporter}/src/test/resources/squaredance/PublishSettings.xml
  58. BIN { → exporter}/src/test/resources/squaredance/bluesquare.png
  59. BIN { → exporter}/src/test/resources/squaredance/redsquare.png
  60. 0 { → exporter}/src/test/resources/squaredance/squaredance.xfl
  61. +27 −0 runtime/build.xml
  62. +2 −14 { → runtime}/pom.xml
  63. +10 −7 { → runtime}/src/main/as/flump/SwfTexture.as
  64. 0 { → runtime}/src/main/as/flump/bytesToXML.as
  65. 0 { → runtime}/src/main/as/flump/display/DisplayCreator.as
  66. 0 { → runtime}/src/main/as/flump/display/Movie.as
  67. 0 { → runtime}/src/main/as/flump/xfl/ParseError.as
  68. 0 { → runtime}/src/main/as/flump/xfl/ParseErrorSeverity.as
  69. 0 { → runtime}/src/main/as/flump/xfl/XflComponent.as
  70. 0 { → runtime}/src/main/as/flump/xfl/XflFlipLayer.as
  71. 0 { → runtime}/src/main/as/flump/xfl/XflKeyframe.as
  72. 0 { → runtime}/src/main/as/flump/xfl/XflLayer.as
  73. 0 { → runtime}/src/main/as/flump/xfl/XflLibrary.as
  74. 0 { → runtime}/src/main/as/flump/xfl/XflMovie.as
  75. +0 −5 { → runtime}/src/main/as/flump/xfl/XflTexture.as
  76. 0 { → runtime}/src/main/as/flump/xfl/XflTopLevelComponent.as
  77. 0 { → runtime}/src/main/as/xflns.as
@@ -1,11 +1,11 @@
<?xml version="1.0" standalone="yes"?>
-<project name="flump" default="dist" basedir=".">
+<project name="flump-exporter" default="dist" basedir=".">
<property name="asrc.dir" location="src/main/as"/>
<property name="deploy.dir" location="dist"/>
<property name="keystore" location="${deploy.dir}/${ant.project.name}.pfx"/>
<property name="ooo-build.vers" value="2.5"/>
- <ant antfile="etc/bootstrap.xml"/>
+ <ant antfile="../etc/bootstrap.xml"/>
<import file="${user.home}/.m2/ooo-build/${ooo-build.vers}/ooo-build.xml"/>
<target name="clean" description="Removes all generated files and directories">
@@ -5,6 +5,6 @@
<filename>Flump</filename>
<initialWindow>
<renderMode>direct</renderMode>
- <content>flump.swf</content>
+ <content>flump-exporter.swf</content>
</initialWindow>
</application>
View
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.threerings.flump</groupId>
+ <artifactId>flump-exporter</artifactId>
+ <packaging>swc</packaging>
+ <version>0.1-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>com.threerings.flump</groupId>
+ <artifactId>flump-runtime</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <type>swc</type>
+ </dependency>
+ <dependency>
+ <groupId>deng</groupId>
+ <artifactId>fzip</artifactId>
+ <version>a5430bd</version>
+ <type>swc</type>
+ </dependency>
+ <dependency>
+ <groupId>com.adobe</groupId>
+ <artifactId>as3corelib</artifactId>
+ <version>0.93</version>
+ <type>swc</type>
+ </dependency>
+ </dependencies>
+</project>
@@ -21,22 +21,13 @@ public class PngPublisher
public static function dumpTextures (base :File, library :XflLibrary) :void {
for each (var tex :XflTexture in library.textures) {
const packed :SwfTexture = SwfTexture.fromTexture(library.swf, tex);
- packed.publish(tex.exportPath(base));
+ publish(base.resolvePath(tex.symbol + ".png"), packed.w, packed.h, packed.holder);
}
}
- public static function renderToBitmapData (target :DisplayObject, width :int, height :int)
- :BitmapData {
- const bd :BitmapData = new BitmapData(width, height, true);
- // Clear bitmapdata's default white background with a transparent one
- bd.fillRect(new Rectangle(0, 0, width, height), 0);
- bd.draw(target);
- return bd;
- }
-
public static function publish (dest :File, width :int, height :int,
target :DisplayObject) :void {
- var bd :BitmapData = renderToBitmapData(target, width, height);
+ var bd :BitmapData = SwfTexture.renderToBitmapData(target, width, height);
var fs :FileStream = new FileStream();
fs.open(dest, FileMode.WRITE);
fs.writeBytes(PNGEncoder.encode(bd));
View
@@ -0,0 +1,27 @@
+<?xml version="1.0" standalone="yes"?>
+<project name="flump-runtime" default="swc" basedir=".">
+ <property name="asrc.dir" location="src/main/as"/>
+ <property name="deploy.dir" location="dist"/>
+
+ <property name="ooo-build.vers" value="2.5"/>
+ <ant antfile="../etc/bootstrap.xml"/>
+ <import file="${user.home}/.m2/ooo-build/${ooo-build.vers}/ooo-build.xml"/>
+
+ <target name="clean" description="Removes all generated files and directories">
+ <delete dir="${deploy.dir}"/>
+ </target>
+
+ <target name="swc" depends="-init-ooo" description="Builds the library (.swc file)">
+ <mkdir dir="${deploy.dir}"/>
+ <mavendep pom="pom.xml" pathProp="aslib.path"/>
+ <maventaskdef groupId="com.threerings.ant" artifactId="actionscript" version="1.5"/>
+ <compc srcdir="${asrc.dir}" libpath="${aslib.path}"
+ dest="${deploy.dir}/${ant.project.name}.swc">
+ <arg value="-swf-version=13"/>
+ </compc>
+ </target>
+ <target name="maven-deploy" depends="swc"
+ description="Deploys build artifacts to a Maven repository.">
+ <mavendeploy file="${deploy.dir}/${ant.project.name}.swc" pom="pom.xml" srcdir="${asrc.dir}"/>
+ </target>
+</project>
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>com.threerings</groupId>
- <artifactId>flump</artifactId>
+ <groupId>com.threerings.flump</groupId>
+ <artifactId>flump-runtime</artifactId>
<packaging>swc</packaging>
<version>0.1-SNAPSHOT</version>
<dependencies>
@@ -19,18 +19,6 @@
<type>swc</type>
</dependency>
<dependency>
- <groupId>deng</groupId>
- <artifactId>fzip</artifactId>
- <version>a5430bd</version>
- <type>swc</type>
- </dependency>
- <dependency>
- <groupId>com.adobe</groupId>
- <artifactId>as3corelib</artifactId>
- <version>0.93</version>
- <type>swc</type>
- </dependency>
- <dependency>
<groupId>org.starling-framework</groupId>
<artifactId>starling</artifactId>
<version>46f31516</version>
@@ -7,13 +7,11 @@ import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.display.Sprite;
-import flash.filesystem.File;
import flash.geom.Point;
import flash.geom.Rectangle;
import executor.load.LoadedSwf;
-import flump.export.PngPublisher;
import flump.xfl.XflMovie;
import flump.xfl.XflTexture;
@@ -25,6 +23,15 @@ public class SwfTexture
public var offset :Point;
public var w :int, h :int, a :int;
+ public static function renderToBitmapData (target :DisplayObject, width :int, height :int)
+ :BitmapData {
+ const bd :BitmapData = new BitmapData(width, height, true);
+ // Clear bitmapdata's default white background with a transparent one
+ bd.fillRect(new Rectangle(0, 0, width, height), 0);
+ bd.draw(target);
+ return bd;
+ }
+
public static function fromFlipbook (swf :LoadedSwf, movie :XflMovie, frame :int)
:SwfTexture {
const klass :Class = Class(swf.getSymbol(movie.symbol));
@@ -52,11 +59,7 @@ public class SwfTexture
a = w * h;
}
- public function toBitmapData () :BitmapData {
- return PngPublisher.renderToBitmapData(holder, w, h);
- }
-
- public function publish (dest :File) :void { PngPublisher.publish(dest, w, h, holder); }
+ public function toBitmapData () :BitmapData { return renderToBitmapData(holder, w, h); }
public function toString () :String {
return "a " + a + " w " + w + " h " + h;
@@ -3,8 +3,6 @@
package flump.xfl {
-import flash.filesystem.File;
-
import com.threerings.util.XmlUtil;
public class XflTexture extends XflTopLevelComponent
@@ -19,8 +17,5 @@ public class XflTexture extends XflTopLevelComponent
this.md5 = md5;
symbol = XmlUtil.getStringAttr(xml, "linkageClassName");
}
-
- public function exportPath (base :File) :File { return base.resolvePath(symbol + '.png') }
-
}
}
File renamed without changes.

0 comments on commit 94af2ce

Please sign in to comment.