From 0be4578a297c25de81c44ebb9a93663bc843297b Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Tue, 26 Nov 2024 16:20:53 +0100 Subject: close #17 --- src/scenes/place_detail.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/scenes') diff --git a/src/scenes/place_detail.c b/src/scenes/place_detail.c index b174b5b..5f15474 100644 --- a/src/scenes/place_detail.c +++ b/src/scenes/place_detail.c @@ -336,7 +336,7 @@ static void place_detail_draw_trucks(platform_window* window, tab tab, float x, static void place_detail_draw_employees(platform_window* window, tab tab, float x, float y, float w, float h) { - HANDLE_TAB_START(_active_location->employees.length+2, 4); + HANDLE_TAB_START(_active_location->employees.length+2, 5); HANDLE_TAB_SCROLL; char info_buf[50]; @@ -391,12 +391,25 @@ static void place_detail_draw_employees(platform_window* window, tab tab, float renderer->render_rectangle(x + item_h + item_part_w, item_y+(5*tab.scale), 1, item_h-(10*tab.scale), COLOR_BUTTON); } - // Name + // Hours + { + char buffer[50]; + float total_hours = get_worked_hours_per_week_for_employee(_active_world, emp, 0); + + sprintf(buffer, "Scheduled: %.0f hours", total_hours); + s32 text_x = x + item_h + item_part_w*1 + text_pad; + s32 text_y = item_y + (item_h/2) - (fnt->px_h/2); + renderer->render_text(fnt, text_x+1, text_y+1, buffer, COLOR_TEXT_SHADOW); + renderer->render_text(fnt, text_x, text_y, buffer, COLOR_TEXT); + renderer->render_rectangle(x + item_h + item_part_w*2, item_y+(5*tab.scale), 1, item_h-(10*tab.scale), COLOR_BUTTON); + } + + // Truck { char buffer[MAX_EMPLOYEE_NAME_LENGTH + 20]; if (emp->assigned_truck) sprintf(buffer, "Truck: %s, #%d", emp->assigned_truck->name, emp->assigned_truck->id); else strcpy(buffer, "No assigned truck"); - s32 text_x = x + item_h + item_part_w*1 + text_pad; + s32 text_x = x + item_h + item_part_w*2 + text_pad; s32 text_y = item_y + (item_h/2) - (fnt->px_h/2); renderer->render_text(fnt, text_x+1, text_y+1, buffer, COLOR_TEXT_SHADOW); renderer->render_text(fnt, text_x, text_y, buffer, COLOR_TEXT); @@ -418,7 +431,7 @@ static void place_detail_draw_employees(platform_window* window, tab tab, float sprintf(buffer, "%s", "Idling"); } - s32 text_x = x + item_h + item_part_w*2 + text_pad; + s32 text_x = x + item_h + item_part_w*3 + text_pad; s32 text_y = item_y + (item_h/2) - (fnt->px_h/2); renderer->render_text(fnt, text_x+1, text_y+1, buffer, COLOR_TEXT_SHADOW); renderer->render_text(fnt, text_x, text_y, buffer, COLOR_TEXT); @@ -427,7 +440,7 @@ static void place_detail_draw_employees(platform_window* window, tab tab, float // Happiness { - s32 text_x = x + item_h + item_part_w*3 + text_pad; + s32 text_x = x + item_h + item_part_w*4 + text_pad; s32 text_y = item_y + (item_h/2) - (fnt->px_h/2); s32 stars = employee_calculate_happiness_stars(emp); @@ -439,7 +452,7 @@ static void place_detail_draw_employees(platform_window* window, tab tab, float else renderer->render_image_tint(img_star, text_x + textw + (i*(fnt->px_h+2)), text_y, fnt->px_h, fnt->px_h, rgba(255,255,255,30)); } - //renderer->render_rectangle(x + item_h + item_part_w*4, item_y+(5*tab.scale), 1, item_h-+(10*tab.scale), COLOR_BUTTON); + renderer->render_rectangle(x + item_h + item_part_w*4, item_y+(5*tab.scale), 1, item_h-+(10*tab.scale), COLOR_BUTTON); } } -- cgit v1.2.3-70-g09d2