From 0c4cc3f052608b2410bf71787b14c2149e14c72b Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Mon, 5 Feb 2024 15:36:44 +0100 Subject: Adding custom layout stuff to OUI for the timeline display --- src/main.odin | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'src/main.odin') diff --git a/src/main.odin b/src/main.odin index 1f2d46f..e0232c7 100644 --- a/src/main.odin +++ b/src/main.odin @@ -158,6 +158,13 @@ main :: proc() { fmt.println("Resized to:", width, 'x', height) } + pre_sos_price : f64 = 0 + + for each_day in workdays { + pre_sos_price += f64(each_day.price) + } + + post_sos_price : f64 = pre_sos_price * 1.26 // TODO: Find a good way to calculate the size and location // of all the timeblocks in every day. @@ -235,13 +242,13 @@ when true { bottom_bar.layout_cut_children = .Right oui.item_insert(bottom_bar, totals) - pre_sos_price := label("120 000 kr", small_font, 0, .Right) - pre_sos_price.layout_size.y = 11 - oui.item_insert(totals, pre_sos_price) + pre_sos_price_label := label(fmt.tprintf("%.2f Kr", pre_sos_price), small_font, 0, .Right) + pre_sos_price_label.layout_size.y = 11 + oui.item_insert(totals, pre_sos_price_label) - post_sos_price := label("160 000 kr", big_font, 300, .Right) - post_sos_price.layout_size.y = 27 - oui.item_insert(totals, post_sos_price) + post_sos_price_label := label(fmt.tprintf("%.2f Kr", post_sos_price), big_font, 300, .Right) + post_sos_price_label.layout_size.y = 27 + oui.item_insert(totals, post_sos_price_label) } { @@ -267,11 +274,19 @@ when true { oui.item_insert(line, label(clockprint(day.call), font, sizings.call, .Center)) line.layout_cut_children = .Right - oui.item_insert(line, label(fmt.tprintf("%.2f kr", day.price), font, sizings.price, .Center)) + oui.item_insert(line, label(fmt.tprintf("%.2f Kr", day.price), font, sizings.price, .Center)) oui.item_insert(line, label(clockprint(day.wrap), font, sizings.wrap, .Center)) line.layout_cut_children = .Fill - timeline(line, &day) + { + a_timeline := timeline(line, &day) + + /*x_offset := i32(int(f32(width)*fracts.start) - int(f32(width)*FRACT_MIN)) + i32(rect.t), + i32(f32(width) * (fracts.end - fracts.start)+0.99), + i32(rect.b - rect.t), + color)*/ + } } new_workday := button("+", 100) middle_section.layout_cut_children = .Top -- cgit v1.2.1