| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -127,17 +127,17 @@ uint32_t add_hex_region(ClientContext* context) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return i;
 | 
					 | 
					 | 
					 | 
					  return i;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void update_hex_string(UIContext* ui, RenderContext* gpu, EditorData* data) {
 | 
					 | 
					 | 
					 | 
					void update_hex_string(Container* container, UIContext* ui, RenderContext* gpu, EditorData* data) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  snprintf(data->string, 10, "#%02X%02X%02X%02X",
 | 
					 | 
					 | 
					 | 
					  snprintf(data->string, 10, "#%02X%02X%02X%02X",
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      (uint)rintf(data->current[0]*255),
 | 
					 | 
					 | 
					 | 
					      (uint)rintf(data->current[0]*255),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      (uint)rintf(data->current[1]*255),
 | 
					 | 
					 | 
					 | 
					      (uint)rintf(data->current[1]*255),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      (uint)rintf(data->current[2]*255),
 | 
					 | 
					 | 
					 | 
					      (uint)rintf(data->current[2]*255),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      (uint)rintf(data->current[3]*255));
 | 
					 | 
					 | 
					 | 
					      (uint)rintf(data->current[3]*255));
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  data->string_len = 8;
 | 
					 | 
					 | 
					 | 
					  data->string_len = 8;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  update_ui_string(data->string, COLOR_PICK_CONTAINER_ID, 0, 0, ui, gpu);
 | 
					 | 
					 | 
					 | 
					  update_ui_string(data->string, container, 0, 0, ui, gpu);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void sv_square_pick(UIContext* ui, RenderContext* gpu, EditorData* data, float s, float v) {
 | 
					 | 
					 | 
					 | 
					void sv_square_pick(Container* container, UIContext* ui, RenderContext* gpu, EditorData* data, float s, float v) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if(s < 0) s = 0;
 | 
					 | 
					 | 
					 | 
					  if(s < 0) s = 0;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if(s > 1) s = 1;
 | 
					 | 
					 | 
					 | 
					  if(s > 1) s = 1;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -147,7 +147,6 @@ void sv_square_pick(UIContext* ui, RenderContext* gpu, EditorData* data, float s
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  data->current_hsv[1] = s;
 | 
					 | 
					 | 
					 | 
					  data->current_hsv[1] = s;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  data->current_hsv[2] = v;
 | 
					 | 
					 | 
					 | 
					  data->current_hsv[2] = v;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Container* container = context_container(COLOR_PICK_CONTAINER_ID, ui);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Layer* layer = &container->layers[0];
 | 
					 | 
					 | 
					 | 
					  Layer* layer = &container->layers[0];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  GPUDrawable* select_outline = &layer->drawables_buffer[3];
 | 
					 | 
					 | 
					 | 
					  GPUDrawable* select_outline = &layer->drawables_buffer[3];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  GPUDrawable* select = &layer->drawables_buffer[4];
 | 
					 | 
					 | 
					 | 
					  GPUDrawable* select = &layer->drawables_buffer[4];
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -192,16 +191,16 @@ void sv_square_pick(UIContext* ui, RenderContext* gpu, EditorData* data, float s
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      gpu);
 | 
					 | 
					 | 
					 | 
					      gpu);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  hsv_to_rgb(data->current_hsv, data->current);
 | 
					 | 
					 | 
					 | 
					  hsv_to_rgb(data->current_hsv, data->current);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  update_hex_string(ui, gpu, data);
 | 
					 | 
					 | 
					 | 
					  update_hex_string(container, ui, gpu, data);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					bool sv_square_button_callback(void* data, UIContext* ui, RenderContext* gpu, float x, float y, int button, int action, int mods) {
 | 
					 | 
					 | 
					 | 
					bool sv_square_button_callback(Container* container, void* data, UIContext* ui, RenderContext* gpu, float x, float y, int button, int action, int mods) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (void)mods;
 | 
					 | 
					 | 
					 | 
					  (void)mods;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (void)x;
 | 
					 | 
					 | 
					 | 
					  (void)x;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if(action == GLFW_PRESS && button == GLFW_MOUSE_BUTTON_LEFT) {
 | 
					 | 
					 | 
					 | 
					  if(action == GLFW_PRESS && button == GLFW_MOUSE_BUTTON_LEFT) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    set_active_element(COLOR_PICK_CONTAINER_ID, 0, 1, ui);
 | 
					 | 
					 | 
					 | 
					    set_active_element(COLOR_PICK_CONTAINER_ID, 0, 1, ui);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    sv_square_pick(ui, gpu, data, x, 1-y);
 | 
					 | 
					 | 
					 | 
					    sv_square_pick(container, ui, gpu, data, x, 1-y);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } else if(action == GLFW_RELEASE && button == GLFW_MOUSE_BUTTON_LEFT) {
 | 
					 | 
					 | 
					 | 
					  } else if(action == GLFW_RELEASE && button == GLFW_MOUSE_BUTTON_LEFT) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    clear_active_element(ui, gpu);
 | 
					 | 
					 | 
					 | 
					    clear_active_element(ui, gpu);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  }
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -209,23 +208,22 @@ bool sv_square_button_callback(void* data, UIContext* ui, RenderContext* gpu, fl
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return true;
 | 
					 | 
					 | 
					 | 
					  return true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					bool sv_square_cursor_callback(void* data, UIContext* ui, RenderContext* gpu, float x, float y) {
 | 
					 | 
					 | 
					 | 
					bool sv_square_cursor_callback(Container* container, void* data, UIContext* ui, RenderContext* gpu, float x, float y) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if(ui->active_element == 1
 | 
					 | 
					 | 
					 | 
					  if(ui->active_element == 1
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  && ui->active_layer == 0
 | 
					 | 
					 | 
					 | 
					  && ui->active_layer == 0
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  && ui->active_container == COLOR_PICK_CONTAINER_ID) {
 | 
					 | 
					 | 
					 | 
					  && ui->active_container == container) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    sv_square_pick(ui, gpu, data, x, 1-y);
 | 
					 | 
					 | 
					 | 
					    sv_square_pick(container, ui, gpu, data, x, 1-y);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return true;
 | 
					 | 
					 | 
					 | 
					  return true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void hue_bar_set(UIContext* ui, RenderContext* gpu, EditorData* data, float y) {
 | 
					 | 
					 | 
					 | 
					void hue_bar_set(Container* container, UIContext* ui, RenderContext* gpu, EditorData* data, float y) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if(y < 0) y = 0;
 | 
					 | 
					 | 
					 | 
					  if(y < 0) y = 0;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if(y > 1) y = 1;
 | 
					 | 
					 | 
					 | 
					  if(y > 1) y = 1;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  data->current_hsv[0] = y;
 | 
					 | 
					 | 
					 | 
					  data->current_hsv[0] = y;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Container* container = context_container(COLOR_PICK_CONTAINER_ID, ui);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Layer* layer = &container->layers[0];
 | 
					 | 
					 | 
					 | 
					  Layer* layer = &container->layers[0];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  GPUDrawable* sv_square = &layer->drawables_buffer[1];
 | 
					 | 
					 | 
					 | 
					  GPUDrawable* sv_square = &layer->drawables_buffer[1];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  GPUDrawable* sv_select = &layer->drawables_buffer[4];
 | 
					 | 
					 | 
					 | 
					  GPUDrawable* sv_select = &layer->drawables_buffer[4];
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -265,37 +263,36 @@ void hue_bar_set(UIContext* ui, RenderContext* gpu, EditorData* data, float y) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      gpu);
 | 
					 | 
					 | 
					 | 
					      gpu);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  hsv_to_rgb(data->current_hsv, data->current);
 | 
					 | 
					 | 
					 | 
					  hsv_to_rgb(data->current_hsv, data->current);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  update_hex_string(ui, gpu, data);
 | 
					 | 
					 | 
					 | 
					  update_hex_string(container, ui, gpu, data);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					bool hue_bar_scroll_callback(void* data, UIContext* ui, RenderContext* gpu, double x, double y) {
 | 
					 | 
					 | 
					 | 
					bool hue_bar_scroll_callback(Container* container, void* data, UIContext* ui, RenderContext* gpu, double x, double y) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (void)x;
 | 
					 | 
					 | 
					 | 
					  (void)x;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Container* container = context_container(COLOR_PICK_CONTAINER_ID, ui);
 | 
					 | 
					 | 
					 | 
					  hue_bar_set(container, ui, gpu, data, y*0.01 + container->layers[0].drawables_buffer[1].color[0][0]);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  hue_bar_set(ui, gpu, data, y*0.01 + container->layers[0].drawables_buffer[1].color[0][0]);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return true;
 | 
					 | 
					 | 
					 | 
					  return true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					bool hue_bar_cursor_callback(void*data, UIContext* ui, RenderContext* gpu, float x, float y) {
 | 
					 | 
					 | 
					 | 
					bool hue_bar_cursor_callback(Container* container, void*data, UIContext* ui, RenderContext* gpu, float x, float y) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (void)x;
 | 
					 | 
					 | 
					 | 
					  (void)x;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if(ui->active_element == 2
 | 
					 | 
					 | 
					 | 
					  if(ui->active_element == 2
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  && ui->active_layer == 0
 | 
					 | 
					 | 
					 | 
					  && ui->active_layer == 0
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  && ui->active_container == COLOR_PICK_CONTAINER_ID) {
 | 
					 | 
					 | 
					 | 
					  && ui->active_container == container) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    hue_bar_set(ui, gpu, data, y);
 | 
					 | 
					 | 
					 | 
					    hue_bar_set(container, ui, gpu, data, y);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return true;
 | 
					 | 
					 | 
					 | 
					  return true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					bool hue_bar_button_callback(void* data, UIContext* ui, RenderContext* gpu, float x, float y, int button, int action, int mods) {
 | 
					 | 
					 | 
					 | 
					bool hue_bar_button_callback(Container* container, void* data, UIContext* ui, RenderContext* gpu, float x, float y, int button, int action, int mods) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (void)mods;
 | 
					 | 
					 | 
					 | 
					  (void)mods;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (void)x;
 | 
					 | 
					 | 
					 | 
					  (void)x;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if(action == GLFW_PRESS && button == GLFW_MOUSE_BUTTON_LEFT) {
 | 
					 | 
					 | 
					 | 
					  if(action == GLFW_PRESS && button == GLFW_MOUSE_BUTTON_LEFT) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    set_active_element(COLOR_PICK_CONTAINER_ID, 0, 2, ui);
 | 
					 | 
					 | 
					 | 
					    set_active_element(COLOR_PICK_CONTAINER_ID, 0, 2, ui);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    hue_bar_set(ui, gpu, data, y);
 | 
					 | 
					 | 
					 | 
					    hue_bar_set(container, ui, gpu, data, y);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } else if(action == GLFW_RELEASE && button == GLFW_MOUSE_BUTTON_LEFT) {
 | 
					 | 
					 | 
					 | 
					  } else if(action == GLFW_RELEASE && button == GLFW_MOUSE_BUTTON_LEFT) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    clear_active_element(ui, gpu);
 | 
					 | 
					 | 
					 | 
					    clear_active_element(ui, gpu);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  }
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -303,8 +300,7 @@ bool hue_bar_button_callback(void* data, UIContext* ui, RenderContext* gpu, floa
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return true;
 | 
					 | 
					 | 
					 | 
					  return true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void hex_string_set_color(UIContext* ui, RenderContext* gpu, float color) {
 | 
					 | 
					 | 
					 | 
					void hex_string_set_color(Container* container, RenderContext* gpu, float color) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Container* container = context_container(COLOR_PICK_CONTAINER_ID, ui);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  container->layers[0].drawables_buffer[5].color[0][2] = color;
 | 
					 | 
					 | 
					 | 
					  container->layers[0].drawables_buffer[5].color[0][2] = color;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  container->layers[0].drawables_buffer[5].color[0][3] = color;
 | 
					 | 
					 | 
					 | 
					  container->layers[0].drawables_buffer[5].color[0][3] = color;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -325,7 +321,7 @@ void hex_string_set_color(UIContext* ui, RenderContext* gpu, float color) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      gpu);
 | 
					 | 
					 | 
					 | 
					      gpu);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					bool hex_string_text_callback(void* ptr, UIContext* ui, RenderContext* gpu, unsigned int codepoint) {
 | 
					 | 
					 | 
					 | 
					bool hex_string_text_callback(Container* container, void* ptr, UIContext* ui, RenderContext* gpu, unsigned int codepoint) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  EditorData* data = ptr;
 | 
					 | 
					 | 
					 | 
					  EditorData* data = ptr;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if(codepoint >= 'a' && codepoint <= 'f') {
 | 
					 | 
					 | 
					 | 
					  if(codepoint >= 'a' && codepoint <= 'f') {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -337,13 +333,13 @@ bool hex_string_text_callback(void* ptr, UIContext* ui, RenderContext* gpu, unsi
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if(data->string_len < 8) {
 | 
					 | 
					 | 
					 | 
					  if(data->string_len < 8) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    data->string_len += 1;
 | 
					 | 
					 | 
					 | 
					    data->string_len += 1;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    data->string[data->string_len] = codepoint;
 | 
					 | 
					 | 
					 | 
					    data->string[data->string_len] = codepoint;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    update_ui_string(data->string, COLOR_PICK_CONTAINER_ID, 0, 0, ui, gpu);
 | 
					 | 
					 | 
					 | 
					    update_ui_string(data->string, container, 0, 0, ui, gpu);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return true;
 | 
					 | 
					 | 
					 | 
					  return true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					bool hex_string_key_callback(void* ptr, UIContext* ui, RenderContext* gpu, int key, int action, int mods) {
 | 
					 | 
					 | 
					 | 
					bool hex_string_key_callback(Container* container, void* ptr, UIContext* ui, RenderContext* gpu, int key, int action, int mods) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (void)mods;
 | 
					 | 
					 | 
					 | 
					  (void)mods;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  EditorData* data = ptr;
 | 
					 | 
					 | 
					 | 
					  EditorData* data = ptr;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  char tmp[3];
 | 
					 | 
					 | 
					 | 
					  char tmp[3];
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -352,7 +348,7 @@ bool hex_string_key_callback(void* ptr, UIContext* ui, RenderContext* gpu, int k
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    switch(key) {
 | 
					 | 
					 | 
					 | 
					    switch(key) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    case GLFW_KEY_ESCAPE:
 | 
					 | 
					 | 
					 | 
					    case GLFW_KEY_ESCAPE:
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      hsv_to_rgb(data->current_hsv, data->current);
 | 
					 | 
					 | 
					 | 
					      hsv_to_rgb(data->current_hsv, data->current);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      update_hex_string(ui, gpu, data);
 | 
					 | 
					 | 
					 | 
					      update_hex_string(container, ui, gpu, data);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      clear_active_element(ui, gpu);
 | 
					 | 
					 | 
					 | 
					      clear_active_element(ui, gpu);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      break;
 | 
					 | 
					 | 
					 | 
					      break;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    case GLFW_KEY_ENTER:
 | 
					 | 
					 | 
					 | 
					    case GLFW_KEY_ENTER:
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -378,8 +374,8 @@ bool hex_string_key_callback(void* ptr, UIContext* ui, RenderContext* gpu, int k
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      data->current[3] = strtol(tmp, NULL, 16)/255.0;
 | 
					 | 
					 | 
					 | 
					      data->current[3] = strtol(tmp, NULL, 16)/255.0;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      rgb_to_hsv(data->current, data->current_hsv);
 | 
					 | 
					 | 
					 | 
					      rgb_to_hsv(data->current, data->current_hsv);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      hue_bar_set(ui, gpu, data, data->current_hsv[0]);
 | 
					 | 
					 | 
					 | 
					      hue_bar_set(container, ui, gpu, data, data->current_hsv[0]);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      sv_square_pick(ui, gpu, data, data->current_hsv[1], data->current_hsv[2]);
 | 
					 | 
					 | 
					 | 
					      sv_square_pick(container, ui, gpu, data, data->current_hsv[1], data->current_hsv[2]);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      clear_active_element(ui, gpu);
 | 
					 | 
					 | 
					 | 
					      clear_active_element(ui, gpu);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      break;
 | 
					 | 
					 | 
					 | 
					      break;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -387,7 +383,7 @@ bool hex_string_key_callback(void* ptr, UIContext* ui, RenderContext* gpu, int k
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if(data->string_len > 0) {
 | 
					 | 
					 | 
					 | 
					      if(data->string_len > 0) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        data->string[data->string_len] = '\0';
 | 
					 | 
					 | 
					 | 
					        data->string[data->string_len] = '\0';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        data->string_len -= 1;
 | 
					 | 
					 | 
					 | 
					        data->string_len -= 1;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        update_ui_string(data->string, COLOR_PICK_CONTAINER_ID, 0, 0, ui, gpu);
 | 
					 | 
					 | 
					 | 
					        update_ui_string(data->string, container, 0, 0, ui, gpu);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      }
 | 
					 | 
					 | 
					 | 
					      }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      break;
 | 
					 | 
					 | 
					 | 
					      break;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -396,7 +392,7 @@ bool hex_string_key_callback(void* ptr, UIContext* ui, RenderContext* gpu, int k
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return true;
 | 
					 | 
					 | 
					 | 
					  return true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					bool hex_string_button_callback(void* data, UIContext* ui, RenderContext* gpu, float x, float y, int button, int action, int mods) {
 | 
					 | 
					 | 
					 | 
					bool hex_string_button_callback(Container* container, void* data, UIContext* ui, RenderContext* gpu, float x, float y, int button, int action, int mods) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (void)data;
 | 
					 | 
					 | 
					 | 
					  (void)data;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (void)mods;
 | 
					 | 
					 | 
					 | 
					  (void)mods;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (void)x;
 | 
					 | 
					 | 
					 | 
					  (void)x;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -404,24 +400,24 @@ bool hex_string_button_callback(void* data, UIContext* ui, RenderContext* gpu, f
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if(action == GLFW_PRESS && button == GLFW_MOUSE_BUTTON_LEFT) {
 | 
					 | 
					 | 
					 | 
					  if(action == GLFW_PRESS && button == GLFW_MOUSE_BUTTON_LEFT) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    set_active_element(COLOR_PICK_CONTAINER_ID, 0, 5, ui);
 | 
					 | 
					 | 
					 | 
					    set_active_element(COLOR_PICK_CONTAINER_ID, 0, 5, ui);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    hex_string_set_color(ui, gpu, 1);
 | 
					 | 
					 | 
					 | 
					    hex_string_set_color(container, gpu, 1);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return true;
 | 
					 | 
					 | 
					 | 
					  return true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void hex_string_deselect_callback(void* data, UIContext* ui, RenderContext* gpu) {
 | 
					 | 
					 | 
					 | 
					void hex_string_deselect_callback(Container* container, void* data, UIContext* ui, RenderContext* gpu) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (void)data;
 | 
					 | 
					 | 
					 | 
					  (void)data;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  hex_string_set_color(ui, gpu, 0);
 | 
					 | 
					 | 
					 | 
					  (void)ui;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  hex_string_set_color(container, gpu, 0);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void set_saved_color(UIContext* ui, RenderContext* gpu, EditorData* data, uint32_t index, vec4 color) {
 | 
					 | 
					 | 
					 | 
					void set_saved_color(Container* container, RenderContext* gpu, EditorData* data, uint32_t index, vec4 color) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  data->saved[index][0] = color[0];
 | 
					 | 
					 | 
					 | 
					  data->saved[index][0] = color[0];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  data->saved[index][1] = color[1];
 | 
					 | 
					 | 
					 | 
					  data->saved[index][1] = color[1];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  data->saved[index][2] = color[2];
 | 
					 | 
					 | 
					 | 
					  data->saved[index][2] = color[2];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  data->saved[index][3] = color[3];
 | 
					 | 
					 | 
					 | 
					  data->saved[index][3] = color[3];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Container* container = context_container(COLOR_PICK_CONTAINER_ID, ui);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Layer* layer = &container->layers[0];
 | 
					 | 
					 | 
					 | 
					  Layer* layer = &container->layers[0];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  GPUDrawable* saved_color = &layer->drawables_buffer[7 + index];
 | 
					 | 
					 | 
					 | 
					  GPUDrawable* saved_color = &layer->drawables_buffer[7 + index];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -450,6 +446,7 @@ void set_saved_color(UIContext* ui, RenderContext* gpu, EditorData* data, uint32
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					bool saved_color_button_callback(
 | 
					 | 
					 | 
					 | 
					bool saved_color_button_callback(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    Container* container,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    void* ptr,
 | 
					 | 
					 | 
					 | 
					    void* ptr,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    UIContext* ui,
 | 
					 | 
					 | 
					 | 
					    UIContext* ui,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    RenderContext* gpu,
 | 
					 | 
					 | 
					 | 
					    RenderContext* gpu,
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -469,14 +466,14 @@ bool saved_color_button_callback(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      data->current[2] = data->saved[index][2];
 | 
					 | 
					 | 
					 | 
					      data->current[2] = data->saved[index][2];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      data->current[3] = data->saved[index][3];
 | 
					 | 
					 | 
					 | 
					      data->current[3] = data->saved[index][3];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      rgb_to_hsv(data->current, data->current_hsv);
 | 
					 | 
					 | 
					 | 
					      rgb_to_hsv(data->current, data->current_hsv);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      hue_bar_set(ui, gpu, data, data->current_hsv[0]);
 | 
					 | 
					 | 
					 | 
					      hue_bar_set(container, ui, gpu, data, data->current_hsv[0]);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      sv_square_pick(ui, gpu, data, data->current_hsv[1], data->current_hsv[2]);
 | 
					 | 
					 | 
					 | 
					      sv_square_pick(container, ui, gpu, data, data->current_hsv[1], data->current_hsv[2]);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      update_hex_string(ui, gpu, data);
 | 
					 | 
					 | 
					 | 
					      update_hex_string(container, ui, gpu, data);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } else if(button == GLFW_MOUSE_BUTTON_RIGHT) {
 | 
					 | 
					 | 
					 | 
					    } else if(button == GLFW_MOUSE_BUTTON_RIGHT) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      set_saved_color(ui, gpu, data, index, data->current);
 | 
					 | 
					 | 
					 | 
					      set_saved_color(container, gpu, data, index, data->current);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } else if (button == GLFW_MOUSE_BUTTON_MIDDLE) {
 | 
					 | 
					 | 
					 | 
					    } else if (button == GLFW_MOUSE_BUTTON_MIDDLE) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      vec4 clear = {0, 0, 0, 0};
 | 
					 | 
					 | 
					 | 
					      vec4 clear = {0, 0, 0, 0};
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      set_saved_color(ui, gpu, data, index, clear);
 | 
					 | 
					 | 
					 | 
					      set_saved_color(container, gpu, data, index, clear);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -484,8 +481,8 @@ bool saved_color_button_callback(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#define SAVED_COLOR_BUTTON_CALLBACK(n) \
 | 
					 | 
					 | 
					 | 
					#define SAVED_COLOR_BUTTON_CALLBACK(n) \
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					bool saved_color_button_callback_##n(void* data, UIContext* ui, RenderContext* gpu, float x, float y, int button, int action, int mods) { \
 | 
					 | 
					 | 
					 | 
					bool saved_color_button_callback_##n(Container* container, void* data, UIContext* ui, RenderContext* gpu, float x, float y, int button, int action, int mods) { \
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return saved_color_button_callback(data, ui, gpu, x, y, button, action, mods, n); \
 | 
					 | 
					 | 
					 | 
					  return saved_color_button_callback(container, data, ui, gpu, x, y, button, action, mods, n); \
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					SAVED_COLOR_BUTTON_CALLBACK( 0);
 | 
					 | 
					 | 
					 | 
					SAVED_COLOR_BUTTON_CALLBACK( 0);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -729,104 +726,6 @@ VkResult color_ui(ClientContext* context) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return load_container(&container, &context->render, &context->ui);
 | 
					 | 
					 | 
					 | 
					  return load_container(&container, &context->render, &context->ui);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					VkResult hex_info_ui(ClientContext* context) {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  GPUString strings[] = {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .pos = {0, 33},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .color = {1, 1, 1, 1},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .size = 32,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .offset = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .length = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .font = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .pos = {2, 50},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .color = {1, 1, 1, 1},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .size = 16,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .offset = 20,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .length = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .font = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .pos = {2, 73},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .color = {1, 1, 1, 1},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .size = 16,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .offset = 40,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .length = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .font = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .pos = {2, 93},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .color = {1, 1, 1, 1},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .size = 16,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .offset = 60,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .length = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .font = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .pos = {2, 113},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .color = {1, 1, 1, 1},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .size = 16,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .offset = 80,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .length = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .font = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .pos = {2, 133},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .color = {1, 1, 1, 1},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .size = 16,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .offset = 100,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .length = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .font = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .pos = {2, 153},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .color = {1, 1, 1, 1},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .size = 16,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .offset = 120,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .length = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .font = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .pos = {2, 173},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .color = {1, 1, 1, 1},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .size = 16,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .offset = 140,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .length = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .font = 0,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  };
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  GPUDrawable drawables[] = {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .pos = {0, 0},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .size = {150, 175},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      .color = {{0.4, 0.4, 0.4, 0.8}, {0.4, 0.4, 0.4, 0.8}, {0.4, 0.4, 0.4, 0.8}, {0.4, 0.4, 0.4, 0.8}},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  };
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  LayerInput layer = {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    .strings = strings,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    .num_strings = sizeof(strings)/sizeof(GPUString),
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    .max_strings = sizeof(strings)/sizeof(GPUString) + 4,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    .max_codes = 200,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    .drawables = drawables,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    .num_drawables = sizeof(drawables)/sizeof(GPUDrawable),
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  };
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  ContainerInput container = {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    .id = 0x02,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    .size = {150, 175},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    .offset = {0, 0},
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    .anchor = ANCHOR_BOTTOM_RIGHT,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    .layers = &layer,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    .layer_count = 1,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  };
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return load_container(&container, &context->render, &context->ui);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					VkResult mode_string_ui(ClientContext* context) {
 | 
					 | 
					 | 
					 | 
					VkResult mode_string_ui(ClientContext* context) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  VkResult result;
 | 
					 | 
					 | 
					 | 
					  VkResult result;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -861,7 +760,8 @@ VkResult mode_string_ui(ClientContext* context) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					VkResult update_mode_string(ClientContext* context, EditorData* data) { 
 | 
					 | 
					 | 
					 | 
					VkResult update_mode_string(ClientContext* context, EditorData* data) { 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return update_ui_string(ModeStrings[data->mode], MODE_STRING_CONTAINER_ID, 0, 0, &context->ui, &context->render);
 | 
					 | 
					 | 
					 | 
					  Container* container = context_container(MODE_STRING_CONTAINER_ID, &context->ui);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  return update_ui_string(ModeStrings[data->mode], container, 0, 0, &context->ui, &context->render);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void editor_key_callback(ClientContext* context, int key, int action, int mods) {
 | 
					 | 
					 | 
					 | 
					void editor_key_callback(ClientContext* context, int key, int action, int mods) {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |