From 6f7374c2fa58c8692b51018864b802e6b876d305 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 23 Nov 2024 21:52:24 +0100 Subject: A new start --- src/include/ui/animation.h | 24 ++++++++++++++++++ src/include/ui/button.h | 20 +++++++++++++++ src/include/ui/colors.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++ src/include/ui/panel.h | 15 +++++++++++ src/include/ui/portrait.h | 28 +++++++++++++++++++++ src/include/ui/selectors.h | 13 ++++++++++ 6 files changed, 162 insertions(+) create mode 100644 src/include/ui/animation.h create mode 100644 src/include/ui/button.h create mode 100644 src/include/ui/colors.h create mode 100644 src/include/ui/panel.h create mode 100644 src/include/ui/portrait.h create mode 100644 src/include/ui/selectors.h (limited to 'src/include/ui') diff --git a/src/include/ui/animation.h b/src/include/ui/animation.h new file mode 100644 index 0000000..1a10c0f --- /dev/null +++ b/src/include/ui/animation.h @@ -0,0 +1,24 @@ +/* +* BSD 2-Clause “Simplified” License +* Copyright (c) 2019, Aldrik Ramaekers, aldrik.ramaekers@protonmail.com +* All rights reserved. +*/ + +#ifndef INCLUDE_ANIMATION +#define INCLUDE_ANIMATION + +typedef struct t_animation +{ + float time; + bool started; + float duration; + float percentage; +} animation; + +#define AN_LI(_cx,_dx,_an) (_cx + (_dx-_cx)*_an.percentage) +#define AN_LI_TINT(_color, _an) rgba((_color).r,(_color).g,(_color).b,255*_an.percentage) + +animation animation_create(s32 duration); +float animation_update(animation* an); + +#endif \ No newline at end of file diff --git a/src/include/ui/button.h b/src/include/ui/button.h new file mode 100644 index 0000000..e381631 --- /dev/null +++ b/src/include/ui/button.h @@ -0,0 +1,20 @@ +/* +* BSD 2-Clause “Simplified” License +* Copyright (c) 2019, Aldrik Ramaekers, aldrik.ramaekers@protonmail.com +* All rights reserved. +*/ + +#ifndef INCLUDE_BUTTON +#define INCLUDE_BUTTON + +typedef enum t_button_type +{ + BUTTON_STATIC = 0, + BUTTON_ENABLED = 1, + BUTTON_DISABLED = 2, + BUTTON_HIGHLIGHTED = 3, +} button_type; + +bool button_render(float scale, button_type enabled, char* text, s32 x, s32 y, s32 w, s32 h); + +#endif \ No newline at end of file diff --git a/src/include/ui/colors.h b/src/include/ui/colors.h new file mode 100644 index 0000000..f8a7f91 --- /dev/null +++ b/src/include/ui/colors.h @@ -0,0 +1,62 @@ +/* +* BSD 2-Clause “Simplified” License +* Copyright (c) 2019, Aldrik Ramaekers, aldrik.ramaekers@protonmail.com +* All rights reserved. +*/ + +#ifndef INCLUDE_COLORS +#define INCLUDE_COLORS + +#define COLOR_WORLD_MAP_BACKGROUND rgb(32,52,63) +#define COLOR_WHITE rgb(255,255,255) +#define COLOR_BLACK rgb(0,0,0) +#define COLOR_INSPECT_ACTIVE_JOB_LINE_CONNECTION rgb(40,40,40) +#define COLOR_DOT_HOVERED rgb(100,220,100) + +#define COLOR_TEXT_NEGATIVE rgb(226,86,86) +#define COLOR_TITLE rgb(8, 10, 12) +#define COLOR_TEXT_SHADOW rgb(24,24,24) +#define COLOR_TEXT rgb(207,207,207) + +#define COLOR_BUTTON_DISABLED_TINT rgb(70,70,70) + +#define COLOR_BUTTON_HIGHLIGHTED_TINT rgb(240,160,160) +#define COLOR_BUTTON_ACTIVE_TINT rgb(210,210,210) +#define COLOR_PANEL_BACKGROUND rgb(66,63,58) + +#define COLOR_BUTTON rgb(98, 95, 90) +#define COLOR_BUTTON_ACTIVE rgb(81, 78, 74) +#define COLOR_BUTTON_HIGHLIGHTED_ACTIVE rgb(92, 60, 56) +#define COLOR_BUTTON_DISABLED rgb(27, 26, 25) + +#define COLOR_LOCATION_DOT_UNOWNED rgb(220,220,220) +#define COLOR_LOCATION_DOT_OWNED rgb(220,100,100) + +#define COLOR_LIST_ENTRY_BACKGROUND rgb(46,43,40) +#define COLOR_LIST_ENTRY_BACKGROUND_ACTIVE rgb(63,59,56) + +#define COLOR_SCHEDULE_ROW_ACTIVE rgb(118,115,100) +#define COLOR_SCHEDULE_TILE_FIXED rgb(178,239,155) +#define COLOR_SCHEDULE_TILE_HOVERED rgb(26,200,237) +#define COLOR_SCHEDULE_TILE_INVALID rgb(244,70,73) +#define COLOR_SCHEDULE_TILE_INVALID_SELECTED rgb(252,159,160) +#define COLOR_SCHEDULE_TILE_SELECTED rgb(174,212,230) +#define COLOR_SCHEDULE_TILE_HIGHLIGHTED rgb(237,177,26) + +#define COLOR_SELECTOR_UNDERLINE rgb(180,180,180) + +#define LEGENDA_HOVER_BACKGROUND_COLOR rgba(255,0,0,50) +#define LEGENDA_COLOR_DISABLED rgb(120,120,120) +#define LEGENDA_SUB_COLOR_DISABLED rgba(120,120,120,100) + +#define COLOR_SCHEDULE_BG rgb(142,138,132) +#define COLOR_SCHEDULE_BORDER rgb(75,73,69) +#define COLOR_SCHEDULE_BORDER_THIN rgb(88,85,80) + +#define COLOR_TEXTBOX_TINT rgb(100,100,100) +#define COLOR_TEXTBOX_FILL rgb(38, 37, 35) + +#define COLOR_WRONG rgb(168,45,45) +#define COLOR_CORRECT rgb(47,168,45) + +#endif \ No newline at end of file diff --git a/src/include/ui/panel.h b/src/include/ui/panel.h new file mode 100644 index 0000000..83103d2 --- /dev/null +++ b/src/include/ui/panel.h @@ -0,0 +1,15 @@ +/* +* BSD 2-Clause “Simplified” License +* Copyright (c) 2019, Aldrik Ramaekers, aldrik.ramaekers@protonmail.com +* All rights reserved. +*/ + +#ifndef INCLUDE_PANEL +#define INCLUDE_PANEL + +// 1280 is our reference width. +#define UI_SCALE(_w) (_w/1280.0f) + +void panel_render(float scale, s32 x, s32 y, s32 w, s32 h); + +#endif \ No newline at end of file diff --git a/src/include/ui/portrait.h b/src/include/ui/portrait.h new file mode 100644 index 0000000..8bff8e1 --- /dev/null +++ b/src/include/ui/portrait.h @@ -0,0 +1,28 @@ +/* +* BSD 2-Clause “Simplified” License +* Copyright (c) 2019, Aldrik Ramaekers, aldrik.ramaekers@protonmail.com +* All rights reserved. +*/ + +#ifndef INCLUDE_PORTRAIT +#define INCLUDE_PORTRAIT + +color hair_palette[] = { + rgb(199, 186, 168), rgb(188, 181, 160), rgb(191, 173, 148), rgb(203, 181, 138), rgb(187, 162, 120), + rgb(174, 153, 122), rgb(172, 134, 109), rgb(205, 169, 129), rgb(168, 115, 88), rgb(137, 82, 71), + rgb(158, 131, 99), rgb(150, 116, 93), rgb(128, 93, 73), rgb(202, 162, 136), rgb(197, 146, 137), + rgb(194, 136, 129), rgb(165, 127, 117), rgb(152, 111, 113), rgb(123, 103, 93), rgb(98, 79, 73) +}; + +color skin_palette[] = { + rgb(233, 203, 167), rgb(238, 208, 183), rgb(247, 221, 196), rgb(247, 226, 171), rgb(239, 199, 148), rgb(239, 192, 136), + rgb(231, 188, 145), rgb(236, 192, 131), rgb(208, 158, 125), rgb(203, 150, 98), rgb(171, 139, 100), rgb(148, 98, 61), +}; + +color body_palette[] = { + rgb(33, 28, 32), rgb(76, 74, 77), rgb(109, 103, 107), rgb(171, 133, 86), rgb(213, 175, 126), rgb(240, 229, 225), +}; + +void draw_employee_portrait(employee* emp, float x, float y, float w, float h); + +#endif \ No newline at end of file diff --git a/src/include/ui/selectors.h b/src/include/ui/selectors.h new file mode 100644 index 0000000..6832ff7 --- /dev/null +++ b/src/include/ui/selectors.h @@ -0,0 +1,13 @@ +/* +* BSD 2-Clause “Simplified” License +* Copyright (c) 2019, Aldrik Ramaekers, aldrik.ramaekers@protonmail.com +* All rights reserved. +*/ + +#ifndef INCLUDE_EMPLOYEE_SELECTOR +#define INCLUDE_EMPLOYEE_SELECTOR + +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* location_selector_render(platform_window* window, float scale, bool enabled, world_location* current_val, s32 x, s32 y, s32 w, s32 h); + +#endif \ No newline at end of file -- cgit v1.2.3-70-g09d2