From 395aa3f2b53550b9575dde1f5d2fb7494c21addf Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Thu, 5 Dec 2024 13:17:27 +0100 Subject: close #55 --- src/ui/selectors.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/ui/selectors.c') diff --git a/src/ui/selectors.c b/src/ui/selectors.c index 7d55b98..ab4944d 100644 --- a/src/ui/selectors.c +++ b/src/ui/selectors.c @@ -1,5 +1,5 @@ -employee* employee_selector_render(platform_window* window, float scale, bool enabled, employee* current_val, s32 x, s32 y, s32 w, s32 h, animation an, scheduled_job* offer) { +employee* employee_selector_render(platform_window* window, float scale, bool enabled, employee* current_val, s32 x, s32 y, s32 w, s32 h, animation an, scheduled_job* offer, world_location* loc) { #define ANIMATION_OFFSET (-30*scale) color text_color = AN_LI_TINT(COLOR_TEXT, an); color c_tb_tint = AN_LI_TINT(COLOR_TEXTBOX_TINT, an); @@ -80,18 +80,27 @@ employee* employee_selector_render(platform_window* window, float scale, bool en } s32 status_s = tb_height/2; - s32 status_x = tb_x + tb_width - (status_s/4*3); - s32 status_y = tb_y - (status_s/4); + s32 status_x = tb_x + tb_width; + s32 status_y = tb_y; button_draw_background(scale,status_x,status_y,status_s,status_s,c_white,c_btn); s32 status_icon_s = status_s*0.5f; s32 status_icon_offset = (status_s - status_icon_s)/2; renderer->render_image_tint(result ? img_checkmark : img_questionmark, status_x+status_icon_offset, status_y+status_icon_offset, status_icon_s, status_icon_s, result ? c_correct : c_wrong); + + if (enabled) { + if (button_render(scale, BUTTON_ENABLED, 0, status_x,status_y+tb_height-status_s,status_s,status_s)) { + result = world_get_most_available_employee_for_location(_active_world, loc); + } + + renderer->render_image(img_refresh, status_x+status_icon_offset, status_y+tb_height-status_s+status_icon_offset, + status_icon_s, status_icon_s); + } } // Draw employee data if (result) { - s32 por_x = tb_x + tb_width + tb_pad; + s32 por_x = tb_x + tb_width + tb_pad + 20*scale; draw_employee_portrait(result, por_x, tb_y, tb_height, tb_height); s32 text_x = por_x + tb_height + tb_pad; @@ -128,7 +137,7 @@ employee* employee_selector_render(platform_window* window, float scale, bool en color c = COLOR_TEXT; if (overworked) c = COLOR_TEXT_NEGATIVE; char txt_status[50]; - sprintf(txt_status, "Currently scheduled for %.0fh/week", total_hours); + sprintf(txt_status, "Scheduled for %.0fh/week", total_hours); renderer->render_text(fnt_s,text_x,tb_y,txt_status,c); } -- cgit v1.2.3-70-g09d2