diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..bd81735 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.iml +*.ipr +*.iws +out/ \ No newline at end of file diff --git a/examples/ViewExample.hx b/examples/ViewExample.hx new file mode 100755 index 0000000..d805489 --- /dev/null +++ b/examples/ViewExample.hx @@ -0,0 +1,37 @@ +package examples; + +import flash.Lib; +import haxework.gui.skin.ColorSkin; +import haxework.gui.View; +import haxework.gui.IView; +import flash.display.Sprite; +import haxework.gui.GroupView; +import haxework.gui.IGroupView; + +class ViewExample { + + public static function main() { + View.updater.stage = Lib.current.stage; + + var group:IGroupView = new GroupView(); + group.width = 400; + group.height = 400; + group.skin = new ColorSkin(0xffff00); + var view:IView = new View(); + view.width = 200; + view.height = 200; + view.skin = new ColorSkin(0xff0000); + group.addView(view); + view = new View(); + view.width = 100; + view.height = 100; + view.skin = new ColorSkin(0x00ff00); + group.addView(view); + view = new View(); + view.width = 50; + view.height = 50; + view.skin = new ColorSkin(0x0000ff); + group.addView(view); + Lib.current.addChild(group.content); + } +} \ No newline at end of file diff --git a/com/abit/haxework/core/Tuple.hx b/haxework/core/Tuple.hx similarity index 99% rename from com/abit/haxework/core/Tuple.hx rename to haxework/core/Tuple.hx index f02c2d4..a59beb7 100755 --- a/com/abit/haxework/core/Tuple.hx +++ b/haxework/core/Tuple.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.core; +package haxework.core; typedef Tuple2#if!H#end = { var first(default, null):T1; var second(default, null):T2; diff --git a/com/abit/haxework/gui/GroupView.hx b/haxework/gui/GroupView.hx similarity index 93% rename from com/abit/haxework/gui/GroupView.hx rename to haxework/gui/GroupView.hx index 162caa3..799c4f7 100755 --- a/com/abit/haxework/gui/GroupView.hx +++ b/haxework/gui/GroupView.hx @@ -1,9 +1,9 @@ -package com.abit.haxework.gui; +package haxework.gui; -import com.abit.haxework.gui.core.VAlign; -import com.abit.haxework.gui.core.HAlign; -import com.abit.haxework.gui.layout.DefaultLayout; -import com.abit.haxework.gui.layout.ILayout; +import haxework.gui.core.VAlign; +import haxework.gui.core.HAlign; +import haxework.gui.layout.DefaultLayout; +import haxework.gui.layout.ILayout; import flash.display.Sprite; class GroupView extends View implements IGroupView { diff --git a/com/abit/haxework/gui/IGroupView.hx b/haxework/gui/IGroupView.hx similarity index 80% rename from com/abit/haxework/gui/IGroupView.hx rename to haxework/gui/IGroupView.hx index f7a55e6..d6a384e 100755 --- a/com/abit/haxework/gui/IGroupView.hx +++ b/haxework/gui/IGroupView.hx @@ -1,8 +1,8 @@ -package com.abit.haxework.gui; +package haxework.gui; -import com.abit.haxework.gui.core.HAlign; -import com.abit.haxework.gui.core.VAlign; -import com.abit.haxework.gui.layout.ILayout; +import haxework.gui.core.HAlign; +import haxework.gui.core.VAlign; +import haxework.gui.layout.ILayout; interface IGroupView extends IView { diff --git a/com/abit/haxework/gui/IView.hx b/haxework/gui/IView.hx similarity index 81% rename from com/abit/haxework/gui/IView.hx rename to haxework/gui/IView.hx index 61f898c..6ac61e5 100755 --- a/com/abit/haxework/gui/IView.hx +++ b/haxework/gui/IView.hx @@ -1,9 +1,9 @@ -package com.abit.haxework.gui; +package haxework.gui; -import com.abit.haxework.gui.core.VAlign; -import com.abit.haxework.gui.core.HAlign; -import com.abit.haxework.gui.skin.ISkin; -import com.abit.haxework.gui.core.SizeType; +import haxework.gui.core.VAlign; +import haxework.gui.core.HAlign; +import haxework.gui.skin.ISkin; +import haxework.gui.core.SizeType; interface IView { public var id(default, null):String; diff --git a/com/abit/haxework/gui/View.hx b/haxework/gui/View.hx similarity index 93% rename from com/abit/haxework/gui/View.hx rename to haxework/gui/View.hx index da588b4..ee3360c 100755 --- a/com/abit/haxework/gui/View.hx +++ b/haxework/gui/View.hx @@ -1,12 +1,14 @@ -package com.abit.haxework.gui; +package haxework.gui; -import com.abit.haxework.gui.core.SizeType; -import com.abit.haxework.gui.core.HAlign; -import com.abit.haxework.gui.core.VAlign; +import flash.display.StageAlign; +import flash.display.StageScaleMode; +import haxework.gui.core.SizeType; +import haxework.gui.core.HAlign; +import haxework.gui.core.VAlign; import flash.events.Event; import flash.display.Stage; -import com.abit.haxework.gui.skin.FakeSkin; -import com.abit.haxework.gui.skin.ISkin; +import haxework.gui.skin.FakeSkin; +import haxework.gui.skin.ISkin; import flash.display.Sprite; @@ -205,6 +207,8 @@ class Updater { } private function set_stage(value:Stage):Stage { + value.scaleMode = StageScaleMode.NO_SCALE; + value.align = StageAlign.TOP_LEFT; value.addEventListener(Event.ENTER_FRAME, update); return value; } diff --git a/com/abit/haxework/gui/core/HAlign.hx b/haxework/gui/core/HAlign.hx similarity index 54% rename from com/abit/haxework/gui/core/HAlign.hx rename to haxework/gui/core/HAlign.hx index 709b5cb..1ed9a2d 100755 --- a/com/abit/haxework/gui/core/HAlign.hx +++ b/haxework/gui/core/HAlign.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.gui.core; +package haxework.gui.core; enum HAlign { TOP; diff --git a/com/abit/haxework/gui/core/SizeType.hx b/haxework/gui/core/SizeType.hx similarity index 52% rename from com/abit/haxework/gui/core/SizeType.hx rename to haxework/gui/core/SizeType.hx index 8a44f0b..94d2864 100755 --- a/com/abit/haxework/gui/core/SizeType.hx +++ b/haxework/gui/core/SizeType.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.gui.core; +package haxework.gui.core; enum SizeType { NORMAL; diff --git a/com/abit/haxework/gui/core/VAlign.hx b/haxework/gui/core/VAlign.hx similarity index 54% rename from com/abit/haxework/gui/core/VAlign.hx rename to haxework/gui/core/VAlign.hx index 59beefa..64d6056 100755 --- a/com/abit/haxework/gui/core/VAlign.hx +++ b/haxework/gui/core/VAlign.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.gui.core; +package haxework.gui.core; enum VAlign { LEFT; diff --git a/com/abit/haxework/gui/layout/DefaultLayout.hx b/haxework/gui/layout/DefaultLayout.hx similarity index 81% rename from com/abit/haxework/gui/layout/DefaultLayout.hx rename to haxework/gui/layout/DefaultLayout.hx index f055be8..38cb382 100755 --- a/com/abit/haxework/gui/layout/DefaultLayout.hx +++ b/haxework/gui/layout/DefaultLayout.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.gui.layout; +package haxework.gui.layout; class DefaultLayout implements ILayout { diff --git a/com/abit/haxework/gui/layout/ILayout.hx b/haxework/gui/layout/ILayout.hx similarity index 73% rename from com/abit/haxework/gui/layout/ILayout.hx rename to haxework/gui/layout/ILayout.hx index e8d34c7..c056a0f 100755 --- a/com/abit/haxework/gui/layout/ILayout.hx +++ b/haxework/gui/layout/ILayout.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.gui.layout; +package haxework.gui.layout; interface ILayout { public function place(group:IGroupView, views:Array>):Void; diff --git a/com/abit/haxework/gui/skin/ColorSkin.hx b/haxework/gui/skin/ColorSkin.hx similarity index 92% rename from com/abit/haxework/gui/skin/ColorSkin.hx rename to haxework/gui/skin/ColorSkin.hx index 7ca2313..96be217 100755 --- a/com/abit/haxework/gui/skin/ColorSkin.hx +++ b/haxework/gui/skin/ColorSkin.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.gui.skin; +package haxework.gui.skin; import flash.display.Graphics; import flash.display.Sprite; diff --git a/com/abit/haxework/gui/skin/FakeSkin.hx b/haxework/gui/skin/FakeSkin.hx similarity index 82% rename from com/abit/haxework/gui/skin/FakeSkin.hx rename to haxework/gui/skin/FakeSkin.hx index 2124dd6..00643ec 100755 --- a/com/abit/haxework/gui/skin/FakeSkin.hx +++ b/haxework/gui/skin/FakeSkin.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.gui.skin; +package haxework.gui.skin; import flash.display.Sprite; diff --git a/com/abit/haxework/gui/skin/ISkin.hx b/haxework/gui/skin/ISkin.hx similarity index 66% rename from com/abit/haxework/gui/skin/ISkin.hx rename to haxework/gui/skin/ISkin.hx index feed0f6..e725d4f 100755 --- a/com/abit/haxework/gui/skin/ISkin.hx +++ b/haxework/gui/skin/ISkin.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.gui.skin; +package haxework.gui.skin; interface ISkin> { public function draw(view:V):Void; diff --git a/com/abit/haxework/net/BaseLoader.hx b/haxework/net/BaseLoader.hx similarity index 86% rename from com/abit/haxework/net/BaseLoader.hx rename to haxework/net/BaseLoader.hx index 43232c9..3f9a425 100755 --- a/com/abit/haxework/net/BaseLoader.hx +++ b/haxework/net/BaseLoader.hx @@ -1,9 +1,9 @@ -package com.abit.haxework.net; +package haxework.net; -import com.abit.haxework.net.callback.Callback; -import com.abit.haxework.net.callback.ICallback; +import haxework.net.callback.Callback; +import haxework.net.callback.ICallback; import flash.events.Event; -import com.abit.haxework.net.ILoader.Method; +import haxework.net.ILoader.Method; class BaseLoader implements ILoader { diff --git a/com/abit/haxework/net/BaseMediaLoader.hx b/haxework/net/BaseMediaLoader.hx similarity index 93% rename from com/abit/haxework/net/BaseMediaLoader.hx rename to haxework/net/BaseMediaLoader.hx index 17b520a..5c8d74d 100755 --- a/com/abit/haxework/net/BaseMediaLoader.hx +++ b/haxework/net/BaseMediaLoader.hx @@ -1,6 +1,6 @@ -package com.abit.haxework.net; +package haxework.net; -import com.abit.haxework.net.BaseLoader; +import haxework.net.BaseLoader; import flash.events.SecurityErrorEvent; import flash.events.IOErrorEvent; import flash.events.Event; diff --git a/com/abit/haxework/net/BaseURLLoader.hx b/haxework/net/BaseURLLoader.hx similarity index 88% rename from com/abit/haxework/net/BaseURLLoader.hx rename to haxework/net/BaseURLLoader.hx index f0c33a9..24dcc71 100755 --- a/com/abit/haxework/net/BaseURLLoader.hx +++ b/haxework/net/BaseURLLoader.hx @@ -1,14 +1,11 @@ -package com.abit.haxework.net; +package haxework.net; import flash.net.URLLoaderDataFormat; import flash.events.SecurityErrorEvent; -import com.abit.haxework.net.callback.Callback; -import com.abit.haxework.net.callback.ICallback; import flash.events.IOErrorEvent; import flash.net.URLRequest; import flash.events.Event; import flash.net.URLLoader; -import com.abit.haxework.net.ILoader.Method; class BaseURLLoader extends BaseLoader { diff --git a/com/abit/haxework/net/ILoader.hx b/haxework/net/ILoader.hx similarity index 72% rename from com/abit/haxework/net/ILoader.hx rename to haxework/net/ILoader.hx index 20a91d1..96ab589 100755 --- a/com/abit/haxework/net/ILoader.hx +++ b/haxework/net/ILoader.hx @@ -1,6 +1,6 @@ -package com.abit.haxework.net; +package haxework.net; -import com.abit.haxework.net.callback.ICallback; +import haxework.net.callback.ICallback; enum Method { GET; diff --git a/com/abit/haxework/net/ImageLoader.hx b/haxework/net/ImageLoader.hx similarity index 92% rename from com/abit/haxework/net/ImageLoader.hx rename to haxework/net/ImageLoader.hx index 11b2f06..997ff59 100755 --- a/com/abit/haxework/net/ImageLoader.hx +++ b/haxework/net/ImageLoader.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.net; +package haxework.net; import flash.display.LoaderInfo; import flash.display.Loader; diff --git a/com/abit/haxework/net/JsonLoader.hx b/haxework/net/JsonLoader.hx similarity index 89% rename from com/abit/haxework/net/JsonLoader.hx rename to haxework/net/JsonLoader.hx index 17073a2..177e58a 100755 --- a/com/abit/haxework/net/JsonLoader.hx +++ b/haxework/net/JsonLoader.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.net; +package haxework.net; import flash.events.Event; import flash.net.URLLoader; diff --git a/com/abit/haxework/net/TextLoader.hx b/haxework/net/TextLoader.hx similarity index 88% rename from com/abit/haxework/net/TextLoader.hx rename to haxework/net/TextLoader.hx index 6bf5367..76c893d 100755 --- a/com/abit/haxework/net/TextLoader.hx +++ b/haxework/net/TextLoader.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.net; +package haxework.net; import flash.net.URLLoader; import flash.events.Event; diff --git a/com/abit/haxework/net/callback/Callback.hx b/haxework/net/callback/Callback.hx similarity index 94% rename from com/abit/haxework/net/callback/Callback.hx rename to haxework/net/callback/Callback.hx index 0a5d0aa..698e32c 100755 --- a/com/abit/haxework/net/callback/Callback.hx +++ b/haxework/net/callback/Callback.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.net.callback; +package haxework.net.callback; class Callback implements ICallback { diff --git a/com/abit/haxework/net/callback/ICallback.hx b/haxework/net/callback/ICallback.hx similarity index 85% rename from com/abit/haxework/net/callback/ICallback.hx rename to haxework/net/callback/ICallback.hx index 5a653ed..c6afb8d 100755 --- a/com/abit/haxework/net/callback/ICallback.hx +++ b/haxework/net/callback/ICallback.hx @@ -1,4 +1,4 @@ -package com.abit.haxework.net.callback; +package haxework.net.callback; interface ICallback { public function success(f:T -> Void):ICallback;