commit 026fb13dfeb6570f1a5da5136770b862668a0522 Author: 3wc <3wc@doesthisthing.work> Date: Sun Jul 30 19:45:16 2023 +0100 Initial code diff --git a/compile.hxml b/compile.hxml new file mode 100644 index 0000000..6573025 --- /dev/null +++ b/compile.hxml @@ -0,0 +1,6 @@ +-cp src +-lib heaps +-lib hlsdl +-hl hello.hl +-main Main +-lib domkit diff --git a/res/style.css b/res/style.css new file mode 100644 index 0000000..30ba63d --- /dev/null +++ b/res/style.css @@ -0,0 +1,46 @@ +.mybox { + background: #080; + padding: -10; +} + +view.mybox { + padding: 10; +} + +container { + max-width: 300; + layout: vertical; +} + +button { + background: #333; + fill-width: true; + height: 30; + transition: background 0.5; +} + +button.highlight { + background: #a33; +} + +button text { + align: middle middle; +} + +button:hover { + background: #444; +} + +button text { + align: middle middle; + color : #aaa; + transition : color; +} + +button:hover text { + color : white; +} + +button:active { + background: #666; +} \ No newline at end of file diff --git a/src/Main.hx b/src/Main.hx new file mode 100644 index 0000000..2927f5f --- /dev/null +++ b/src/Main.hx @@ -0,0 +1,126 @@ + + +@: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 = + + + for( i in icons ) + + ; + + public function new(align:h2d.Flow.FlowAlign,icons:Array,?parent) { + super(parent); + initComponent(); + } + +} + + +@: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 = + +