sample fix
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,5 +1,8 @@
|
|||||||
|
/.idea
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
out/
|
out/
|
||||||
target/
|
target/
|
||||||
|
*.zip
|
||||||
|
pack.sh
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
-main examples.ViewExample
|
|
||||||
-swf target/ViewExample.swf
|
|
||||||
-debug
|
|
||||||
-dce no
|
|
||||||
@@ -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<Sprite> = 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,8 +4,10 @@
|
|||||||
"license": "BSD",
|
"license": "BSD",
|
||||||
"tags": ["flash"],
|
"tags": ["flash"],
|
||||||
"description": "Framework.",
|
"description": "Framework.",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"releasenote": "Update.",
|
"releasenote": "ViewBuilder.",
|
||||||
"contributors": ["shmyga"],
|
"contributors": ["shmyga"],
|
||||||
"dependencies": {}
|
"dependencies": {
|
||||||
|
"openfl": ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
project.xml
10
project.xml
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<project>
|
|
||||||
<meta title="ViewExample" package="haxework.examples" version="1.0.0" company="MegaLoMania"/>
|
|
||||||
<app path="target" file="ViewExample" main="examples.ViewExample"/>
|
|
||||||
<window width="800" height="600" if="desktop"/>
|
|
||||||
<window width="0" height="0" if="html5"/>
|
|
||||||
<source path="."/>
|
|
||||||
<haxelib name="openfl"/>
|
|
||||||
<assets path="examples" include="*"/>
|
|
||||||
</project>
|
|
||||||
4
samples/01-base/build.hxml
Normal file
4
samples/01-base/build.hxml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
-cp src
|
||||||
|
-lib haxework
|
||||||
|
-main ViewExample.hx
|
||||||
|
-swf target/ViewExample.swf
|
||||||
24
samples/01-base/src/ViewExample.hx
Executable file
24
samples/01-base/src/ViewExample.hx
Executable file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
{
|
{
|
||||||
"type":"haxework.gui.VGroupView",
|
"type":"haxework.gui.VGroupView",
|
||||||
"layoutHAlign":"~haxework.gui.core.HAlign:CENTER",
|
|
||||||
"layoutVAlign":"~haxework.gui.core.VAlign:MIDDLE",
|
|
||||||
"paddings":20,
|
"paddings":20,
|
||||||
"layoutMargin":10,
|
"layoutMargin":10,
|
||||||
"skin":{"type":"haxework.gui.skin.ColorSkin", "color":"0xff0000"},
|
"skin":{"type":"haxework.gui.skin.ColorSkin", "color":"0xff0000"},
|
||||||
"views":[
|
"views":[
|
||||||
{
|
{
|
||||||
"type":"haxework.gui.View",
|
"type":"haxework.gui.SpriteView",
|
||||||
"pWidth":100,
|
"pWidth":100,
|
||||||
"pHeight":100,
|
"pHeight":100,
|
||||||
"leftMargin":5,
|
"leftMargin":5,
|
||||||
@@ -15,8 +13,8 @@
|
|||||||
"skin":{"type":"haxework.gui.skin.ColorSkin", "color":"0x00ff00"}
|
"skin":{"type":"haxework.gui.skin.ColorSkin", "color":"0x00ff00"}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type":"haxework.gui.View",
|
"type":"haxework.gui.SpriteView",
|
||||||
"vAlign":"~haxework.gui.core.VAlign:BOTTOM",
|
"vAlign":"BOTTOM",
|
||||||
"width":50,
|
"width":50,
|
||||||
"height":50,
|
"height":50,
|
||||||
"leftMargin":5,
|
"leftMargin":5,
|
||||||
@@ -26,8 +24,7 @@
|
|||||||
{
|
{
|
||||||
"id":"panel",
|
"id":"panel",
|
||||||
"type":"haxework.gui.HGroupView",
|
"type":"haxework.gui.HGroupView",
|
||||||
"layoutHAlign":"~haxework.gui.core.HAlign:RIGHT",
|
"layoutHAlign":"RIGHT",
|
||||||
"layoutVAlign":"~haxework.gui.core.VAlign:MIDDLE",
|
|
||||||
"pWidth":100,
|
"pWidth":100,
|
||||||
"height":30,
|
"height":30,
|
||||||
"paddings":3,
|
"paddings":3,
|
||||||
@@ -41,7 +38,7 @@
|
|||||||
"pHeight":100,
|
"pHeight":100,
|
||||||
"skin":{"type":"haxework.gui.skin.ButtonColorSkin", "color":"0xcc0000"},
|
"skin":{"type":"haxework.gui.skin.ButtonColorSkin", "color":"0xcc0000"},
|
||||||
"text":"Text1",
|
"text":"Text1",
|
||||||
"onPress":"#listener"
|
"onPress":"@link:listener"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":"button2",
|
"id":"button2",
|
||||||
@@ -51,7 +48,7 @@
|
|||||||
"text":"Text2",
|
"text":"Text2",
|
||||||
"fontFamily":"Georgia",
|
"fontFamily":"Georgia",
|
||||||
"fontColor":"0xffffff",
|
"fontColor":"0xffffff",
|
||||||
"onPress":"#listener"
|
"onPress":"@link:listener"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":"button3",
|
"id":"button3",
|
||||||
@@ -61,7 +58,7 @@
|
|||||||
"text":"Text 3333333333 ddd",
|
"text":"Text 3333333333 ddd",
|
||||||
"fontFamily":"Tahoma",
|
"fontFamily":"Tahoma",
|
||||||
"fontColor":"0xff0000",
|
"fontColor":"0xff0000",
|
||||||
"onPress":"#listener"
|
"onPress":"@link:listener"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user