diff --git a/examples/website/project.xml b/examples/website/project.xml
index 7e5550e..030deff 100644
--- a/examples/website/project.xml
+++ b/examples/website/project.xml
@@ -24,6 +24,7 @@
+
diff --git a/haxelib.json b/haxelib.json
index 5bc6815..6c83245 100644
--- a/haxelib.json
+++ b/haxelib.json
@@ -5,8 +5,8 @@
"description": "Glory Framework is a page-based media framework built using [Haxe 3](http://haxe.org/), [OpenFL](http://openfl.org), and [PureMVC](http://puremvc.org/). It can be used for interactive e-books, adventure games, websites, or slide presentations on any target supported by OpenFL. It uses an XML configuration file to build the layout of each page, including placement and function of different controls. Each page can have its own custom class if desired. Glory also includes two Photoshop scripts which make it easy to rapidly convert a PSD layout into something that Glory can use. It can also use SVG files saved directly from Illustrator (not all types of object are supported).",
"contributors": ["ConfidantCommunications"],
"classPath":"src/",
- "releasenote": "Now supporting swf assets.",
- "version": "1.2.0",
+ "releasenote": "Now compatible with Haxe 4.0 and includes app mode and website mode.",
+ "version": "2.0.0",
"url": "https://github.com/ConfidantCommunications/Glory-Framework/",
"dependencies": {
"openfl" :"",
@@ -14,4 +14,4 @@
"svg" :"",
"puremvc-standard":""
}
-}
+}
diff --git a/src/ca/confidant/glory/controller/ActorComponentFactory.hx b/src/ca/confidant/glory/controller/ActorComponentFactory.hx
index a3a03bf..b62cdfb 100644
--- a/src/ca/confidant/glory/controller/ActorComponentFactory.hx
+++ b/src/ca/confidant/glory/controller/ActorComponentFactory.hx
@@ -20,7 +20,7 @@
*/
package ca.confidant.glory.controller;
-import haxe.xml.Fast;
+import haxe.xml.Access;
import ca.confidant.glory.ApplicationFacade;
import ca.confidant.glory.model.ActorComponentConfigProxy;
import ca.confidant.glory.view.ActorComponentMediator;
@@ -50,7 +50,7 @@ class ActorComponentFactory {
facade = Facade.getInstance();
}
- public function create(pageId:String, actor:Fast, ?swflib:String):ActorComponent {
+ public function create(pageId:String, actor:Access, ?swflib:String):ActorComponent {
#if !appMode
var alp = cast(facade.retrieveProxy(pageId) , AssetLibraryProxy);
@@ -234,7 +234,6 @@ class ActorComponentFactory {
}
}
- // trace(Reflect.fields(LayoutCreator));
LayoutHelper.instance.layout(a,accp.layoutCommands);
diff --git a/src/ca/confidant/glory/controller/AsyncLoadAssetsCommand.hx b/src/ca/confidant/glory/controller/AsyncLoadAssetsCommand.hx
index b043d05..70bd374 100644
--- a/src/ca/confidant/glory/controller/AsyncLoadAssetsCommand.hx
+++ b/src/ca/confidant/glory/controller/AsyncLoadAssetsCommand.hx
@@ -20,7 +20,7 @@
*/
package ca.confidant.glory.controller;
- import haxe.xml.Fast;
+ import haxe.xml.Access;
import openfl.utils.Assets;
import openfl.utils.AssetLibrary;
import openfl.utils.AssetManifest;
@@ -66,7 +66,7 @@ package ca.confidant.glory.controller;
var pageId:String;
var oldpm:PageMediator;
// var pendingLoads:Int;
- var actorsList:List;
+ var actorsList:Array;
public function new(){
super();
}
diff --git a/src/ca/confidant/glory/controller/BuildControlsCommand.hx b/src/ca/confidant/glory/controller/BuildControlsCommand.hx
index 5cff954..9616144 100644
--- a/src/ca/confidant/glory/controller/BuildControlsCommand.hx
+++ b/src/ca/confidant/glory/controller/BuildControlsCommand.hx
@@ -24,7 +24,7 @@ package ca.confidant.glory.controller;
import flash.display.Bitmap;
import flash.display.BitmapData;
import lime.graphics.Image;
- import haxe.xml.Fast;
+ import haxe.xml.Access;
import openfl.Assets;
import lime.utils.Assets in LimeAssets;
import org.puremvc.haxe.patterns.command.SimpleCommand;
@@ -59,7 +59,7 @@ package ca.confidant.glory.controller;
#if !appMode
alp=cast(facade.retrieveProxy("gloryControls") , AssetLibraryProxy);
#end
- var controlsList:List=pcp.getAppControls();
+ var controlsList:Array=pcp.getAppControls();
for (thisControl in controlsList){
// makeControl(thisControl);
var a = ActorComponentFactory.instance.create("gloryControls",thisControl);
diff --git a/src/ca/confidant/glory/controller/LayoutHelper.hx b/src/ca/confidant/glory/controller/LayoutHelper.hx
index 0a6ffc5..3b94da1 100644
--- a/src/ca/confidant/glory/controller/LayoutHelper.hx
+++ b/src/ca/confidant/glory/controller/LayoutHelper.hx
@@ -28,7 +28,8 @@ import ca.confidant.glory.model.StateProxy;
import ca.confidant.glory.model.PagesConfigProxy;
import ca.confidant.glory.view.components.ActorComponent;
import org.puremvc.haxe.interfaces.INotification;
-using layout.LayoutCreator;
+// import com.player03.layout.Resizable;
+using com.player03.layout.LayoutCreator.ForOpenFL;
/*
* @author Allan Dowdeswell
@@ -41,13 +42,59 @@ using layout.LayoutCreator;
private function new(){
// facade = Facade.getInstance();
};
-
+
+ /*
+ * Now spoon-feed the LayoutCreator some view objects casted as Resizable.
+ * Necessary due to breaking changes in Haxe 4.
+ *
+ static public inline function feed(r:Resizable, ?f) {
+ if (f != null) f(r);
+ return r;
+ }*/
+ /*
+
+ switch(com[0]){
+ case "simpleX": feed(a, t -> {t.simpleX(i);});
+ case "simpleY": feed(a, t -> {t.simpleY(i);});
+ case "centerX": feed(a, t -> {t.centerX();});
+ case "centerY": feed(a, t -> {t.centerY();});
+ case "center": feed(a, t -> {t.center();});
+ case "alignLeft": feed(a, t -> {t.alignLeft(i);});
+ case "alignRight": feed(a, t -> {t.alignRight(i);});
+ case "alignTop": feed(a, t -> {t.alignTop(i);});
+ case "alignBottom": feed(a, t -> {t.alignBottom(i);});
+ case "alignTopLeft": feed(a, t -> {t.alignTopLeft(i);});
+ case "alignTopRight": feed(a, t -> {t.alignTopRight(i);});
+ case "alignBottomLeft": feed(a, t -> {t.alignBottomLeft(i);});
+ case "alignBottomRight": feed(a, t -> {t.alignBottomRight(i);});
+ case "alignLeftCenter": feed(a, t -> {t.alignLeftCenter(i);});
+ case "alignRightCenter": feed(a, t -> {t.alignRightCenter(i);});
+ case "alignTopCenter": feed(a, t -> {t.alignTopCenter(i);});
+ case "alignBottomCenter": feed(a, t -> {t.alignBottomCenter(i);});
+ case "horizontalPercent": feed(a, t -> {t.horizontalPercent(i);});
+ case "verticalPercent": feed(a, t -> {t.verticalPercent(i);});
+ case "simpleScale": feed(a, t -> {t.simpleScale();});
+ case "simpleWidth": feed(a, t -> {t.simpleWidth(i);});
+ case "simpleHeight": feed(a, t -> {t.simpleHeight(i);});
+ case "rigidSimpleScale": feed(a, t -> {t.rigidSimpleScale();});
+ case "rigidSimpleWidth": feed(a, t -> {t.rigidSimpleWidth(i);});
+ case "rigidSimpleHeight": feed(a, t -> {t.rigidSimpleHeight(i);});
+ case "fillWidth": feed(a, t -> {t.fillWidth(i);});
+ case "fillHeight": feed(a, t -> {t.fillHeight(i);});
+ case "fillPercentWidth": feed(a, t -> {t.fillPercentWidth(i);});
+ case "fillPercentHeight": feed(a, t -> {t.fillPercentHeight(i);});
+ case "rigidFillPercentWidth": feed(a, t -> {t.rigidFillPercentWidth(i);});
+ case "rigidFillPercentHeight": feed(a, t -> {t.rigidFillPercentHeight(i);});
+ case "maintainAspectRatio": feed(a, t -> {t.maintainAspectRatio();});
+ */
public function layout(a:ActorComponent,commands:Array):Void {
+
for(thisCommand in commands){
var com = thisCommand.split(":");
+ //todo: use an abstract here https://haxe.org/manual/types-abstract-implicit-casts.html
var i = (com[1]!=null) ? Std.parseFloat(com[1]) : null; //convert parameter on right of colon to real number
trace("layout command:"+com+" value:"+i);
- // var pcp:PageConfigProxy = cast(facade.getProxy(PageConfigProxy.NAME),PageConfigProxy);
+ //
switch(com[0]){
case "simpleX": a.simpleX(i);
case "simpleY": a.simpleY(i);
diff --git a/src/ca/confidant/glory/controller/startup/Startup3_Assets_Command.hx b/src/ca/confidant/glory/controller/startup/Startup3_Assets_Command.hx
index b860ef6..530251e 100644
--- a/src/ca/confidant/glory/controller/startup/Startup3_Assets_Command.hx
+++ b/src/ca/confidant/glory/controller/startup/Startup3_Assets_Command.hx
@@ -24,7 +24,7 @@ package ca.confidant.glory.controller.startup;
import org.puremvc.haxe.interfaces.INotification;
import openfl.Assets;
import openfl.utils.AssetLibrary;
- import haxe.xml.Fast;
+ import haxe.xml.Access;
import lime.utils.AssetType;
import ca.confidant.glory.model.PagesConfigProxy;
import openfl.net.URLLoader;
@@ -56,7 +56,7 @@ package ca.confidant.glory.controller.startup;
private function _onXMLLoaded(e:Event):Void
{
var ul:URLLoader=cast(e.target,URLLoader);
- var xml=new Fast(Xml.parse(ul.data)).node.pages;
+ var xml=new Access(Xml.parse(ul.data)).node.pages;
var pcp:PagesConfigProxy=cast(facade.retrieveProxy(PagesConfigProxy.NAME),PagesConfigProxy);
pcp.processXML(xml);
diff --git a/src/ca/confidant/glory/model/PagesConfigProxy.hx b/src/ca/confidant/glory/model/PagesConfigProxy.hx
index acdaac6..5d549a2 100644
--- a/src/ca/confidant/glory/model/PagesConfigProxy.hx
+++ b/src/ca/confidant/glory/model/PagesConfigProxy.hx
@@ -22,7 +22,7 @@ package ca.confidant.glory.model;
import org.puremvc.haxe.patterns.proxy.Proxy;
import ca.confidant.glory.ApplicationFacade;
- import haxe.xml.Fast;
+ import haxe.xml.Access;
/*
* @author Allan Dowdeswell
@@ -36,7 +36,7 @@ package ca.confidant.glory.model;
{
public static inline var NAME:String = "pagesConfigProxy";
private var _pagesXML:Xml;
- private var fast:haxe.xml.Fast;
+ private var fast:haxe.xml.Access;
private var allPages:Array