refactor and widgeting magic
This commit is contained in:
parent
b6b097a872
commit
f13c682171
|
@ -5,7 +5,7 @@ render := @use("../../../libraries/render/src/lib.hb")
|
||||||
|
|
||||||
input := @use("../../intouch/src/lib.hb")
|
input := @use("../../intouch/src/lib.hb")
|
||||||
|
|
||||||
widgets := @use("widgets.hb")
|
widgets := @use("widgets/widgets.hb")
|
||||||
ui := @use("ui.hb")
|
ui := @use("ui.hb")
|
||||||
|
|
||||||
WindowID := struct {
|
WindowID := struct {
|
||||||
|
|
|
@ -1,25 +1,13 @@
|
||||||
// Widget types
|
stn := @use("../../../../libraries/stn/src/lib.hb");
|
||||||
|
|
||||||
// End types
|
|
||||||
stn := @use("../../../libraries/stn/src/lib.hb");
|
|
||||||
.{string, log} := stn;
|
.{string, log} := stn;
|
||||||
.{Vec2} := stn.math
|
.{Vec2} := stn.math
|
||||||
|
|
||||||
render := @use("../../../libraries/render/src/lib.hb");
|
render := @use("../../../../libraries/render/src/lib.hb");
|
||||||
.{Surface} := render;
|
.{Surface} := render;
|
||||||
.{Font} := render.text
|
.{Font} := render.text
|
||||||
|
|
||||||
LayoutChildHorizontalFirst := 0
|
|
||||||
LayoutChildVerticalFirst := 1
|
|
||||||
|
|
||||||
Size := struct {
|
|
||||||
min_width: int,
|
|
||||||
max_width: int,
|
|
||||||
min_height: int,
|
|
||||||
max_height: int,
|
|
||||||
}
|
|
||||||
|
|
||||||
Label := struct {
|
Label := struct {
|
||||||
|
magic: uint,
|
||||||
is_dirty: bool,
|
is_dirty: bool,
|
||||||
surface: Surface,
|
surface: Surface,
|
||||||
text: ^u8,
|
text: ^u8,
|
||||||
|
@ -45,13 +33,7 @@ render_label_to_surface := fn(surface: Surface, label: Label, font: Font, pos: V
|
||||||
new_label := fn(text: ^u8): Label {
|
new_label := fn(text: ^u8): Label {
|
||||||
text_surface := render.new_surface(1000, 20)
|
text_surface := render.new_surface(1000, 20)
|
||||||
text_length := string.length(text)
|
text_length := string.length(text)
|
||||||
label := Label.(true, text_surface, text, text_length)
|
widget_type := 3
|
||||||
|
label := Label.(widget_type, true, text_surface, text, text_length)
|
||||||
return label
|
return label
|
||||||
}
|
}
|
||||||
|
|
||||||
VerticalLayout := 0
|
|
||||||
HorizontalLayout := 1
|
|
||||||
|
|
||||||
Container := struct {
|
|
||||||
layout: uint,
|
|
||||||
}
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
VerticalWidgetType := 1
|
||||||
|
HorizontalWidgetType := 2
|
||||||
|
|
||||||
|
LabelWidgetType := 3
|
28
sysdata/libraries/horizon_api/src/widgets/widgets.hb
Normal file
28
sysdata/libraries/horizon_api/src/widgets/widgets.hb
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// Widget types
|
||||||
|
|
||||||
|
// End types
|
||||||
|
stn := @use("../../../../libraries/stn/src/lib.hb");
|
||||||
|
.{string, log} := stn;
|
||||||
|
.{Vec2} := stn.math
|
||||||
|
|
||||||
|
render := @use("../../../../libraries/render/src/lib.hb");
|
||||||
|
.{Surface} := render;
|
||||||
|
.{Font} := render.text
|
||||||
|
|
||||||
|
widget_types := @use("widget_types.hb")
|
||||||
|
label := @use("label.hb")
|
||||||
|
// .{Label, render_label_to_surface, set_label_text} := label
|
||||||
|
|
||||||
|
Size := struct {
|
||||||
|
min_width: int,
|
||||||
|
max_width: int,
|
||||||
|
min_height: int,
|
||||||
|
max_height: int,
|
||||||
|
}
|
||||||
|
|
||||||
|
Vertical := packed struct {
|
||||||
|
magic: uint,
|
||||||
|
// array of children, idk
|
||||||
|
// use a vec or linked list or whatever
|
||||||
|
children: ^^u8,
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ stn := @use("../../../libraries/stn/src/lib.hb");
|
||||||
.{Vec2} := stn.math
|
.{Vec2} := stn.math
|
||||||
|
|
||||||
horizon_api := @use("../../../libraries/horizon_api/src/lib.hb");
|
horizon_api := @use("../../../libraries/horizon_api/src/lib.hb");
|
||||||
.{new_label, render_label_to_surface, set_label_text} := horizon_api.widgets;
|
.{new_label, render_label_to_surface, set_label_text} := horizon_api.widgets.label;
|
||||||
.{sexpr_parser, render_ui} := horizon_api.ui
|
.{sexpr_parser, render_ui} := horizon_api.ui
|
||||||
|
|
||||||
render := @use("../../../libraries/render/src/lib.hb");
|
render := @use("../../../libraries/render/src/lib.hb");
|
||||||
|
|
Loading…
Reference in a new issue