aboutsummaryrefslogtreecommitdiff
path: root/src/main.odin
diff options
context:
space:
mode:
authorSan Jacobs2023-08-26 12:57:44 +0200
committerSan Jacobs2023-08-26 12:57:44 +0200
commit40687c8c5624dda5bd6b9c6b0e281fb079755040 (patch)
tree3522f6ecee4c86c456df38a566f692af1b2c1a56 /src/main.odin
parent408c473839fcc8bdb0f7ac843031507ae99e33f0 (diff)
downloadsatscalc-40687c8c5624dda5bd6b9c6b0e281fb079755040.tar.gz
satscalc-40687c8c5624dda5bd6b9c6b0e281fb079755040.tar.bz2
satscalc-40687c8c5624dda5bd6b9c6b0e281fb079755040.zip
WIP OUI stuff
Diffstat (limited to 'src/main.odin')
-rw-r--r--src/main.odin120
1 files changed, 20 insertions, 100 deletions
diff --git a/src/main.odin b/src/main.odin
index 1657c0f..25cdf22 100644
--- a/src/main.odin
+++ b/src/main.odin
@@ -137,12 +137,26 @@ when true {
// hotloop
oui.begin_layout()
- a_panel := panel()
- oui.set_layout(a_panel, .Absolute)
- oui.set_size(a_panel, 200, 200)
- oui.set_offset(a_panel, 20, 20)
- a_button := button("Testerino", 50)
+ master_container := panel()
+ oui.set_layout(master_container, .Absolute)
+ oui.set_size(master_container, int(GetScreenWidth()), int(GetScreenHeight()))
+
+ top_bar := panel(BGCOLOR)
+ oui.set_cut(master_container, .Top)
+ oui.set_height(top_bar, 30)
+ oui.item_insert(master_container, top_bar)
+
+ date_label := label("Date", font)
+
+ bottom_bar := panel(PBGCOLOR)
+ oui.set_cut(master_container, .Bottom)
+ oui.set_height(bottom_bar, 50)
+ oui.item_insert(master_container, bottom_bar)
+
+
+
+/* a_button := button("Testerino", 50)
if oui.latest_clicked() {
fmt.println("CLICKO BOIO")
}
@@ -150,7 +164,7 @@ when true {
oui.set_height(a_button, 50)
oui.set_offset(a_button, 20, 20)
- oui.item_insert(a_panel, a_button)
+ oui.item_insert(a_panel, a_button)*/
oui.end_layout()
@@ -217,97 +231,3 @@ when true {
}
}
-BGCOLOR : rl.Color : {30, 30, 30, 255}
-PBGCOLOR : rl.Color : {40, 40, 40, 255}
-
-DAY_HEIGHT :: 35
-TIMELINE_START :: 175
-TIMELINE_END :: -85
-
-Item :: oui.Item
-Call :: oui.Call
-
-Data_Element :: enum int {
- Panel,
- Button,
- Text_Input,
- Timeblock,
-// ...
-}
-
-Data_Head :: struct {
- subtype: Data_Element,
-}
-
-Data_Panel :: struct {
- using _: Data_Head,
-}
-
-Data_Button :: struct {
- using _: Data_Head,
- text: string,
- selected: bool,
-}
-
-button_callback :: proc(item: Item, event: Call) -> int {
- data := cast(^Data_Button) oui.get_handle(item)
-
- #partial switch event {
- case .Cursor_Handle:
- //return int(Cursor_Type.Hand)
- }
-
- return -1
-}
-
-panel :: proc() -> Item {
- item := oui.item_make()
-
- data := oui.alloc_typed(item, Data_Panel)
- data.subtype = .Panel
-
- return item
-}
-
-button :: proc(text: string, width: int, selected := false) -> Item {
- item := oui.item_make()
- oui.set_size(item, width, 35)
- oui.set_callback(item, button_callback)
-
- data := oui.alloc_typed(item, Data_Button)
- data.subtype = .Button
- data.text = text
- data.selected = selected
-
- return item
-}
-
-// recursive loop
-ui_draw_children :: proc(item: oui.Item) {
- list := oui.children_sorted(item)
- for kid in list {
- ui_draw(kid)
- }
-}
-
-ui_draw :: proc(item: oui.Item) {
- head := cast(^Data_Head) oui.get_handle(item)
- rect := oui.get_rect(item)
-
- //fmt.println(rect, head, item)
-
- if head == nil {
- ui_draw_children(item)
- return
- }
-
- #partial switch head.subtype {
- //case .Panel_Root:
- // ... render any type of item
- case .Button:
- rl.DrawRectangle(i32(rect.l), i32(rect.t), i32(rect.r-rect.l), i32(rect.b-rect.t), PBGCOLOR)
- case .Panel:
- rl.DrawRectangle(i32(rect.l), i32(rect.t), i32(rect.r-rect.l), i32(rect.b-rect.t), rl.RED)
- ui_draw_children(item)
- }
-} \ No newline at end of file