[hw] rename haxework package to hw
This commit is contained in:
57
README.md
57
README.md
@@ -1,46 +1,45 @@
|
||||
# haxework
|
||||
# HaxeWork
|
||||
|
||||
Gui framework for Haxe.
|
||||
HaXe framework.
|
||||
|
||||
## View
|
||||
|
||||
`haxework.gui` provides views classes.
|
||||
`hw.view` provides views classes.
|
||||
|
||||
### Example
|
||||
|
||||
Build form using macro @:template.
|
||||
|
||||
form.json:
|
||||
form.yaml:
|
||||
|
||||
```json
|
||||
{
|
||||
"$type": "haxework.gui.VGroupView",
|
||||
"skin": [{"$type": "haxework.gui.skin.ColorSkin", "color": "0xffff00"}],
|
||||
"geometry.padding": 20,
|
||||
"layout.margin": 10,
|
||||
"views":[
|
||||
{
|
||||
"id": "view1",
|
||||
"type":"haxework.gui.SpriteView",
|
||||
"geometry.size.stretch": true,
|
||||
"skin":[{"$type":"haxework.gui.skin.ColorSkin", "color": "0xff0000"}]
|
||||
},
|
||||
{
|
||||
"id": "view2",
|
||||
"type": "haxework.gui.SpriteView",
|
||||
"geometry.size.width": "100%",
|
||||
"geometry.size.height": 50,
|
||||
"skin": [{"$type":"haxework.gui.skin.ColorSkin", "color": "0x00ff00"}]
|
||||
}
|
||||
]
|
||||
}
|
||||
```yaml
|
||||
---
|
||||
skin:
|
||||
- $type: hw.gui.skin.ColorSkin
|
||||
color: 0xffff00
|
||||
geometry.padding: 20
|
||||
layout.margin: 10
|
||||
views:
|
||||
- id: view1
|
||||
type: hw.view.SpriteView
|
||||
geometry.size.stretch: true
|
||||
skin:
|
||||
- $type: hw.view.skin.ColorSkin
|
||||
color: 0xff0000
|
||||
- id: view2
|
||||
type: hw.view.SpriteView
|
||||
geometry.size.width: 100%
|
||||
geometry.size.height: 50
|
||||
skin:
|
||||
- "$type": hw.view.skin.ColorSkin
|
||||
color: 0x00ff00
|
||||
```
|
||||
|
||||
```haxe
|
||||
@:template("form.json")
|
||||
@:template("form.yaml")
|
||||
class FormView extends VGroupView {
|
||||
@:view public var view1:SpriteView;
|
||||
@:view("view2") public var anyVarName:SpriteView;
|
||||
@:view("view2") public var anyVarName:SpriteView;
|
||||
}
|
||||
|
||||
var form = new FormView();
|
||||
@@ -51,7 +50,7 @@ trace(form.anyVarName);
|
||||
|
||||
## Loader
|
||||
|
||||
`haxework.net` provides loaders classes.
|
||||
`hw.net` provides loaders classes.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
-lib yaml
|
||||
-lib promhx
|
||||
-lib haxework
|
||||
--macro haxework.parser.Parser.auto()
|
||||
--macro hw.parser.Parser.auto()
|
||||
-debug
|
||||
-D native_trace
|
||||
#-D dev_layout
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<meta title="Demo" package="haxework.demo" version="1.0.0" company="MegaLoMania"/>
|
||||
<meta title="Demo" package="hw.demo" version="1.0.0" company="MegaLoMania"/>
|
||||
<app main="demo.Demo" path="target" file="demo"/>
|
||||
<icon path="src/haxe-logo.png"/>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<!--<haxelib name="promhx" version=""/>-->
|
||||
<haxelib name="haxework" version="git"/>
|
||||
|
||||
<!--<haxeflag name="--macro" value="haxework.parser.Parser.auto()"/>-->
|
||||
<!--<haxeflag name="--macro" value="hw.parser.Parser.auto()"/>-->
|
||||
<haxeflag name="--macro" value="CompilationOption.set('build','xxx')"/>
|
||||
|
||||
<window fps="30"/>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package demo;
|
||||
|
||||
import haxework.view.geometry.Box;
|
||||
import haxework.color.Color;
|
||||
import haxework.view.theme.Theme;
|
||||
import hw.view.geometry.Box;
|
||||
import hw.color.Color;
|
||||
import hw.view.theme.Theme;
|
||||
|
||||
using haxework.color.ColorUtil;
|
||||
using hw.color.ColorUtil;
|
||||
|
||||
class AppTheme extends Theme {
|
||||
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package demo;
|
||||
|
||||
import demo.storage.TestStorage;
|
||||
import haxework.resources.IResources;
|
||||
import haxework.provider.Provider;
|
||||
import demo.dispatch.DemoDispatcher;
|
||||
import demo.popup.ColorPopup;
|
||||
import demo.popup.FontPopup;
|
||||
import haxework.App;
|
||||
import haxework.log.TraceLogger;
|
||||
import haxework.net.JsonLoader;
|
||||
import haxework.view.data.ButtonGroup;
|
||||
import haxework.view.frame.FrameSwitcher;
|
||||
import haxework.view.frame.FrameView;
|
||||
import haxework.view.group.VGroupView;
|
||||
import demo.storage.TestStorage;
|
||||
import hw.app.App;
|
||||
import hw.log.TraceLogger;
|
||||
import hw.net.JsonLoader;
|
||||
import hw.resources.IResources;
|
||||
import hw.view.data.ButtonGroup;
|
||||
import hw.view.frame.FrameSwitcher;
|
||||
import hw.view.frame.FrameView;
|
||||
import hw.view.group.VGroupView;
|
||||
|
||||
@:template class DemoView extends VGroupView {
|
||||
@:view var switcher:FrameSwitcher;
|
||||
@@ -46,16 +45,16 @@ import haxework.view.group.VGroupView;
|
||||
|
||||
class Demo extends App implements DemoListener {
|
||||
|
||||
@:provide static var resources:IResources;
|
||||
@:provide static var storage:TestStorage;
|
||||
|
||||
public static function main() {
|
||||
L.push(new TraceLogger());
|
||||
|
||||
resources.image.put("logo", HaxeLogo.resolve());
|
||||
var app = new Demo(new AppTheme(), resources.image.get("logo"));
|
||||
app.start(new DemoView());
|
||||
|
||||
App.resources.image.put("logo", HaxeLogo.resolve());
|
||||
var app = new Demo();
|
||||
app.theme = new AppTheme();
|
||||
app.icon = App.resources.image.get("logo");
|
||||
app.view = new DemoView();
|
||||
trace(storage);
|
||||
storage.write("test", "value");
|
||||
|
||||
@@ -73,8 +72,8 @@ class Demo extends App implements DemoListener {
|
||||
|
||||
new JsonLoader().GET("https://embed.tvbit.co/channel/data2/renova.json")
|
||||
.then(function(data:Array<Model>) {
|
||||
resources.any.put("data", data);
|
||||
resources.any.put("data50", Util.marray(data, 50));
|
||||
App.resources.any.put("data", data);
|
||||
App.resources.any.put("data50", Util.marray(data, 50));
|
||||
})
|
||||
.catchError(function(error) trace(error));
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
---
|
||||
style: background
|
||||
views:
|
||||
- $type: haxework.view.ImageView
|
||||
- $type: hw.view.ImageView
|
||||
geometry.padding: 10
|
||||
image: $r:image:logo
|
||||
- id: tabs
|
||||
$type: haxework.view.data.ButtonGroup<String>
|
||||
$type: hw.view.data.ButtonGroup<String>
|
||||
layout.margin: 5
|
||||
layout.hAlign: left
|
||||
geometry.width: 100%
|
||||
@@ -20,8 +20,8 @@ views:
|
||||
- "test_layout"
|
||||
- "select"
|
||||
- id: switcher
|
||||
$type: haxework.view.frame.FrameSwitcher
|
||||
animateFactory: { $class: haxework.animate.SlideAnimate }
|
||||
$type: hw.view.frame.FrameSwitcher
|
||||
animateFactory: { $class: hw.animate.SlideAnimate }
|
||||
+onSwitch: ~onFrameSwitch
|
||||
geometry.stretch: true
|
||||
geometry.padding: 5
|
||||
@@ -31,24 +31,24 @@ views:
|
||||
_data_: {$class: demo.form.DataForm}
|
||||
_test_layout_: {$class: demo.form.TestLayoutForm}
|
||||
_select_: {$class: demo.form.SelectForm}
|
||||
- $type: haxework.view.group.HGroupView
|
||||
- $type: hw.view.group.HGroupView
|
||||
geometry.width: 100%
|
||||
geometry.padding: 10
|
||||
layout.margin: 10
|
||||
views:
|
||||
- $type: haxework.view.form.ButtonView
|
||||
- $type: hw.view.form.ButtonView
|
||||
text: Color
|
||||
+onPress: ~choiceColor()
|
||||
- $type: haxework.view.form.ButtonView
|
||||
- $type: hw.view.form.ButtonView
|
||||
text: Font
|
||||
+onPress: ~choiceFont()
|
||||
# separator
|
||||
- $type: haxework.view.SpriteView
|
||||
- $type: hw.view.SpriteView
|
||||
geometry.stretch: true
|
||||
- $type: haxework.view.form.ButtonView
|
||||
- $type: hw.view.form.ButtonView
|
||||
text: OK
|
||||
- $type: haxework.view.form.ButtonView
|
||||
- $type: hw.view.form.ButtonView
|
||||
text: Apply
|
||||
- $type: haxework.view.form.ButtonView
|
||||
- $type: hw.view.form.ButtonView
|
||||
text: Cancel
|
||||
+onPress: ~flash.system.System.exit(0)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package demo;
|
||||
|
||||
import demo.test.TestView;
|
||||
import haxework.view.Root;
|
||||
import haxework.view.SpriteView;
|
||||
import hw.view.Root;
|
||||
import hw.view.SpriteView;
|
||||
|
||||
class Test {
|
||||
public static function main():Void {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package demo.dispatch;
|
||||
|
||||
import haxework.App;
|
||||
import hw.app.App;
|
||||
|
||||
interface DemoListener {
|
||||
public function onTest1():Void;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package demo.form;
|
||||
|
||||
import haxework.view.frame.FrameView;
|
||||
import haxework.view.text.TextView;
|
||||
import hw.view.frame.FrameView;
|
||||
import hw.view.text.TextView;
|
||||
|
||||
@:template class DataForm extends FrameView<Dynamic> {
|
||||
public function new() {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
overflow.y: scroll
|
||||
views:
|
||||
- id: data
|
||||
$type: haxework.view.data.DataView
|
||||
$type: hw.view.data.DataView
|
||||
layout:
|
||||
$type: haxework.view.layout.VerticalLayout
|
||||
$type: hw.view.layout.VerticalLayout
|
||||
factory: ~factory
|
||||
geometry.width: 100%
|
||||
data: $r:any:data
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package demo.form;
|
||||
|
||||
import haxework.view.frame.FrameView;
|
||||
import haxework.view.list.LabelListItem;
|
||||
import haxework.view.list.ListView.IListItemView;
|
||||
import haxework.view.list.VListView;
|
||||
import hw.view.frame.FrameView;
|
||||
import hw.view.list.LabelListItem;
|
||||
import hw.view.list.ListView.IListItemView;
|
||||
import hw.view.list.VListView;
|
||||
|
||||
@:template class ListForm extends FrameView<Dynamic> {
|
||||
@:view public var list(default, null):VListView<Model>;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
---
|
||||
views:
|
||||
- id: list
|
||||
$type: haxework.view.list.VListView
|
||||
$type: hw.view.list.VListView
|
||||
+onItemSelect: ~onItemSelect
|
||||
factory: ~factory
|
||||
geometry.stretch: true
|
||||
scroll:
|
||||
$type: haxework.view.list.VScrollBarView
|
||||
$type: hw.view.list.VScrollBarView
|
||||
data: $r:any:data50
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package demo.form;
|
||||
|
||||
import haxework.view.frame.FrameView;
|
||||
import hw.view.frame.FrameView;
|
||||
|
||||
@:template class SelectForm extends FrameView<Dynamic> {
|
||||
public function new() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
geometry.padding: 10
|
||||
layout.margin: 5
|
||||
views:
|
||||
- $type: haxework.view.form.SelectView<String>
|
||||
- $type: hw.view.form.SelectView<String>
|
||||
layout.margin: 2
|
||||
dataView.layout.margin: 1
|
||||
data:
|
||||
@@ -13,7 +13,7 @@ views:
|
||||
selected: "value 1"
|
||||
+onSelect: ~function(value) trace('select', value)
|
||||
|
||||
- $type: haxework.view.form.SelectView.SelectIdView<{id:Int,label:String}, Int>
|
||||
- $type: hw.view.form.SelectView.SelectIdView<{id:Int,label:String}, Int>
|
||||
layout.margin: 2
|
||||
dataView.layout.margin: 1
|
||||
labelBuilder: |
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package demo.form;
|
||||
|
||||
import haxework.view.frame.FrameView;
|
||||
import haxework.view.ImageView;
|
||||
import haxework.view.IView;
|
||||
import haxework.view.text.TextView;
|
||||
import haxework.view.utils.DrawUtil;
|
||||
import hw.view.frame.FrameView;
|
||||
import hw.view.ImageView;
|
||||
import hw.view.IView;
|
||||
import hw.view.text.TextView;
|
||||
import hw.view.utils.DrawUtil;
|
||||
|
||||
@:template class TailForm extends FrameView<Dynamic> {
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
overflow.y: scroll
|
||||
views:
|
||||
- id: data
|
||||
$type: haxework.view.data.DataView
|
||||
$type: hw.view.data.DataView
|
||||
geometry.padding: 4
|
||||
layout:
|
||||
$type: haxework.view.layout.TailLayout
|
||||
$type: hw.view.layout.TailLayout
|
||||
margin: 6
|
||||
factory: ~factory
|
||||
geometry.width: 100%
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package demo.form;
|
||||
|
||||
import flash.events.MouseEvent;
|
||||
import haxework.view.frame.FrameView;
|
||||
import haxework.view.SpriteView;
|
||||
import hw.view.frame.FrameView;
|
||||
import hw.view.SpriteView;
|
||||
|
||||
@:template class TestLayoutForm extends FrameView<Dynamic> {
|
||||
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
---
|
||||
views:
|
||||
- id: main
|
||||
$type: haxework.view.group.VGroupView
|
||||
$type: hw.view.group.VGroupView
|
||||
geometry.stretch: true
|
||||
layout.hAlign: center
|
||||
layout.vAlign: middle
|
||||
views:
|
||||
- id: container
|
||||
$type: haxework.view.group.VGroupView
|
||||
$type: hw.view.group.VGroupView
|
||||
layout.margin: 10
|
||||
skin:
|
||||
$type: [haxework.view.skin.Skin.color, 0xffff00]
|
||||
$type: [hw.view.skin.Skin.color, 0xffff00]
|
||||
views:
|
||||
- id: top
|
||||
$type: haxework.view.group.GroupView
|
||||
$type: hw.view.group.GroupView
|
||||
layout.hAlign: center
|
||||
geometry.width: 100%
|
||||
geometry.height: 20
|
||||
style: test
|
||||
- id: middle
|
||||
$type: haxework.view.group.HGroupView
|
||||
$type: hw.view.group.HGroupView
|
||||
layout.margin: 10
|
||||
views:
|
||||
- id: left
|
||||
$type: haxework.view.group.GroupView
|
||||
$type: hw.view.group.GroupView
|
||||
layout.vAlign: middle
|
||||
geometry.width: 20
|
||||
geometry.height: 100%
|
||||
style: test
|
||||
- id: render
|
||||
$type: haxework.view.SpriteView
|
||||
$type: hw.view.SpriteView
|
||||
#geometry.width: 300
|
||||
#geometry.height: 200
|
||||
style: test
|
||||
- id: right
|
||||
$type: haxework.view.group.GroupView
|
||||
$type: hw.view.group.GroupView
|
||||
layout.vAlign: middle
|
||||
geometry.width: 20
|
||||
geometry.height: 100%
|
||||
style: test
|
||||
views:
|
||||
- $type: haxework.view.SpriteView
|
||||
- $type: hw.view.SpriteView
|
||||
geometry.width: 100
|
||||
geometry.height: 100%
|
||||
skin:
|
||||
$type: [haxework.view.skin.Skin.color, 0xff0000]
|
||||
$type: [hw.view.skin.Skin.color, 0xff0000]
|
||||
- id: bottom
|
||||
$type: haxework.view.group.GroupView
|
||||
$type: hw.view.group.GroupView
|
||||
layout.hAlign: center
|
||||
style: test
|
||||
geometry.width: 100%
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package demo.popup;
|
||||
|
||||
import haxework.view.form.ButtonView;
|
||||
import haxework.view.popup.PopupView;
|
||||
import haxework.view.skin.Skin;
|
||||
import hw.view.form.ButtonView;
|
||||
import hw.view.popup.PopupView;
|
||||
import hw.view.skin.Skin;
|
||||
|
||||
@:template class ColorPopup extends PopupView<Null<Int>> {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
view:
|
||||
$type: haxework.view.group.VGroupView
|
||||
$type: hw.view.group.VGroupView
|
||||
geometry.width: 400
|
||||
geometry.height: 200
|
||||
geometry.padding: 10
|
||||
@@ -9,10 +9,10 @@ view:
|
||||
style: frame
|
||||
views:
|
||||
- id: colors
|
||||
$type: haxework.view.data.DataView
|
||||
$type: hw.view.data.DataView
|
||||
geometry.stretch: true
|
||||
layout:
|
||||
$type: haxework.view.layout.TailLayout
|
||||
$type: hw.view.layout.TailLayout
|
||||
vAlign: middle
|
||||
margin: 5
|
||||
factory: ~colorViewFactory
|
||||
@@ -23,11 +23,11 @@ view:
|
||||
- 0xCC33AA
|
||||
- 0x3333AA
|
||||
+onDataSelect: ~close
|
||||
- $type: haxework.view.group.HGroupView
|
||||
- $type: hw.view.group.HGroupView
|
||||
geometry.width: 100%
|
||||
layout.hAlign: right
|
||||
layout.margin: 10
|
||||
views:
|
||||
- $type: haxework.view.form.ButtonView
|
||||
- $type: hw.view.form.ButtonView
|
||||
text: Cancel
|
||||
+onPress: ~reject('cancel')
|
||||
|
||||
@@ -2,10 +2,10 @@ package demo.popup;
|
||||
|
||||
import flash.text.Font;
|
||||
import flash.text.FontType;
|
||||
import haxework.view.list.LabelListItem;
|
||||
import haxework.view.list.ListView;
|
||||
import haxework.view.popup.PopupView;
|
||||
import haxework.view.theme.ITheme;
|
||||
import hw.view.list.LabelListItem;
|
||||
import hw.view.list.ListView;
|
||||
import hw.view.popup.PopupView;
|
||||
import hw.view.theme.ITheme;
|
||||
|
||||
class FontLabelView extends LabelListItem<ThemeFont> {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
view:
|
||||
$type: haxework.view.group.VGroupView
|
||||
$type: hw.view.group.VGroupView
|
||||
geometry.width: 400
|
||||
geometry.height: 80%
|
||||
geometry.padding: 10
|
||||
@@ -9,17 +9,17 @@ view:
|
||||
style: frame
|
||||
views:
|
||||
- id: fonts
|
||||
$type: haxework.view.list.VListView
|
||||
$type: hw.view.list.VListView
|
||||
geometry.stretch: true
|
||||
factory: ~fontViewFactory
|
||||
+onItemSelect: ~function(item) close(item.data)
|
||||
scroll:
|
||||
$type: haxework.view.list.VScrollBarView
|
||||
- $type: haxework.view.group.HGroupView
|
||||
$type: hw.view.list.VScrollBarView
|
||||
- $type: hw.view.group.HGroupView
|
||||
geometry.width: 100%
|
||||
geometry.margin.top: 10
|
||||
layout.hAlign: right
|
||||
views:
|
||||
- $type: haxework.view.form.ButtonView
|
||||
- $type: hw.view.form.ButtonView
|
||||
text: Cancel
|
||||
+onPress: ~reject('cancel')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package demo.storage;
|
||||
|
||||
import haxework.storage.SharedObjectStorage;
|
||||
import hw.storage.SharedObjectStorage;
|
||||
|
||||
@:provide class TestStorage extends SharedObjectStorage {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package demo.test;
|
||||
|
||||
import haxework.view.group.GroupView;
|
||||
import hw.view.group.GroupView;
|
||||
|
||||
@:template class TestView extends GroupView {
|
||||
|
||||
|
||||
@@ -1,61 +1,61 @@
|
||||
---
|
||||
geometry.padding: 10
|
||||
views:
|
||||
- $type: haxework.view.group.HGroupView
|
||||
- $type: hw.view.group.HGroupView
|
||||
geometry.padding: 10
|
||||
geometry.width: 100%
|
||||
layout.margin: 10
|
||||
layout.vAlign: middle
|
||||
skin:
|
||||
$type: haxework.view.skin.SpriteSkin
|
||||
$type: hw.view.skin.SpriteSkin
|
||||
background.color: 0xffff00
|
||||
background.alpha: 1
|
||||
views:
|
||||
- $type: haxework.view.SpriteView
|
||||
- $type: hw.view.SpriteView
|
||||
geometry.width: 100
|
||||
geometry.height: 100
|
||||
skin:
|
||||
$type: haxework.view.skin.SpriteSkin
|
||||
$type: hw.view.skin.SpriteSkin
|
||||
background.color: 0xff0000
|
||||
background.alpha: 1
|
||||
- $type: haxework.view.group.VGroupView
|
||||
- $type: hw.view.group.VGroupView
|
||||
geometry.padding: 10
|
||||
layout.margin: 10
|
||||
skin:
|
||||
$type: haxework.view.skin.SpriteSkin
|
||||
$type: hw.view.skin.SpriteSkin
|
||||
background.color: 0x00ffff
|
||||
background.alpha: 1
|
||||
views:
|
||||
- $type: haxework.view.SpriteView
|
||||
- $type: hw.view.SpriteView
|
||||
geometry.width: 100
|
||||
geometry.height: 100
|
||||
size:
|
||||
_test_: [200, 200]
|
||||
skin:
|
||||
$type: haxework.view.skin.SpriteSkin
|
||||
$type: hw.view.skin.SpriteSkin
|
||||
background.color: 0xff0000
|
||||
background.alpha: 1
|
||||
- $type: haxework.view.SpriteView
|
||||
- $type: hw.view.SpriteView
|
||||
geometry.width: 100
|
||||
geometry.height: 100
|
||||
skin:
|
||||
$type: haxework.view.skin.SpriteSkin
|
||||
$type: hw.view.skin.SpriteSkin
|
||||
background.color: 0xff0000
|
||||
background.alpha: 1
|
||||
- $type: haxework.view.text.TextView
|
||||
- $type: hw.view.text.TextView
|
||||
geometry.padding: 20
|
||||
text: "Azazaza"
|
||||
- $type: haxework.view.SpriteView
|
||||
- $type: hw.view.SpriteView
|
||||
geometry.width: 60%
|
||||
geometry.height: 100%
|
||||
skin:
|
||||
$type: haxework.view.skin.SpriteSkin
|
||||
$type: hw.view.skin.SpriteSkin
|
||||
background.color: 0xff0000
|
||||
background.alpha: 1
|
||||
- $type: haxework.view.SpriteView
|
||||
- $type: hw.view.SpriteView
|
||||
geometry.width: 40%
|
||||
geometry.height: 80%
|
||||
skin:
|
||||
$type: haxework.view.skin.SpriteSkin
|
||||
$type: hw.view.skin.SpriteSkin
|
||||
background.color: 0xff0000
|
||||
background.alpha: 1
|
||||
|
||||
@@ -1 +1 @@
|
||||
--macro haxework.parser.Parser.auto()
|
||||
--macro hw.parser.Parser.auto()
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"template"
|
||||
],
|
||||
"description": "View framework.",
|
||||
"version": "1.3.0",
|
||||
"version": "2.0.0",
|
||||
"releasenote": "Update.",
|
||||
"contributors": [
|
||||
"shmyga"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package;
|
||||
|
||||
import haxework.log.ILogger;
|
||||
import hw.log.ILogger;
|
||||
|
||||
class L {
|
||||
|
||||
@@ -25,4 +25,4 @@ class L {
|
||||
public static function e(tag:String, message:String, ?error:Dynamic, ?p:haxe.PosInfos):Void {
|
||||
for (logger in loggers) logger.e(tag, message, error, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package haxework;
|
||||
|
||||
import flash.display.BitmapData;
|
||||
import flash.Lib;
|
||||
import haxework.animate.Animate;
|
||||
import haxework.animate.FadeAnimate;
|
||||
import haxework.animate.UnFadeAnimate;
|
||||
import haxework.view.IView;
|
||||
import haxework.view.popup.PopupManager;
|
||||
import haxework.view.Root;
|
||||
import haxework.view.theme.ITheme;
|
||||
|
||||
class App {
|
||||
|
||||
@:provide var app:App;
|
||||
@:provide var theme:ITheme;
|
||||
@:provide var popupManager:PopupManager;
|
||||
|
||||
public function new(?theme:ITheme, ?icon:BitmapData) {
|
||||
this.theme = theme;
|
||||
#if linux
|
||||
if (icon != null) {
|
||||
haxework.app.LinuxIcon.value = icon;
|
||||
}
|
||||
#end
|
||||
popupManager.showAnimateFactory = function(v) return new UnFadeAnimate(v);
|
||||
popupManager.closeAnimateFactory = function(v) return new FadeAnimate(v);
|
||||
app = this;
|
||||
}
|
||||
|
||||
public function start(view:IView<Dynamic>) {
|
||||
Animate.bind(Lib.current.stage);
|
||||
Root.bind(view);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package haxework.animate;
|
||||
package hw.animate;
|
||||
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Stage;
|
||||
import flash.events.Event;
|
||||
import haxework.view.IView;
|
||||
import hw.view.IView;
|
||||
|
||||
class Animate implements IAnimate {
|
||||
public static var defaultDuraion = 300;
|
||||
@@ -1,10 +1,10 @@
|
||||
package haxework.animate;
|
||||
package hw.animate;
|
||||
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import haxework.animate.Animate;
|
||||
import haxework.animate.IAnimate;
|
||||
import haxework.view.IView;
|
||||
import hw.animate.Animate;
|
||||
import hw.animate.IAnimate;
|
||||
import hw.view.IView;
|
||||
|
||||
class CircleMaskAnimate extends Animate {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package haxework.animate;
|
||||
package hw.animate;
|
||||
|
||||
import haxework.animate.Animate;
|
||||
import haxework.animate.IAnimate;
|
||||
import hw.animate.Animate;
|
||||
import hw.animate.IAnimate;
|
||||
|
||||
class FadeAnimate extends Animate {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.animate;
|
||||
package hw.animate;
|
||||
|
||||
interface IAnimate {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.animate;
|
||||
package hw.animate;
|
||||
|
||||
class SlideAnimate extends Animate {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package haxework.animate;
|
||||
package hw.animate;
|
||||
|
||||
import haxework.animate.Animate;
|
||||
import hw.animate.Animate;
|
||||
|
||||
class UnFadeAnimate extends Animate {
|
||||
|
||||
86
src/main/hw/app/App.hx
Normal file
86
src/main/hw/app/App.hx
Normal file
@@ -0,0 +1,86 @@
|
||||
package hw.app;
|
||||
|
||||
import flash.display.BitmapData;
|
||||
import flash.display.StageDisplayState;
|
||||
import flash.events.FullScreenEvent;
|
||||
import flash.Lib;
|
||||
import hw.animate.Animate;
|
||||
import hw.animate.FadeAnimate;
|
||||
import hw.animate.IAnimate;
|
||||
import hw.animate.UnFadeAnimate;
|
||||
import hw.resources.IResources;
|
||||
import hw.signal.Signal;
|
||||
import hw.view.IView;
|
||||
import hw.view.popup.PopupManager;
|
||||
import hw.view.Root;
|
||||
import hw.view.theme.ITheme;
|
||||
|
||||
class App {
|
||||
|
||||
public var view(default, set):IView<Dynamic>;
|
||||
|
||||
private function set_view(value:IView<Dynamic>):IView<Dynamic> {
|
||||
view = value;
|
||||
Root.bind(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
public var icon(default, set):BitmapData;
|
||||
|
||||
private function set_icon(value:BitmapData):BitmapData {
|
||||
icon = value;
|
||||
#if linux
|
||||
if (icon != null) {
|
||||
hw.app.LinuxIcon.value = icon;
|
||||
}
|
||||
#end
|
||||
return icon;
|
||||
}
|
||||
|
||||
public var fullScreenSupport(get, never):Bool;
|
||||
|
||||
public function get_fullScreenSupport():Bool {
|
||||
return Lib.current.stage.allowsFullScreen;
|
||||
}
|
||||
|
||||
public var fullScreen(get, set):Bool;
|
||||
|
||||
private function get_fullScreen():Bool {
|
||||
return Lib.current.stage.displayState != StageDisplayState.NORMAL;
|
||||
}
|
||||
|
||||
private function set_fullScreen(value:Bool):Bool {
|
||||
Lib.current.stage.displayState = value ? StageDisplayState.FULL_SCREEN : StageDisplayState.NORMAL;
|
||||
return get_fullScreen();
|
||||
}
|
||||
|
||||
public var fullScreenSignal(default, null):Signal<Bool> = new Signal();
|
||||
|
||||
@:provide static var app:App;
|
||||
@:provide static var resources:IResources;
|
||||
@:provide static var popupManager:PopupManager;
|
||||
|
||||
@:provide public var theme:ITheme;
|
||||
|
||||
public function new() {
|
||||
Lib.current.stage.stageFocusRect = false;
|
||||
Lib.current.stage.addEventListener(FullScreenEvent.FULL_SCREEN, event -> fullScreenSignal.emit(event.fullScreen));
|
||||
Animate.bind(Lib.current.stage);
|
||||
|
||||
popupManager.showAnimateFactory = createShowAnimate;
|
||||
popupManager.closeAnimateFactory = createCloseAnimate;
|
||||
|
||||
resources.text.put("app.version", Const.instance.VERSION);
|
||||
resources.text.put("app.name", Const.instance.NAME);
|
||||
|
||||
app = this;
|
||||
}
|
||||
|
||||
private function createShowAnimate(view:IView<Dynamic>):IAnimate {
|
||||
return new UnFadeAnimate(view);
|
||||
}
|
||||
|
||||
private function createCloseAnimate(view:IView<Dynamic>):IAnimate {
|
||||
return new FadeAnimate(view);
|
||||
}
|
||||
}
|
||||
22
src/main/hw/app/Const.hx
Executable file
22
src/main/hw/app/Const.hx
Executable file
@@ -0,0 +1,22 @@
|
||||
package hw.app;
|
||||
|
||||
import flash.Lib;
|
||||
import flash.system.Capabilities;
|
||||
|
||||
@:singleton class Const {
|
||||
public var FPS(default, null):Int;
|
||||
public var BUILD(default, null):String;
|
||||
public var VERSION(default, null):String;
|
||||
public var NAME(default, null):String;
|
||||
public var DEBUG(default, null):Bool;
|
||||
|
||||
public function new():Void {
|
||||
BUILD = CompilationOption.get("build");
|
||||
#if lime
|
||||
FPS = Std.parseInt(Lib.current.stage.application.meta.get("fps"));
|
||||
VERSION = Lib.current.stage.application.meta.get("version");
|
||||
NAME = Lib.current.stage.application.meta.get("name");
|
||||
#end
|
||||
DEBUG = Capabilities.isDebugger;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.app;
|
||||
package hw.app;
|
||||
|
||||
import flash.display.BitmapData;
|
||||
import flash.filters.ColorMatrixFilter;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.color;
|
||||
package hw.color;
|
||||
|
||||
abstract Color(Int) {
|
||||
public var alpha(get, never):Int;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.color;
|
||||
package hw.color;
|
||||
|
||||
class ColorUtil {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.geom;
|
||||
package hw.geom;
|
||||
|
||||
abstract IntPoint(Array<Int>) {
|
||||
public var x(get, set):Int;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.geom;
|
||||
package hw.geom;
|
||||
|
||||
import flash.geom.Point as FlashPoint;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.geom;
|
||||
package hw.geom;
|
||||
|
||||
abstract Rectangle(Array<Float>) {
|
||||
public var x(get, set):Float;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.log;
|
||||
package hw.log;
|
||||
|
||||
import cpp.VarArg;
|
||||
import haxe.extern.Rest;
|
||||
@@ -1,6 +1,6 @@
|
||||
package haxework.log;
|
||||
package hw.log;
|
||||
|
||||
import haxework.log.ILogger.LogLevel;
|
||||
import hw.log.ILogger.LogLevel;
|
||||
import haxe.CallStack;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.log;
|
||||
package hw.log;
|
||||
|
||||
enum LogLevel {
|
||||
DEBUG; INFO; WARNING; ERROR;
|
||||
@@ -10,4 +10,4 @@ interface ILogger {
|
||||
public function i(tag:String, message:String, ?error:Dynamic, ?p:haxe.PosInfos):Void;
|
||||
public function w(tag:String, message:String, ?error:Dynamic, ?p:haxe.PosInfos):Void;
|
||||
public function e(tag:String, message:String, ?error:Dynamic, ?p:haxe.PosInfos):Void;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package haxework.log;
|
||||
package hw.log;
|
||||
|
||||
import haxework.log.ILogger.LogLevel;
|
||||
import hw.log.ILogger.LogLevel;
|
||||
import flash.external.ExternalInterface;
|
||||
import haxework.log.BaseLogger;
|
||||
import hw.log.BaseLogger;
|
||||
|
||||
|
||||
class JSLogger extends BaseLogger {
|
||||
@@ -26,4 +26,4 @@ class JSLogger extends BaseLogger {
|
||||
try {ExternalInterface.call("console.log", text);} catch (error:Dynamic) {available = false;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package haxework.log;
|
||||
package hw.log;
|
||||
|
||||
import haxework.log.BaseLogger;
|
||||
import hw.log.BaseLogger;
|
||||
|
||||
#if js
|
||||
class SocketLogger extends BaseLogger {}
|
||||
@@ -58,4 +58,4 @@ class SocketLogger extends BaseLogger {
|
||||
}
|
||||
}
|
||||
|
||||
#end
|
||||
#end
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.log;
|
||||
package hw.log;
|
||||
|
||||
import flash.text.TextField;
|
||||
|
||||
@@ -15,4 +15,4 @@ class TextFieldLogger extends BaseLogger {
|
||||
override private function write(text:String):Void {
|
||||
this.textField.text += ("\n" + text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.log;
|
||||
package hw.log;
|
||||
|
||||
import haxe.PosInfos;
|
||||
#if cpp
|
||||
@@ -31,7 +31,7 @@ class TraceLogger extends BaseLogger {
|
||||
(untyped console).log(v);
|
||||
//untyped js.Boot.__trace(v, infos);
|
||||
#elseif android
|
||||
haxework.log.AndroidLog.write(3, "", ConstCharStar.fromString(Std.string(v)));
|
||||
hw.log.AndroidLog.write(3, "", ConstCharStar.fromString(Std.string(v)));
|
||||
#elseif (php && php7)
|
||||
php.Boot.trace(v);
|
||||
#elseif php
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
import haxe.macro.Expr;
|
||||
import haxe.macro.Type;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
import haxe.macro.Expr;
|
||||
import haxe.macro.Type;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
import haxe.macro.TypeTools;
|
||||
import haxe.macro.Context;
|
||||
@@ -32,7 +32,7 @@ class DispatcherMacro extends ClassTypeMacro {
|
||||
}
|
||||
var signal = 'Signal${argsTypes.length}';
|
||||
var type = TPath({
|
||||
pack: ['haxework', 'signal'],
|
||||
pack: ['hw', 'signal'],
|
||||
name: 'Signal',
|
||||
sub: signal,
|
||||
params: argsTypes.map(function(t) return TPType(TypeTools.toComplexType(t))),
|
||||
@@ -41,7 +41,7 @@ class DispatcherMacro extends ClassTypeMacro {
|
||||
name: signalName(field.name),
|
||||
access: [APublic],
|
||||
pos: Context.currentPos(),
|
||||
kind: FProp('default', 'null', type, Context.parse('new haxework.signal.Signal.${signal}()', Context.currentPos())),
|
||||
kind: FProp('default', 'null', type, Context.parse('new hw.signal.Signal.${signal}()', Context.currentPos())),
|
||||
});
|
||||
}
|
||||
result.push({
|
||||
@@ -1,8 +1,8 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
import haxe.macro.Expr;
|
||||
|
||||
using haxework.macro.MacroUtil;
|
||||
using hw.macro.MacroUtil;
|
||||
|
||||
class FieldMacro {
|
||||
public var metaName(default, null):String;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
import yaml.YamlException;
|
||||
import yaml.Parser;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
import haxe.macro.Context;
|
||||
import haxe.macro.ExprTools;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
typedef JsonKeyPosition = {
|
||||
var min:Int;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
import haxe.DynamicAccess;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
import haxe.macro.Context;
|
||||
import haxe.macro.Expr;
|
||||
|
||||
using haxework.macro.MacroUtil;
|
||||
using hw.macro.MacroUtil;
|
||||
|
||||
class ProvideMacro extends FieldMacro {
|
||||
|
||||
@@ -35,7 +35,7 @@ class ProvideMacro extends FieldMacro {
|
||||
pos: field.pos,
|
||||
kind: FFun({
|
||||
args: [],
|
||||
expr: Context.parse('return haxework.provider.Provider.instance.get(${args.join(',')})', field.pos),
|
||||
expr: Context.parse('return hw.provider.Provider.instance.get(${args.join(',')})', field.pos),
|
||||
params: [],
|
||||
ret: type,
|
||||
})
|
||||
@@ -47,7 +47,7 @@ class ProvideMacro extends FieldMacro {
|
||||
pos: field.pos,
|
||||
kind: FFun({
|
||||
args: [{name: 'value', type: type}],
|
||||
expr: Context.parse('{haxework.provider.Provider.instance.set(${args.join(',')}); return value;}', field.pos),
|
||||
expr: Context.parse('{hw.provider.Provider.instance.set(${args.join(',')}); return value;}', field.pos),
|
||||
params: [],
|
||||
ret: type,
|
||||
})
|
||||
@@ -1,6 +1,6 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
using haxework.macro.MacroUtil;
|
||||
using hw.macro.MacroUtil;
|
||||
|
||||
class ResourceMacro extends FieldMacro {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
import haxe.macro.Context;
|
||||
import haxe.macro.Expr;
|
||||
@@ -1,11 +1,11 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
import haxe.macro.Context;
|
||||
import haxe.macro.Expr;
|
||||
import haxe.macro.Type;
|
||||
|
||||
using haxe.macro.ComplexTypeTools;
|
||||
using haxework.macro.MacroUtil;
|
||||
using hw.macro.MacroUtil;
|
||||
using haxe.macro.MacroStringTools;
|
||||
|
||||
typedef TProperty<T> = {
|
||||
@@ -143,7 +143,7 @@ class StyleMacro extends ClassTypeMacro {
|
||||
|
||||
private static function buildStyleField(properties:Array<Field>, styleds:Array<Field>, hasOnStyle:Bool, overrideField:Bool):Array<Field> {
|
||||
var result:Array<Field> = [];
|
||||
var type:ComplexType = "haxework.view.theme.StyleId".toComplex();
|
||||
var type:ComplexType = "hw.view.theme.StyleId".toComplex();
|
||||
if (!overrideField) {
|
||||
result.push({
|
||||
name: "style",
|
||||
@@ -162,11 +162,11 @@ class StyleMacro extends ClassTypeMacro {
|
||||
}
|
||||
for (field in properties) {
|
||||
var propertyName = 'theme_${field.name}';
|
||||
expr.push(macro $i{propertyName} = haxework.provider.Provider.instance.get(haxework.view.theme.ITheme).resolve((styleKey!=null?(styleKey+"."):"")+$v{field.name}, style));
|
||||
expr.push(macro $i{propertyName} = hw.provider.Provider.instance.get(hw.view.theme.ITheme).resolve((styleKey!=null?(styleKey+"."):"")+$v{field.name}, style));
|
||||
}
|
||||
for (field in styleds) {
|
||||
var propertyName = '${field.name}';
|
||||
expr.push(macro $i{propertyName} = haxework.provider.Provider.instance.get(haxework.view.theme.ITheme).resolve((styleKey!=null?(styleKey+"."):"")+$v{field.name}, style));
|
||||
expr.push(macro $i{propertyName} = hw.provider.Provider.instance.get(hw.view.theme.ITheme).resolve((styleKey!=null?(styleKey+"."):"")+$v{field.name}, style));
|
||||
}
|
||||
if (hasOnStyle) {
|
||||
expr.push(macro onStyle());
|
||||
@@ -1,12 +1,12 @@
|
||||
package haxework.macro;
|
||||
package hw.macro;
|
||||
|
||||
import haxe.macro.Context;
|
||||
import haxe.macro.Expr;
|
||||
import haxe.macro.Type;
|
||||
import haxework.macro.PositionJsonParser;
|
||||
import hw.macro.PositionJsonParser;
|
||||
import Lambda;
|
||||
|
||||
using haxework.macro.MacroUtil;
|
||||
using hw.macro.MacroUtil;
|
||||
|
||||
class TemplateMacro extends ClassTypeMacro {
|
||||
|
||||
@@ -46,11 +46,11 @@ class TemplateMacro extends ClassTypeMacro {
|
||||
a[2];
|
||||
}
|
||||
case "resource" | "r":
|
||||
var bindExpr = 'haxework.provider.Provider.instance.get(haxework.resources.IResources).${a[1]}.bind("${a[2]}", ${name}, "${key}")';
|
||||
var bindExpr = 'hw.provider.Provider.instance.get(hw.resources.IResources).${a[1]}.bind("${a[2]}", ${name}, "${key}")';
|
||||
exprs.push(Context.parse(bindExpr, getPosition(position)));
|
||||
null;
|
||||
case "translate" | "t":
|
||||
'new haxework.translate.TranslateString("${a[1]}")';
|
||||
'new hw.translate.TranslateString("${a[1]}")';
|
||||
case "template":
|
||||
var template = FileUtil.loadFile(a[1]);
|
||||
return createValue(name, key, template, position, exprs);
|
||||
@@ -1,11 +1,11 @@
|
||||
package haxework.net;
|
||||
package hw.net;
|
||||
|
||||
import promhx.Deferred;
|
||||
import promhx.Promise;
|
||||
import haxe.Timer;
|
||||
import flash.net.URLRequestMethod;
|
||||
import flash.events.ProgressEvent;
|
||||
import haxework.net.manage.ILoaderManager;
|
||||
import hw.net.manage.ILoaderManager;
|
||||
import flash.utils.ByteArray;
|
||||
import flash.events.Event;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net;
|
||||
package hw.net;
|
||||
|
||||
import flash.events.ProgressEvent;
|
||||
import flash.system.Security;
|
||||
@@ -6,7 +6,7 @@ import flash.system.SecurityDomain;
|
||||
import flash.system.ApplicationDomain;
|
||||
import flash.system.LoaderContext;
|
||||
import flash.utils.ByteArray;
|
||||
import haxework.net.BaseLoader;
|
||||
import hw.net.BaseLoader;
|
||||
import flash.events.SecurityErrorEvent;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.events.Event;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net;
|
||||
package hw.net;
|
||||
|
||||
import flash.events.ErrorEvent;
|
||||
import haxe.Timer;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net;
|
||||
package hw.net;
|
||||
|
||||
import promhx.Promise;
|
||||
import promhx.Deferred;
|
||||
@@ -17,4 +17,4 @@ class BatchLoader<T> {
|
||||
return loader.GET(url);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net;
|
||||
package hw.net;
|
||||
|
||||
import flash.net.URLLoaderDataFormat;
|
||||
import flash.utils.ByteArray;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net;
|
||||
package hw.net;
|
||||
|
||||
import flash.system.Security;
|
||||
import flash.utils.ByteArray;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net;
|
||||
package hw.net;
|
||||
|
||||
import promhx.Promise;
|
||||
import flash.utils.ByteArray;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net;
|
||||
package hw.net;
|
||||
|
||||
import flash.display.LoaderInfo;
|
||||
import flash.display.Loader;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net;
|
||||
package hw.net;
|
||||
|
||||
import flash.utils.ByteArray;
|
||||
import flash.events.Event;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net;
|
||||
package hw.net;
|
||||
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.LoaderInfo;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net;
|
||||
package hw.net;
|
||||
|
||||
import flash.net.URLLoader;
|
||||
import flash.events.Event;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net;
|
||||
package hw.net;
|
||||
|
||||
import flash.events.Event;
|
||||
import flash.net.URLLoader;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net.manage;
|
||||
package hw.net.manage;
|
||||
|
||||
@:provide(LoaderManager) interface ILoaderManager {
|
||||
public var actives(default, null):Array<ILoader<Dynamic>>;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.net.manage;
|
||||
package hw.net.manage;
|
||||
|
||||
class LoaderManager implements ILoaderManager {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package haxework.parser;
|
||||
package hw.parser;
|
||||
|
||||
import haxe.macro.Context;
|
||||
import haxe.macro.Expr;
|
||||
import haxe.macro.Type;
|
||||
import haxe.macro.TypeTools;
|
||||
import haxework.macro.ClassProvideMacro;
|
||||
import haxework.macro.ClassTypeMacro;
|
||||
import haxework.macro.DispatcherMacro;
|
||||
import haxework.macro.FieldMacro;
|
||||
import haxework.macro.ProvideMacro;
|
||||
import haxework.macro.ResourceMacro;
|
||||
import haxework.macro.SingletonMacro;
|
||||
import haxework.macro.StyleMacro;
|
||||
import haxework.macro.TemplateMacro;
|
||||
import hw.macro.ClassProvideMacro;
|
||||
import hw.macro.ClassTypeMacro;
|
||||
import hw.macro.DispatcherMacro;
|
||||
import hw.macro.FieldMacro;
|
||||
import hw.macro.ProvideMacro;
|
||||
import hw.macro.ResourceMacro;
|
||||
import hw.macro.SingletonMacro;
|
||||
import hw.macro.StyleMacro;
|
||||
import hw.macro.TemplateMacro;
|
||||
|
||||
class Parser {
|
||||
|
||||
@@ -32,7 +32,7 @@ class Parser {
|
||||
private static var processed:Map<String, Bool> = new Map();
|
||||
|
||||
private static function auto():Void {
|
||||
haxe.macro.Compiler.addGlobalMetadata("", "@:build(haxework.parser.Parser.autoRun())", true, true, false);
|
||||
haxe.macro.Compiler.addGlobalMetadata("", "@:build(hw.parser.Parser.autoRun())", true, true, false);
|
||||
}
|
||||
|
||||
private static macro function autoRun():Array<Field> {
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.provider;
|
||||
package hw.provider;
|
||||
|
||||
abstract KeyType<T>(String) {
|
||||
|
||||
@@ -36,7 +36,7 @@ abstract KeyType<T>(String) {
|
||||
|
||||
macro static function resolveDefaultFactories() {
|
||||
var result = [];
|
||||
for (item in haxework.macro.ClassProvideMacro.bundle) {
|
||||
for (item in hw.macro.ClassProvideMacro.bundle) {
|
||||
// ToDo: ClassType to Expr?
|
||||
var k = haxe.macro.Context.parse(haxe.macro.MacroStringTools.toDotPath(item.key.pack, item.key.name), haxe.macro.Context.currentPos());
|
||||
var v = haxe.macro.Context.parse(haxe.macro.MacroStringTools.toDotPath(item.value.pack, item.value.name), haxe.macro.Context.currentPos());
|
||||
@@ -1,8 +1,8 @@
|
||||
package haxework.resources;
|
||||
package hw.resources;
|
||||
|
||||
import flash.display.BitmapData;
|
||||
import flash.display.MovieClip;
|
||||
import haxework.resources.Resources;
|
||||
import hw.resources.Resources;
|
||||
|
||||
@:provide(Resources) interface IResources {
|
||||
public var image(default, null):ResMap<BitmapData>;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.resources;
|
||||
package hw.resources;
|
||||
|
||||
import flash.display.BitmapData;
|
||||
import flash.display.MovieClip;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.signal;
|
||||
package hw.signal;
|
||||
|
||||
typedef Signal<A> = Signal1<A>;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.storage;
|
||||
package hw.storage;
|
||||
|
||||
interface IStorage {
|
||||
public function exists(key:String):Bool;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.storage;
|
||||
package hw.storage;
|
||||
|
||||
class NoStorage implements IStorage {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.storage;
|
||||
package hw.storage;
|
||||
|
||||
import flash.net.SharedObject;
|
||||
import haxe.Serializer;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.text;
|
||||
package hw.text;
|
||||
|
||||
import haxe.Timer;
|
||||
import flash.text.TextFormat;
|
||||
@@ -145,4 +145,4 @@ class BitmapTextField extends TextField {
|
||||
textField.visible = false;
|
||||
return bd;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.text;
|
||||
package hw.text;
|
||||
|
||||
import flash.geom.Point;
|
||||
import flash.text.TextField;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.translate;
|
||||
package hw.translate;
|
||||
|
||||
interface ITranslate {
|
||||
public function get(key:String):String;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.translate;
|
||||
package hw.translate;
|
||||
|
||||
class Translate implements ITranslate {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package haxework.translate;
|
||||
package hw.translate;
|
||||
|
||||
import haxework.provider.Provider;
|
||||
import hw.provider.Provider;
|
||||
|
||||
abstract TranslateString(String) from String to String {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.utils;
|
||||
package hw.utils;
|
||||
|
||||
class NumberUtil {
|
||||
|
||||
@@ -9,4 +9,4 @@ class NumberUtil {
|
||||
public static inline function limitFloat(value:Float, min:Float, max:Float):Float {
|
||||
return Math.max(Math.min(max, value), min);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.utils;
|
||||
package hw.utils;
|
||||
|
||||
import haxe.Unserializer;
|
||||
import haxe.Serializer;
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.utils;
|
||||
package hw.utils;
|
||||
|
||||
using StringTools;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package haxework.view;
|
||||
package hw.view;
|
||||
|
||||
import flash.display.DisplayObject;
|
||||
import flash.geom.Rectangle;
|
||||
import haxework.view.geometry.Geometry;
|
||||
import haxework.view.geometry.SizeSet;
|
||||
import haxework.view.group.IGroupView;
|
||||
import haxework.view.skin.ISkin;
|
||||
import haxework.view.theme.StyleId;
|
||||
import hw.view.geometry.Geometry;
|
||||
import hw.view.geometry.SizeSet;
|
||||
import hw.view.group.IGroupView;
|
||||
import hw.view.skin.ISkin;
|
||||
import hw.view.theme.StyleId;
|
||||
|
||||
interface IView<C:DisplayObject> {
|
||||
public var geometry(default, set):Geometry;
|
||||
@@ -1,10 +1,10 @@
|
||||
package haxework.view;
|
||||
package hw.view;
|
||||
|
||||
import flash.display.BitmapData;
|
||||
import haxework.net.ImageLoader;
|
||||
import haxework.view.skin.BitmapSkin;
|
||||
import haxework.view.utils.BitmapUtil;
|
||||
import haxework.view.utils.DrawUtil.FillType;
|
||||
import hw.net.ImageLoader;
|
||||
import hw.view.skin.BitmapSkin;
|
||||
import hw.view.utils.BitmapUtil;
|
||||
import hw.view.utils.DrawUtil.FillType;
|
||||
|
||||
class ImageView extends SpriteView {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package haxework.view;
|
||||
package hw.view;
|
||||
|
||||
import haxework.net.SwfLoader;
|
||||
import hw.net.SwfLoader;
|
||||
import flash.display.MovieClip;
|
||||
|
||||
//ToDo: sprite wrapper?
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.view;
|
||||
package hw.view;
|
||||
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.StageAlign;
|
||||
@@ -7,9 +7,9 @@ import flash.errors.Error;
|
||||
import flash.events.Event;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.Lib;
|
||||
import haxework.provider.Provider;
|
||||
import haxework.signal.Signal;
|
||||
import haxework.view.group.IGroupView;
|
||||
import hw.provider.Provider;
|
||||
import hw.signal.Signal;
|
||||
import hw.view.group.IGroupView;
|
||||
|
||||
class Root {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package haxework.view;
|
||||
package hw.view;
|
||||
|
||||
import flash.display.Sprite;
|
||||
import haxework.view.skin.SpriteSkin;
|
||||
import hw.view.skin.SpriteSkin;
|
||||
|
||||
class SpriteView extends View<Sprite> {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package haxework.view;
|
||||
package hw.view;
|
||||
|
||||
import flash.Lib;
|
||||
import flash.display.Stage;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.InteractiveObject;
|
||||
import flash.geom.Rectangle;
|
||||
import haxework.view.geometry.Geometry;
|
||||
import haxework.view.geometry.SizeSet;
|
||||
import haxework.view.group.IGroupView;
|
||||
import haxework.view.skin.ISkin;
|
||||
import haxework.view.theme.ITheme;
|
||||
import hw.view.geometry.Geometry;
|
||||
import hw.view.geometry.SizeSet;
|
||||
import hw.view.group.IGroupView;
|
||||
import hw.view.skin.ISkin;
|
||||
import hw.view.theme.ITheme;
|
||||
|
||||
@:style class View<C:DisplayObject> implements IView<C> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package haxework.view;
|
||||
package hw.view;
|
||||
|
||||
import flash.events.Event;
|
||||
import flash.display.Stage;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user