diff --git a/compile.hxml b/compile.hxml index f9dba16..d81bc5c 100644 --- a/compile.hxml +++ b/compile.hxml @@ -1,4 +1,5 @@ -cp src +--macro Init.setup() -lib heaps -lib hlsdl -hl rewild.hl diff --git a/res/bg.png b/res/bg.png new file mode 100644 index 0000000..12fb4b7 Binary files /dev/null and b/res/bg.png differ diff --git a/res/style.css b/res/style.css index 6183bbe..d6f14bb 100644 --- a/res/style.css +++ b/res/style.css @@ -12,35 +12,35 @@ container { layout: vertical; } -button { +menubutton { background: #333; fill-width: true; height: 30; transition: background 0.5; } -button.highlight { +menubutton.highlight { background: #a33; } -button text { +menubutton text { align: middle middle; } -button:hover { +menubutton:hover { background: #444; } -button text { +menubutton text { align: middle middle; color : #aaa; transition : color; } -button:hover text { +menubutton:hover text { color : white; } -button:active { +menubutton:active { background: #666; } diff --git a/src/Init.hx b/src/Init.hx new file mode 100644 index 0000000..a2c6dee --- /dev/null +++ b/src/Init.hx @@ -0,0 +1,5 @@ +class Init { + public static function setup() { + domkit.Macros.registerComponentsPath("components.$Component"); + } +} diff --git a/src/Main.hx b/src/Main.hx index 6e1600e..6698429 100644 --- a/src/Main.hx +++ b/src/Main.hx @@ -1,5 +1,6 @@ +import components.MenubuttonComponent; + @:uiComp("view") -// Naming scheme of component classes can be customized with domkit.Macros.registerComponentsPath(); class ViewComp extends h2d.Flow implements h2d.domkit.Object { static var SRC = @@ -13,51 +14,14 @@ class ViewComp extends h2d.Flow implements h2d.domkit.Object { } } -@:uiComp("button") -class ButtonComp extends h2d.Flow implements h2d.domkit.Object { - static var SRC = - - public var label(get, set):String; - - function get_label() - return labelTxt.text; - - function set_label(s) { - labelTxt.text = s; - return s; - } - - public function new(?parent) { - super(parent); - initComponent(); - enableInteractive = true; - interactive.onClick = function(_) onClick(); - interactive.onOver = function(_) { - dom.hover = true; - }; - interactive.onPush = function(_) { - dom.active = true; - }; - interactive.onRelease = function(_) { - dom.active = false; - }; - interactive.onOut = function(_) { - dom.hover = false; - }; - } - - public dynamic function onClick() {} -} - @:uiComp("container") class ContainerComp extends h2d.Flow implements h2d.domkit.Object { static var SRC = -