From d4ea66aa3b6fd9ffedbf42ab21a4eb34bc91ccbe Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Wed, 11 Sep 2024 18:45:51 +0200 Subject: Updated odin again, odin version dev-2024-09:9b06ea5bf should work now --- src/main.odin | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src/main.odin') diff --git a/src/main.odin b/src/main.odin index 21d081d..f0e174a 100644 --- a/src/main.odin +++ b/src/main.odin @@ -122,7 +122,7 @@ main :: proc() { // Setting up the timelines - for day, f in &workdays { + for &day, f in &workdays { beginning: Moment = {0, 0, day.call.day, day.call.month, day.call.year} fmt.println("\nNew day!") @@ -280,9 +280,24 @@ when true { line.layout_cut_children = .Fill { a_timeline := timeline(line, &day) + + x_offset := int(f32(width) * day.fractions[0].start) + for &block, i in day.blocks { + // TODO: Why isn't this rendering?? + block_ui := timeline_block(&block) + block_width := int(f32(width) * (day.fractions[i].end - day.fractions[i].start)) + block_ui.layout_size.x = block_width + block_ui.layout_offset.x = x_offset + oui.item_insert(a_timeline, block_ui) + x_offset += block_width + //fmt.printf("%#v\n", block_ui) + } - /*x_offset := i32(int(f32(width)*fracts.start) - int(f32(width)*FRACT_MIN)) - i32(rect.t), + oui.item_insert(line, a_timeline) + + //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)*/ @@ -303,7 +318,7 @@ when true { info := runtime.type_info_base(type_info_of(Sizings)) st := info.variant.(runtime.Type_Info_Struct) root := uintptr(&sizings) - for offset, i in st.offsets { + for offset, i in st.offsets[:st.field_count] { line := panel_line(middle_section, theme.background, 25) line.id = oui.push_id(c0, fmt.tprintf("sizings_line_%d", i)) @@ -333,7 +348,7 @@ when true { info := runtime.type_info_base(type_info_of(Theme)) st := info.variant.(runtime.Type_Info_Struct) root := uintptr(&theme) - for offset, i in st.offsets { + for offset, i in st.offsets[:st.field_count] { line := panel_line(middle_section, theme.background, 25) line.layout_cut_gap = 10 -- cgit v1.2.1