From 37846c4a184d5d8cfd887f5f84ebd34f9347a8ea Mon Sep 17 00:00:00 2001 From: shmyga Date: Fri, 3 Jul 2015 11:43:05 +0300 Subject: [PATCH] sample fix --- .gitignore | 5 +++- build.hxml | 4 --- examples/ViewExample.hx | 32 --------------------- haxelib.json | 8 ++++-- project.xml | 10 ------- samples/01-base/build.hxml | 4 +++ samples/01-base/src/ViewExample.hx | 24 ++++++++++++++++ {examples => samples/01-base/src}/form.json | 17 +++++------ 8 files changed, 44 insertions(+), 60 deletions(-) delete mode 100755 build.hxml delete mode 100755 examples/ViewExample.hx delete mode 100755 project.xml create mode 100644 samples/01-base/build.hxml create mode 100755 samples/01-base/src/ViewExample.hx rename {examples => samples/01-base/src}/form.json (78%) diff --git a/.gitignore b/.gitignore index 1b9b3b3..bc8b069 100755 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ +/.idea *.iml *.ipr *.iws out/ -target/ \ No newline at end of file +target/ +*.zip +pack.sh \ No newline at end of file diff --git a/build.hxml b/build.hxml deleted file mode 100755 index df3fca8..0000000 --- a/build.hxml +++ /dev/null @@ -1,4 +0,0 @@ --main examples.ViewExample --swf target/ViewExample.swf --debug --dce no \ No newline at end of file diff --git a/examples/ViewExample.hx b/examples/ViewExample.hx deleted file mode 100755 index 046deb4..0000000 --- a/examples/ViewExample.hx +++ /dev/null @@ -1,32 +0,0 @@ -package examples; - -import haxework.gui.IGroupView; -import haxework.gui.ButtonView; -import haxework.gui.GuiBuilder; -import haxework.asset.JsonAsset; -import haxework.gui.Root; -import flash.display.Sprite; - -@:file("examples/form.json") -class Form extends JsonAsset {} - -class ViewExample implements ButtonViewListener { - - public static function main() { - new ViewExample(); - } - - public function new() { - //var form:Dynamic = new Form().value; - var bytes = openfl.Assets.getBytes("examples/form.json"); - var form:Dynamic = haxe.Json.parse(bytes.readUTFBytes(bytes.bytesAvailable)); - var v:IGroupView = GuiBuilder.build(form, {listener:this}); - new Root(v); - var button3:ButtonView = v.findViewById("panel:button3"); - trace(button3.id); - } - - public function onPress(view:ButtonView):Void { - trace("onPress: " + view.id); - } -} \ No newline at end of file diff --git a/haxelib.json b/haxelib.json index 3508258..5441498 100755 --- a/haxelib.json +++ b/haxelib.json @@ -4,8 +4,10 @@ "license": "BSD", "tags": ["flash"], "description": "Framework.", - "version": "0.1.0", - "releasenote": "Update.", + "version": "0.2.0", + "releasenote": "ViewBuilder.", "contributors": ["shmyga"], - "dependencies": {} + "dependencies": { + "openfl": "" + } } diff --git a/project.xml b/project.xml deleted file mode 100755 index c8e5705..0000000 --- a/project.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/samples/01-base/build.hxml b/samples/01-base/build.hxml new file mode 100644 index 0000000..62a633c --- /dev/null +++ b/samples/01-base/build.hxml @@ -0,0 +1,4 @@ +-cp src +-lib haxework +-main ViewExample.hx +-swf target/ViewExample.swf \ No newline at end of file diff --git a/samples/01-base/src/ViewExample.hx b/samples/01-base/src/ViewExample.hx new file mode 100755 index 0000000..55b5280 --- /dev/null +++ b/samples/01-base/src/ViewExample.hx @@ -0,0 +1,24 @@ +package; + +import haxework.gui.ViewBuilder; +import haxework.gui.VGroupView; +import haxework.gui.ButtonView; +import haxework.gui.Root; + +@:template("form.json") +class FormView extends VGroupView implements ViewBuilder {} + +class ViewExample { + + public static function main() { + new ViewExample(); + } + + public function new() { + new Root(new FormView({listener:this})); + } + + public function onPress(view:ButtonView):Void { + trace("onPress: " + view.id); + } +} \ No newline at end of file diff --git a/examples/form.json b/samples/01-base/src/form.json similarity index 78% rename from examples/form.json rename to samples/01-base/src/form.json index 089a6ea..f9e39bf 100755 --- a/examples/form.json +++ b/samples/01-base/src/form.json @@ -1,13 +1,11 @@ { "type":"haxework.gui.VGroupView", - "layoutHAlign":"~haxework.gui.core.HAlign:CENTER", - "layoutVAlign":"~haxework.gui.core.VAlign:MIDDLE", "paddings":20, "layoutMargin":10, "skin":{"type":"haxework.gui.skin.ColorSkin", "color":"0xff0000"}, "views":[ { - "type":"haxework.gui.View", + "type":"haxework.gui.SpriteView", "pWidth":100, "pHeight":100, "leftMargin":5, @@ -15,8 +13,8 @@ "skin":{"type":"haxework.gui.skin.ColorSkin", "color":"0x00ff00"} }, { - "type":"haxework.gui.View", - "vAlign":"~haxework.gui.core.VAlign:BOTTOM", + "type":"haxework.gui.SpriteView", + "vAlign":"BOTTOM", "width":50, "height":50, "leftMargin":5, @@ -26,8 +24,7 @@ { "id":"panel", "type":"haxework.gui.HGroupView", - "layoutHAlign":"~haxework.gui.core.HAlign:RIGHT", - "layoutVAlign":"~haxework.gui.core.VAlign:MIDDLE", + "layoutHAlign":"RIGHT", "pWidth":100, "height":30, "paddings":3, @@ -41,7 +38,7 @@ "pHeight":100, "skin":{"type":"haxework.gui.skin.ButtonColorSkin", "color":"0xcc0000"}, "text":"Text1", - "onPress":"#listener" + "onPress":"@link:listener" }, { "id":"button2", @@ -51,7 +48,7 @@ "text":"Text2", "fontFamily":"Georgia", "fontColor":"0xffffff", - "onPress":"#listener" + "onPress":"@link:listener" }, { "id":"button3", @@ -61,7 +58,7 @@ "text":"Text 3333333333 ddd", "fontFamily":"Tahoma", "fontColor":"0xff0000", - "onPress":"#listener" + "onPress":"@link:listener" } ] }