From a437a92bb39894beb91d6c4308d04852bc0d5eac Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Sat, 14 Oct 2023 17:05:01 +0200 Subject: Advancements on theme and layout --- src/main.odin | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'src/main.odin') diff --git a/src/main.odin b/src/main.odin index bed835a..e0a4507 100644 --- a/src/main.odin +++ b/src/main.odin @@ -159,23 +159,36 @@ when true { { top_bar := panel_line(master_container, theme.background_bar, 30) - top_bar.id = oui.push_id(c0, "small_boie") // Make ID for anything that will have children. + top_bar.id = oui.push_id(c0, "top_bar") // Make ID for anything that will have children. defer oui.pop_id(c0) // These need to be pop'ed before the next item at the same level in the hierachy. top_bar.layout_margin = 6 - oui.item_insert(top_bar, label("Date", font, .Left)) - oui.item_insert(top_bar, label("Calltime", font, .Left)) - oui.item_insert(top_bar, label("Lunch", font, .Left)) + oui.item_insert(top_bar, label("Date", font, 100, .Center)) + oui.item_insert(top_bar, label("Calltime", font, 100, .Center)) + oui.item_insert(top_bar, label("Lunch", font, 100, .Center)) } { bottom_bar := panel(theme.background_bar) - bottom_bar.id = oui.push_id(c0, "not_small_boie") + bottom_bar.id = oui.push_id(c0, "bottom_bar") defer oui.pop_id(c0) bottom_bar.layout_cut_children = .Left master_container.layout_cut_children = .Bottom bottom_bar.layout_size.y = 50 + bottom_bar.layout_margin = 10 // Spacing from edges oui.item_insert(master_container, bottom_bar) + + pre_sos_price := label("120 000 kr", big_font, 0, .Right) + bottom_bar.layout_cut_children = .Right + oui.item_insert(bottom_bar, pre_sos_price) + + post_sos_price := label("160 000 kr", small_font, 300, .Right) + bottom_bar.layout_cut_children = .Right + oui.item_insert(bottom_bar, post_sos_price) + + price_reason := label("Reason for price of highlighted timeblock", font, 300,) + bottom_bar.layout_cut_children = .Left + oui.item_insert(bottom_bar, price_reason) } { @@ -234,17 +247,17 @@ when true { // (At least, given how lunch breaks are currently implemented, // as holes in the workday) - DrawRectangle(10, DAY_HEIGHT*i32(i+1)-4, width-20, DAY_HEIGHT-1, theme.background_top) + DrawRectangle(10, DAY_HEIGHT*i32(i+1)-4, width-20, DAY_HEIGHT-1, theme.background_bar) for block, j in day.blocks { if j == day.total_timeblocks do break - block_color: = GREEN + block_color: = theme.price_100 switch { case block.value > 2.1: - block_color = PURPLE + block_color = theme.price_300 case block.value > 1.6: - block_color = RED + block_color = theme.price_200 case block.value > 1.1: - block_color = ORANGE + block_color = theme.price_150 } DrawRectangle(TIMELINE_START+i32(math.round(day.fractions[j].start*f32(width+TIMELINE_END-TIMELINE_START))), @@ -268,7 +281,7 @@ when true { } } - DrawRectangle(0, height-50, width+10, 60, theme.background_top) + DrawRectangle(0, height-50, width+10, 60, theme.background_bar) DrawTextEx(small_font, total_sum, {f32(width)-120, f32(height)-43}, small_font_size, 0, RAYWHITE); DrawTextEx(big_font, inc_soc, {f32(width)-120, f32(height)-29}, big_font_size, 0, RAYWHITE); -- cgit v1.2.1