Modified color picked to prepare for HSV selection

main
noah metz 2024-11-11 14:49:21 -07:00
parent 3ab7ed46dc
commit 8278692494
1 changed files with 33 additions and 22 deletions

@ -22,6 +22,11 @@ typedef struct EditorContextStruct {
uint32_t last_clicked_region; uint32_t last_clicked_region;
uint32_t last_clicked_hex; uint32_t last_clicked_hex;
uint32_t last_clicked_vertex; uint32_t last_clicked_vertex;
vec4 saved_colors[12];
vec4 current_color;
vec4 color_string;
bool selecting_color;
} EditorContext; } EditorContext;
typedef struct ClientContextStruct { typedef struct ClientContextStruct {
@ -99,9 +104,9 @@ uint32_t add_hex_region(ClientContext* context) {
VkResult color_ui(ClientContext* context) { VkResult color_ui(ClientContext* context) {
GPUString strings[] = { GPUString strings[] = {
{ {
.pos = {-2, 168}, .pos = {2, 150},
.color = {1, 1, 1, 1}, .color = {1, 1, 1, 1},
.size = 32, .size = 16,
.offset = 0, .offset = 0,
.length = 9, .length = 9,
.font = 0, .font = 0,
@ -111,7 +116,7 @@ VkResult color_ui(ClientContext* context) {
GPUDrawable drawables[] = { GPUDrawable drawables[] = {
{ {
.pos = {0, 0}, .pos = {0, 0},
.size = {178, 168}, .size = {190, 150},
.color = {0.4, 0.4, 0.4, 0.4}, .color = {0.4, 0.4, 0.4, 0.4},
}, },
{ {
@ -121,88 +126,94 @@ VkResult color_ui(ClientContext* context) {
.id = 0x01, .id = 0x01,
}, },
{ {
.pos = {36, 136}, .pos = {134, 2},
.size = {140, 30}, .size = {10, 130},
.color = {0, 0, 1, 0.4}, .color = {1, 1, 1, 1},
.id = 0x02, .id = 0x02,
}, },
{ {
.pos = {134, 2}, .pos = {20, 134},
.size = {20, 20}, .size = {95, 15},
.color = {1, 1, 1, 1}, .color = {0, 0, 1, 0},
.id = 0x03, .id = 0x03,
}, },
{ {
.pos = {156, 2}, .pos = {146, 2},
.size = {20, 20}, .size = {20, 20},
.color = {1, 1, 1, 1}, .color = {1, 1, 1, 1},
.id = 0x04, .id = 0x04,
}, },
{ {
.pos = {134, 24}, .pos = {168, 2},
.size = {20, 20}, .size = {20, 20},
.color = {1, 1, 1, 1}, .color = {1, 1, 1, 1},
.id = 0x05, .id = 0x05,
}, },
{ {
.pos = {156, 24}, .pos = {146, 24},
.size = {20, 20}, .size = {20, 20},
.color = {1, 1, 1, 1}, .color = {1, 1, 1, 1},
.id = 0x06, .id = 0x06,
}, },
{ {
.pos = {134, 46}, .pos = {168, 24},
.size = {20, 20}, .size = {20, 20},
.color = {1, 1, 1, 1}, .color = {1, 1, 1, 1},
.id = 0x07, .id = 0x07,
}, },
{ {
.pos = {156, 46}, .pos = {146, 46},
.size = {20, 20}, .size = {20, 20},
.color = {1, 1, 1, 1}, .color = {1, 1, 1, 1},
.id = 0x08, .id = 0x08,
}, },
{ {
.pos = {134, 68}, .pos = {168, 46},
.size = {20, 20}, .size = {20, 20},
.color = {1, 1, 1, 1}, .color = {1, 1, 1, 1},
.id = 0x09, .id = 0x09,
}, },
{ {
.pos = {156, 68}, .pos = {146, 68},
.size = {20, 20}, .size = {20, 20},
.color = {1, 1, 1, 1}, .color = {1, 1, 1, 1},
.id = 0x0A, .id = 0x0A,
}, },
{ {
.pos = {134, 90}, .pos = {168, 68},
.size = {20, 20}, .size = {20, 20},
.color = {1, 1, 1, 1}, .color = {1, 1, 1, 1},
.id = 0x0B, .id = 0x0B,
}, },
{ {
.pos = {156, 90}, .pos = {146, 90},
.size = {20, 20}, .size = {20, 20},
.color = {1, 1, 1, 1}, .color = {1, 1, 1, 1},
.id = 0x0C, .id = 0x0C,
}, },
{ {
.pos = {134, 112}, .pos = {168, 90},
.size = {20, 20}, .size = {20, 20},
.color = {1, 1, 1, 1}, .color = {1, 1, 1, 1},
.id = 0x0D, .id = 0x0D,
}, },
{ {
.pos = {156, 112}, .pos = {146, 112},
.size = {20, 20}, .size = {20, 20},
.color = {1, 1, 1, 1}, .color = {1, 1, 1, 1},
.id = 0x0E, .id = 0x0E,
}, },
{
.pos = {168, 112},
.size = {20, 20},
.color = {1, 1, 1, 1},
.id = 0x0F,
},
}; };
uint32_t codes[9]; uint32_t codes[9];
VkResult result; VkResult result;
VK_RESULT(map_string("#FFFFFFFF", codes, 0, 0, context->ui)); VK_RESULT(map_string("#00000000", codes, 0, 0, context->ui));
LayerInput layer = { LayerInput layer = {
.strings = strings, .strings = strings,
@ -219,7 +230,7 @@ VkResult color_ui(ClientContext* context) {
.anchor = ANCHOR_BOTTOM_LEFT, .anchor = ANCHOR_BOTTOM_LEFT,
.id = 0x03, .id = 0x03,
.offset = {0, 0}, .offset = {0, 0},
.size = {178, 168}, .size = {190, 150},
}; };
return create_container(&container, context->render, context->ui); return create_container(&container, context->render, context->ui);