From 17ba4ada30c35df8778b827a739c7b2cc9bad687 Mon Sep 17 00:00:00 2001
From: 3wc <3wc@doesthisthing.work>
Date: Tue, 13 Feb 2024 13:47:24 -0300
Subject: [PATCH] Break out title screen into separate file
---
res/style.css | 2 +-
src/Main.hx | 35 ++---------------------------------
src/screens/TitleScreen.hx | 33 +++++++++++++++++++++++++++++++++
3 files changed, 36 insertions(+), 34 deletions(-)
create mode 100644 src/screens/TitleScreen.hx
diff --git a/res/style.css b/res/style.css
index d6f14bb..5dac9ab 100644
--- a/res/style.css
+++ b/res/style.css
@@ -7,7 +7,7 @@ view.mybox {
padding: 10;
}
-container {
+title-screen {
max-width: 300;
layout: vertical;
}
diff --git a/src/Main.hx b/src/Main.hx
index ac30d04..5ac9b89 100644
--- a/src/Main.hx
+++ b/src/Main.hx
@@ -1,36 +1,5 @@
-import components.MenubuttonComponent;
+import screens.TitleScreen;
-@:uiComp("view")
-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("container")
-class ContainerComp extends h2d.Flow implements h2d.domkit.Object {
- static var SRC =
-
-
-
-
-
- ;
-
- public function new(align:h2d.Flow.FlowAlign, ?parent) {
- super(parent);
- initComponent();
- }
-}
-
-// PARAM=-lib domkit
class Main extends hxd.App {
var center:h2d.Flow;
var style = null;
@@ -39,7 +8,7 @@ class Main extends hxd.App {
center = new h2d.Flow(s2d);
center.horizontalAlign = center.verticalAlign = Middle;
onResize();
- var root = new ContainerComp(Right, center);
+ var root = new TitleScreen(Right, center);
root.btnNewGame.onClick = function() {
Game.inst = new Game();
diff --git a/src/screens/TitleScreen.hx b/src/screens/TitleScreen.hx
new file mode 100644
index 0000000..be125ed
--- /dev/null
+++ b/src/screens/TitleScreen.hx
@@ -0,0 +1,33 @@
+package screens;
+
+import components.MenubuttonComponent;
+
+@:uiComp("heading")
+class HeadingComp 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("title-screen")
+class TitleScreen extends h2d.Flow implements h2d.domkit.Object {
+ static var SRC =
+
+
+
+
+
+ ;
+
+ public function new(align:h2d.Flow.FlowAlign, ?parent) {
+ super(parent);
+ initComponent();
+ }
+}