aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.odin35
-rw-r--r--src/ui_implementation.odin22
2 files changed, 34 insertions, 23 deletions
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);
diff --git a/src/ui_implementation.odin b/src/ui_implementation.odin
index 6b0947d..e4b4f80 100644
--- a/src/ui_implementation.odin
+++ b/src/ui_implementation.odin
@@ -13,18 +13,12 @@ Theme :: struct {
base: rl.Color,
slider_bar: rl.Color,
text: rl.Color,
+ price_100: rl.Color,
+ price_150: rl.Color,
+ price_200: rl.Color,
+ price_300: rl.Color,
}
-/*theme : Theme = {
- background = {20, 25, 25, 255},
- background_top = {30, 35, 35, 255},
- background_bottom = {40, 40, 40, 255},
- button = {80, 80, 80, 255},
- base = {60, 60, 60, 255},
- slider_bar = {170, 170, 170, 255},
- text = rl.RAYWHITE,
-}*/
-
theme : Theme = {
background = {25 , 27 , 29 , 255,},
background_bar = {43 , 43 , 48 , 255,},
@@ -32,6 +26,10 @@ theme : Theme = {
base = {60 , 60 , 60 , 255,},
slider_bar = {91 , 91 , 204, 255,},
text = {255, 255, 255, 252,},
+ price_100 = {30 , 240, 30 , 255,},
+ price_150 = {240, 200, 30 , 255,},
+ price_200 = {240, 30 , 30 , 255,},
+ price_300 = {240, 30 , 240, 255,},
}
DAY_HEIGHT :: 35
@@ -171,9 +169,9 @@ Text_Alignment :: enum int {
Right,
Center,
}
-label :: proc(text: string, font: rl.Font, alignment: Text_Alignment = .Left) -> ^Item {
+label :: proc(text: string, font: rl.Font, width: int = 150, alignment: Text_Alignment = .Left) -> ^Item {
item := oui.item_make(c0)
- item.layout_size = {150, 25}
+ item.layout_size = {width, 25}
data := oui.alloc_typed(c0, item, Data_Label)
data.subtype = .Label