From 106bb7fcadf637cec883648916cc8d19529d6199 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 23 Nov 2024 22:33:03 +0100 Subject: ui improvements --- src/include/world.h | 4 ++-- src/main.c | 2 +- src/scenes/place_detail.c | 26 ++++++++++++++++++++------ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/include/world.h b/src/include/world.h index 4f8af10..11c8ab3 100644 --- a/src/include/world.h +++ b/src/include/world.h @@ -29,8 +29,8 @@ typedef struct t_world_location world_location; typedef struct t_employee employee; -#define WORK_HOUR_START 8 -#define WORK_HOUR_END 20 +#define WORK_HOUR_START 0 +#define WORK_HOUR_END 24 #define TIME_SLOTS_PER_HOUR 4 #define TIME_SLOTS_PER_DAY ((WORK_HOUR_END-WORK_HOUR_START)*TIME_SLOTS_PER_HOUR) #define TIME_SLOTS_PER_WEEK (TIME_SLOTS_PER_DAY*7) diff --git a/src/main.c b/src/main.c index ce94b9c..0a4e2bd 100644 --- a/src/main.c +++ b/src/main.c @@ -139,7 +139,7 @@ int main(int argc, char** argv) volume_music = settings_get_number_or_default("v_music", 100) / 100.0f; volume_sfx = settings_get_number_or_default("v_sfx", 100) / 100.0f; option_vsync = settings_get_number_or_default("vsync", 1); - option_fullscreen = settings_get_number_or_default("fullscreen", 1); + option_fullscreen = settings_get_number_or_default("fullscreen", 0); VALIDATE_VOLUME(volume_global); VALIDATE_VOLUME(volume_music); VALIDATE_VOLUME(volume_sfx); diff --git a/src/scenes/place_detail.c b/src/scenes/place_detail.c index 699fe0e..707ae0f 100644 --- a/src/scenes/place_detail.c +++ b/src/scenes/place_detail.c @@ -1070,6 +1070,7 @@ static void place_detail_draw_schedule(platform_window* window) s32 ty = TILE_Y(scheduled_time.day); bool is_dragging_current_tile = (dragging_tile && _active_schedule_selected_job_index == i); + bool is_selected = _active_schedule_selected_job_index == i; color tile_color = (_active_schedule_selected_job_index == i) ? COLOR_SCHEDULE_TILE_HOVERED : COLOR_SCHEDULE_TILE_SELECTED; // Handle dragging. @@ -1117,6 +1118,15 @@ static void place_detail_draw_schedule(platform_window* window) } } + // Highlight duration if selected. + else if (is_selected) { + draw_duration_of_scheduled_job_entry(scheduled_time, hour_w, tx, ty, timeslot_w, x, y, timeslot_h, tile_color); + } + // Highlight duration if sharing save employee. + else if (scheduled_time.assignee != 0 && scheduled_time.assignee == _active_scheduling_job.timeslots[_active_schedule_selected_job_index].assignee) { + draw_duration_of_scheduled_job_entry(scheduled_time, hour_w, tx, ty, timeslot_w, x, y, timeslot_h, tile_color); + } + // Draw tile. renderer->render_rectangle(tx, ty, timeslot_w, timeslot_h, tile_color); @@ -1153,6 +1163,10 @@ static void place_detail_draw_schedule(platform_window* window) is_inspecting_employee = true; } + if ((_active_schedule_state == SCHEDULING_JOB || _active_schedule_state == RESCHEDULING_JOB) && scheduled_time.assignee == _active_scheduling_job.timeslots[_active_schedule_selected_job_index].assignee) { + is_inspecting_employee = true; + } + color tc = COLOR_SCHEDULE_TILE_FIXED; if (is_inspecting_employee) { tc = COLOR_SCHEDULE_TILE_HIGHLIGHTED; @@ -1255,10 +1269,10 @@ static void place_detail_draw_schedule(platform_window* window) case 7: strcpy(buf, "Sun"); break; } - s32 tw = renderer->calculate_text_width(fnt, buf); + s32 tw = renderer->calculate_text_width(fnt_rd16, buf); s32 textx = x + (hour_w/2)-(tw/2); - s32 texty = row_y + (timeslot_h/2)-(fnt->px_h/2); - renderer->render_text(fnt, textx, texty, buf, COLOR_TEXT); + s32 texty = row_y + (timeslot_h/2)-(fnt_rd16->px_h/2); + renderer->render_text(fnt_rd16, textx, texty, buf, COLOR_TEXT); } } renderer->render_rectangle(x, row_y, w, 1, COLOR_SCHEDULE_BORDER); @@ -1282,10 +1296,10 @@ static void place_detail_draw_schedule(platform_window* window) char buf[20]; sprintf(buf, "%d:00", WORK_HOUR_START+((tx-1)/TIME_SLOTS_PER_HOUR)); - s32 tw = renderer->calculate_text_width(fnt, buf); + s32 tw = renderer->calculate_text_width(fnt_rd16, buf); s32 textx = row_x + (hour_w/2)-(tw/2); - s32 texty = y + (timeslot_h/2)-(fnt->px_h/2); - renderer->render_text(fnt, textx, texty, buf, COLOR_TEXT); + s32 texty = y + (timeslot_h/2)-(fnt_rd16->px_h/2); + renderer->render_text(fnt_rd16, textx, texty, buf, COLOR_TEXT); } } -- cgit v1.2.3-70-g09d2