|  |  |  | @ -11,9 +11,9 @@ | 
		
	
		
			
				|  |  |  |  | typedef struct EditorDataStruct {  | 
		
	
		
			
				|  |  |  |  |   uint32_t selected_region; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   uint32_t last_clicked_region; | 
		
	
		
			
				|  |  |  |  |   uint32_t last_clicked_hex; | 
		
	
		
			
				|  |  |  |  |   uint32_t last_clicked_vertex; | 
		
	
		
			
				|  |  |  |  |   uint32_t clicked_region; | 
		
	
		
			
				|  |  |  |  |   uint32_t clicked_hex; | 
		
	
		
			
				|  |  |  |  |   uint32_t clicked_vertex; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   double current_hsv[3]; | 
		
	
		
			
				|  |  |  |  |   vec4 current; | 
		
	
	
		
			
				
					|  |  |  | @ -862,10 +862,8 @@ VkResult update_region_info_ui(ClientContext* context) { | 
		
	
		
			
				|  |  |  |  |   char temp[20]; | 
		
	
		
			
				|  |  |  |  |   VkResult result; | 
		
	
		
			
				|  |  |  |  |   EditorData* data = context->app_data; | 
		
	
		
			
				|  |  |  |  |   HexRegion* selected_region = context->hex.regions[data->selected_region]; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   if(selected_region == NULL) { | 
		
	
		
			
				|  |  |  |  |   if(data->selected_region >= MAX_LOADED_REGIONS) { | 
		
	
		
			
				|  |  |  |  |     snprintf(temp, | 
		
	
		
			
				|  |  |  |  |         sizeof(temp), | 
		
	
		
			
				|  |  |  |  |         ""); | 
		
	
	
		
			
				
					|  |  |  | @ -889,6 +887,7 @@ VkResult update_region_info_ui(ClientContext* context) { | 
		
	
		
			
				|  |  |  |  |         ""); | 
		
	
		
			
				|  |  |  |  |     VK_RESULT(update_ui_string(temp, 0x01, 0, 3, &context->ui, &context->render)); | 
		
	
		
			
				|  |  |  |  |   } else { | 
		
	
		
			
				|  |  |  |  |     HexRegion* selected_region = context->hex.regions[data->selected_region]; | 
		
	
		
			
				|  |  |  |  |     snprintf(temp, | 
		
	
		
			
				|  |  |  |  |         sizeof(temp), | 
		
	
		
			
				|  |  |  |  |         "Region %4d", data->selected_region); | 
		
	
	
		
			
				
					|  |  |  | @ -919,10 +918,10 @@ VkResult update_region_info_ui(ClientContext* context) { | 
		
	
		
			
				|  |  |  |  | VkResult update_hex_info_ui(ClientContext* context) {  | 
		
	
		
			
				|  |  |  |  |   char temp[20]; | 
		
	
		
			
				|  |  |  |  |   VkResult result; | 
		
	
		
			
				|  |  |  |  |   HexRegion* region = context->hex.regions[context->hex.data.clicked_region]; | 
		
	
		
			
				|  |  |  |  |   EditorData* data = context->app_data; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   if(region == NULL) { | 
		
	
		
			
				|  |  |  |  |   if(data->clicked_region >= MAX_LOADED_REGIONS) { | 
		
	
		
			
				|  |  |  |  |     snprintf( | 
		
	
		
			
				|  |  |  |  |         temp, | 
		
	
		
			
				|  |  |  |  |         sizeof(temp), | 
		
	
	
		
			
				
					|  |  |  | @ -971,17 +970,19 @@ VkResult update_hex_info_ui(ClientContext* context) { | 
		
	
		
			
				|  |  |  |  |         ""); | 
		
	
		
			
				|  |  |  |  |     VK_RESULT(update_ui_string(temp, 0x02, 0, 7, &context->ui, &context->render)); | 
		
	
		
			
				|  |  |  |  |   } else { | 
		
	
		
			
				|  |  |  |  |     GPUHex* hex = ®ion->data.hexes[context->hex.data.clicked_hex]; | 
		
	
		
			
				|  |  |  |  |     HexRegion* region = context->hex.regions[data->clicked_region]; | 
		
	
		
			
				|  |  |  |  |     GPUHex* hex = ®ion->data.hexes[data->clicked_hex]; | 
		
	
		
			
				|  |  |  |  |     snprintf(temp, | 
		
	
		
			
				|  |  |  |  |         sizeof(temp), | 
		
	
		
			
				|  |  |  |  |         "%d-%d", | 
		
	
		
			
				|  |  |  |  |         context->hex.data.clicked_region, | 
		
	
		
			
				|  |  |  |  |         context->hex.data.clicked_hex); | 
		
	
		
			
				|  |  |  |  |         data->clicked_region, | 
		
	
		
			
				|  |  |  |  |         data->clicked_hex); | 
		
	
		
			
				|  |  |  |  |     VK_RESULT(update_ui_string(temp, 0x02, 0, 0, &context->ui, &context->render)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     HexCoord hex_world; | 
		
	
		
			
				|  |  |  |  |     hex_qr(context->hex.data.clicked_hex, &hex_world); | 
		
	
		
			
				|  |  |  |  |     hex_qr(data->clicked_hex, &hex_world); | 
		
	
		
			
				|  |  |  |  |      | 
		
	
		
			
				|  |  |  |  |     fprintf(stderr, "region: %d\n", data->clicked_region); | 
		
	
		
			
				|  |  |  |  |     HexCoord region_coord = {region->data.position.q, region->data.position.r}; | 
		
	
		
			
				|  |  |  |  |     HexCoord region_world; | 
		
	
		
			
				|  |  |  |  |     region_qr(region_coord, ®ion_world); | 
		
	
	
		
			
				
					|  |  |  | @ -994,7 +995,7 @@ VkResult update_hex_info_ui(ClientContext* context) { | 
		
	
		
			
				|  |  |  |  |         hex_world.q, | 
		
	
		
			
				|  |  |  |  |         hex_world.r, | 
		
	
		
			
				|  |  |  |  |         region->data.y, | 
		
	
		
			
				|  |  |  |  |         context->hex.data.clicked_vertex); | 
		
	
		
			
				|  |  |  |  |         data->clicked_vertex); | 
		
	
		
			
				|  |  |  |  |     VK_RESULT(update_ui_string(temp, 0x02, 0, 1, &context->ui, &context->render)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     snprintf( | 
		
	
	
		
			
				
					|  |  |  | @ -1059,21 +1060,23 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_MINUS: | 
		
	
		
			
				|  |  |  |  |     free_hex_region(data->selected_region, &context->hex, &context->render); | 
		
	
		
			
				|  |  |  |  |     start = data->selected_region; | 
		
	
		
			
				|  |  |  |  |     next_region = start; | 
		
	
		
			
				|  |  |  |  |     do { | 
		
	
		
			
				|  |  |  |  |       next_region -= 1; | 
		
	
		
			
				|  |  |  |  |       if(next_region > MAX_LOADED_REGIONS) next_region = MAX_LOADED_REGIONS; | 
		
	
		
			
				|  |  |  |  |       if(next_region != MAX_LOADED_REGIONS && context->hex.regions[next_region] != NULL) break; | 
		
	
		
			
				|  |  |  |  |     } while(next_region != start); | 
		
	
		
			
				|  |  |  |  |     if(next_region == start) { | 
		
	
		
			
				|  |  |  |  |       data->selected_region = MAX_LOADED_REGIONS; | 
		
	
		
			
				|  |  |  |  |     } else { | 
		
	
		
			
				|  |  |  |  |       data->selected_region = next_region; | 
		
	
		
			
				|  |  |  |  |     if(data->selected_region < MAX_LOADED_REGIONS) { | 
		
	
		
			
				|  |  |  |  |       free_hex_region(data->selected_region, &context->hex, &context->render); | 
		
	
		
			
				|  |  |  |  |       start = data->selected_region; | 
		
	
		
			
				|  |  |  |  |       next_region = start; | 
		
	
		
			
				|  |  |  |  |       do { | 
		
	
		
			
				|  |  |  |  |         next_region -= 1; | 
		
	
		
			
				|  |  |  |  |         if(next_region > MAX_LOADED_REGIONS) next_region = MAX_LOADED_REGIONS; | 
		
	
		
			
				|  |  |  |  |         if(next_region != MAX_LOADED_REGIONS && context->hex.regions[next_region] != NULL) break; | 
		
	
		
			
				|  |  |  |  |       } while(next_region != start); | 
		
	
		
			
				|  |  |  |  |       if(next_region == start) { | 
		
	
		
			
				|  |  |  |  |         data->selected_region = MAX_LOADED_REGIONS; | 
		
	
		
			
				|  |  |  |  |       } else { | 
		
	
		
			
				|  |  |  |  |         data->selected_region = next_region; | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       update_region_info_ui(context); | 
		
	
		
			
				|  |  |  |  |       update_hex_info_ui(context); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     update_region_info_ui(context); | 
		
	
		
			
				|  |  |  |  |     update_hex_info_ui(context); | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_LEFT_BRACKET: | 
		
	
	
		
			
				
					|  |  |  | @ -1101,7 +1104,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_I: | 
		
	
		
			
				|  |  |  |  |     if(context->hex.regions[data->selected_region] != NULL) { | 
		
	
		
			
				|  |  |  |  |     if(data->selected_region < MAX_LOADED_REGIONS) { | 
		
	
		
			
				|  |  |  |  |       context->hex.regions[data->selected_region]->data.position.q += 1; | 
		
	
		
			
				|  |  |  |  |       add_transfer( | 
		
	
		
			
				|  |  |  |  |           &context->hex.regions[data->selected_region]->data.position, | 
		
	
	
		
			
				
					|  |  |  | @ -1114,7 +1117,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |     update_region_info_ui(context); | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_K: | 
		
	
		
			
				|  |  |  |  |     if(context->hex.regions[data->selected_region] != NULL) { | 
		
	
		
			
				|  |  |  |  |     if(data->selected_region < MAX_LOADED_REGIONS) { | 
		
	
		
			
				|  |  |  |  |       context->hex.regions[data->selected_region]->data.position.q -= 1; | 
		
	
		
			
				|  |  |  |  |       add_transfer( | 
		
	
		
			
				|  |  |  |  |           &context->hex.regions[data->selected_region]->data.position.q, | 
		
	
	
		
			
				
					|  |  |  | @ -1127,7 +1130,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |     update_region_info_ui(context); | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_J: | 
		
	
		
			
				|  |  |  |  |     if(context->hex.regions[data->selected_region] != NULL) { | 
		
	
		
			
				|  |  |  |  |     if(data->selected_region < MAX_LOADED_REGIONS) { | 
		
	
		
			
				|  |  |  |  |       context->hex.regions[data->selected_region]->data.position.r += 1; | 
		
	
		
			
				|  |  |  |  |       add_transfer( | 
		
	
		
			
				|  |  |  |  |           &context->hex.regions[data->selected_region]->data.position.r, | 
		
	
	
		
			
				
					|  |  |  | @ -1140,7 +1143,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |     update_region_info_ui(context); | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_L: | 
		
	
		
			
				|  |  |  |  |     if(context->hex.regions[data->selected_region] != NULL) { | 
		
	
		
			
				|  |  |  |  |     if(data->selected_region < MAX_LOADED_REGIONS) { | 
		
	
		
			
				|  |  |  |  |       context->hex.regions[data->selected_region]->data.position.r -= 1; | 
		
	
		
			
				|  |  |  |  |       add_transfer( | 
		
	
		
			
				|  |  |  |  |           &context->hex.regions[data->selected_region]->data.position.r, | 
		
	
	
		
			
				
					|  |  |  | @ -1153,7 +1156,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |     update_region_info_ui(context); | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_O: | 
		
	
		
			
				|  |  |  |  |     if(context->hex.regions[data->selected_region] != NULL) { | 
		
	
		
			
				|  |  |  |  |     if(data->selected_region < MAX_LOADED_REGIONS) { | 
		
	
		
			
				|  |  |  |  |       context->hex.regions[data->selected_region]->data.y += 1; | 
		
	
		
			
				|  |  |  |  |       add_transfer( | 
		
	
		
			
				|  |  |  |  |           &context->hex.regions[data->selected_region]->data.y, | 
		
	
	
		
			
				
					|  |  |  | @ -1166,7 +1169,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |     update_region_info_ui(context); | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_U: | 
		
	
		
			
				|  |  |  |  |     if(context->hex.regions[data->selected_region] != NULL) { | 
		
	
		
			
				|  |  |  |  |     if(data->selected_region < MAX_LOADED_REGIONS) { | 
		
	
		
			
				|  |  |  |  |       context->hex.regions[data->selected_region]->data.y -= 1; | 
		
	
		
			
				|  |  |  |  |       add_transfer( | 
		
	
		
			
				|  |  |  |  |           &context->hex.regions[data->selected_region]->data.y, | 
		
	
	
		
			
				
					|  |  |  | @ -1180,9 +1183,9 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_Y: | 
		
	
		
			
				|  |  |  |  |     region = context->hex.regions[context->hex.data.clicked_region]; | 
		
	
		
			
				|  |  |  |  |     if(region != NULL && context->hex.data.clicked_vertex != 0) { | 
		
	
		
			
				|  |  |  |  |       float height = region->data.hexes[context->hex.data.clicked_hex].height[context->hex.data.clicked_vertex-1] + 0.1;  | 
		
	
		
			
				|  |  |  |  |     if(data->clicked_region < MAX_LOADED_REGIONS && data->clicked_vertex != 0) { | 
		
	
		
			
				|  |  |  |  |       region = context->hex.regions[data->clicked_region]; | 
		
	
		
			
				|  |  |  |  |       float height = region->data.hexes[data->clicked_hex].height[data->clicked_vertex-1] + 0.1;  | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       if(~mods & GLFW_MOD_CONTROL) { | 
		
	
		
			
				|  |  |  |  |         uint32_t n_vertex[2], n_hex[2]; | 
		
	
	
		
			
				
					|  |  |  | @ -1190,9 +1193,9 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |         HexCoord world, region_center; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         region_qr(region->data.position, ®ion_center); | 
		
	
		
			
				|  |  |  |  |         hex_qr(context->hex.data.clicked_hex, &world); | 
		
	
		
			
				|  |  |  |  |         hex_qr(data->clicked_hex, &world); | 
		
	
		
			
				|  |  |  |  |         hex_add(region_center, &world); | 
		
	
		
			
				|  |  |  |  |         hex_vertex_neighbors(context->hex.data.clicked_vertex, world, n_vertex, n_region, n_hex);   | 
		
	
		
			
				|  |  |  |  |         hex_vertex_neighbors(data->clicked_vertex, world, n_vertex, n_region, n_hex);   | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         uint32_t n0, n1; | 
		
	
		
			
				|  |  |  |  |         first_matching_region(n_region[0], region->data.y, &n0, &context->hex); | 
		
	
	
		
			
				
					|  |  |  | @ -1201,15 +1204,15 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |         if(n0 != MAX_LOADED_REGIONS) set_vertex_height(height, n0, n_hex[0], n_vertex[0], context); | 
		
	
		
			
				|  |  |  |  |         if(n1 != MAX_LOADED_REGIONS) set_vertex_height(height, n1, n_hex[1], n_vertex[1], context); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       set_vertex_height(height, context->hex.data.clicked_region, context->hex.data.clicked_hex, context->hex.data.clicked_vertex, context); | 
		
	
		
			
				|  |  |  |  |       set_vertex_height(height, data->clicked_region, data->clicked_hex, data->clicked_vertex, context); | 
		
	
		
			
				|  |  |  |  |       update_hex_info_ui(context); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_H: | 
		
	
		
			
				|  |  |  |  |     region = context->hex.regions[context->hex.data.clicked_region]; | 
		
	
		
			
				|  |  |  |  |     if(region != NULL && context->hex.data.clicked_vertex != 0) { | 
		
	
		
			
				|  |  |  |  |       float height = region->data.hexes[context->hex.data.clicked_hex].height[context->hex.data.clicked_vertex-1] - 0.1;  | 
		
	
		
			
				|  |  |  |  |     if(data->clicked_region < MAX_LOADED_REGIONS && data->clicked_vertex != 0) { | 
		
	
		
			
				|  |  |  |  |       region = context->hex.regions[data->clicked_region]; | 
		
	
		
			
				|  |  |  |  |       float height = region->data.hexes[data->clicked_hex].height[data->clicked_vertex-1] - 0.1;  | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       if(~mods & GLFW_MOD_CONTROL) { | 
		
	
		
			
				|  |  |  |  |         uint32_t n_vertex[2], n_hex[2]; | 
		
	
	
		
			
				
					|  |  |  | @ -1217,9 +1220,9 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |         HexCoord world, region_center; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         region_qr(region->data.position, ®ion_center); | 
		
	
		
			
				|  |  |  |  |         hex_qr(context->hex.data.clicked_hex, &world); | 
		
	
		
			
				|  |  |  |  |         hex_qr(data->clicked_hex, &world); | 
		
	
		
			
				|  |  |  |  |         hex_add(region_center, &world); | 
		
	
		
			
				|  |  |  |  |         hex_vertex_neighbors(context->hex.data.clicked_vertex, world, n_vertex, n_region, n_hex);   | 
		
	
		
			
				|  |  |  |  |         hex_vertex_neighbors(data->clicked_vertex, world, n_vertex, n_region, n_hex);   | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         uint32_t n0, n1; | 
		
	
		
			
				|  |  |  |  |         first_matching_region(n_region[0], region->data.y, &n0, &context->hex); | 
		
	
	
		
			
				
					|  |  |  | @ -1228,23 +1231,23 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |         if(n0 != MAX_LOADED_REGIONS) set_vertex_height(height, n0, n_hex[0], n_vertex[0], context); | 
		
	
		
			
				|  |  |  |  |         if(n1 != MAX_LOADED_REGIONS) set_vertex_height(height, n1, n_hex[1], n_vertex[1], context); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       set_vertex_height(height, context->hex.data.clicked_region, context->hex.data.clicked_hex, context->hex.data.clicked_vertex, context); | 
		
	
		
			
				|  |  |  |  |       set_vertex_height(height, data->clicked_region, data->clicked_hex, data->clicked_vertex, context); | 
		
	
		
			
				|  |  |  |  |       update_hex_info_ui(context); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_E: | 
		
	
		
			
				|  |  |  |  |     region = context->hex.regions[context->hex.data.clicked_region]; | 
		
	
		
			
				|  |  |  |  |     if(region != NULL) { | 
		
	
		
			
				|  |  |  |  |     if(data->clicked_region < MAX_LOADED_REGIONS) { | 
		
	
		
			
				|  |  |  |  |       region = context->hex.regions[data->clicked_region]; | 
		
	
		
			
				|  |  |  |  |       uint32_t n_vertex[2], n_hex[2]; | 
		
	
		
			
				|  |  |  |  |       HexCoord n_region[2]; | 
		
	
		
			
				|  |  |  |  |       HexCoord world, region_center; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       if(context->hex.data.clicked_vertex != 0) { | 
		
	
		
			
				|  |  |  |  |       if(data->clicked_vertex != 0 && data->clicked_vertex <= 6) { | 
		
	
		
			
				|  |  |  |  |         region_qr(region->data.position, ®ion_center); | 
		
	
		
			
				|  |  |  |  |         hex_qr(context->hex.data.clicked_hex, &world); | 
		
	
		
			
				|  |  |  |  |         hex_qr(data->clicked_hex, &world); | 
		
	
		
			
				|  |  |  |  |         hex_add(region_center, &world); | 
		
	
		
			
				|  |  |  |  |         hex_vertex_neighbors(context->hex.data.clicked_vertex, world, n_vertex, n_region, n_hex);   | 
		
	
		
			
				|  |  |  |  |         hex_vertex_neighbors(data->clicked_vertex, world, n_vertex, n_region, n_hex);   | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         uint32_t n0, n1; | 
		
	
		
			
				|  |  |  |  |         first_matching_region(n_region[0], region->data.y, &n0, &context->hex); | 
		
	
	
		
			
				
					|  |  |  | @ -1253,7 +1256,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |         if(n0 != MAX_LOADED_REGIONS) set_vertex_color(data->current, n0, n_hex[0], n_vertex[0], context); | 
		
	
		
			
				|  |  |  |  |         if(n1 != MAX_LOADED_REGIONS) set_vertex_color(data->current, n1, n_hex[1], n_vertex[1], context); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       set_vertex_color(data->current, context->hex.data.clicked_region, context->hex.data.clicked_hex, context->hex.data.clicked_vertex, context); | 
		
	
		
			
				|  |  |  |  |       set_vertex_color(data->current, data->clicked_region, data->clicked_hex, data->clicked_vertex, context); | 
		
	
		
			
				|  |  |  |  |       update_hex_info_ui(context); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
	
		
			
				
					|  |  |  | @ -1262,18 +1265,6 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods) | 
		
	
		
			
				|  |  |  |  |   return false; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void editor_frame(ClientContext* context) { | 
		
	
		
			
				|  |  |  |  |   EditorData* data = context->app_data; | 
		
	
		
			
				|  |  |  |  |   if(data->last_clicked_region != context->hex.data.clicked_region || | 
		
	
		
			
				|  |  |  |  |      data->last_clicked_hex != context->hex.data.clicked_hex || | 
		
	
		
			
				|  |  |  |  |      data->last_clicked_vertex != context->hex.data.clicked_vertex) { | 
		
	
		
			
				|  |  |  |  |     data->last_clicked_region = context->hex.data.clicked_region; | 
		
	
		
			
				|  |  |  |  |     data->last_clicked_hex = context->hex.data.clicked_hex; | 
		
	
		
			
				|  |  |  |  |     data->last_clicked_vertex = context->hex.data.clicked_vertex; | 
		
	
		
			
				|  |  |  |  |     update_hex_info_ui(context); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void editor_startup(ClientContext* context) { | 
		
	
		
			
				|  |  |  |  |   region_info_ui(context); | 
		
	
		
			
				|  |  |  |  |   hex_info_ui(context); | 
		
	
	
		
			
				
					|  |  |  | @ -1284,7 +1275,9 @@ int main() { | 
		
	
		
			
				|  |  |  |  |   EditorData* data = malloc(sizeof(EditorData)); | 
		
	
		
			
				|  |  |  |  |   memset(data, 0, sizeof(EditorData)); | 
		
	
		
			
				|  |  |  |  |   data->selected_region = MAX_LOADED_REGIONS; | 
		
	
		
			
				|  |  |  |  |   data->last_clicked_region = MAX_LOADED_REGIONS; | 
		
	
		
			
				|  |  |  |  |   data->clicked_region = MAX_LOADED_REGIONS; | 
		
	
		
			
				|  |  |  |  |   data->clicked_hex = UINT32_MAX; | 
		
	
		
			
				|  |  |  |  |   data->clicked_vertex = UINT32_MAX; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   return run_app(data, editor_startup, editor_frame, NULL, editor_key_callback, NULL, NULL, NULL); | 
		
	
		
			
				|  |  |  |  |   return run_app(data, editor_startup, NULL, NULL, editor_key_callback, NULL, NULL, NULL); | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | 
 |