|  |  | @ -45,6 +45,10 @@ typedef struct ClientContextStruct { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   uint32_t selected_region; |  |  |  |   uint32_t selected_region; | 
			
		
	
		
		
			
				
					
					|  |  |  |   uint32_t last_selected_region; |  |  |  |   uint32_t last_selected_region; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   uint32_t last_clicked_region; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   uint32_t last_clicked_hex; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   uint32_t last_clicked_vertex; | 
			
		
	
		
		
			
				
					
					|  |  |  | } ClientContext; |  |  |  | } ClientContext; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | void* network_thread(void* data) { |  |  |  | void* network_thread(void* data) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -88,19 +92,96 @@ uint32_t add_hex_region(ClientContext* context) { | 
			
		
	
		
		
			
				
					
					|  |  |  |   return i; |  |  |  |   return i; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | char region_info_strs[][20] = { |  |  |  | VkResult hex_info_ui(ClientContext* context) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   "Region XXXX", |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   "Q: XXXX", |  |  |  |   GPUString strings[] = { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   "R: XXXX", |  |  |  |     { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   "Y: XXXX", |  |  |  |       .pos = {0, 33}, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | }; |  |  |  |       .color = {1, 1, 1, 1}, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .size = 32, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .offset = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .length = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .font = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .pos = {0, 73}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .color = {1, 1, 1, 1}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .size = 16, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .offset = 20, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .length = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .font = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .pos = {0, 93}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .color = {1, 1, 1, 1}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .size = 16, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .offset = 40, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .length = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .font = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .pos = {0, 113}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .color = {1, 1, 1, 1}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .size = 16, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .offset = 60, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .length = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .font = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .pos = {0, 133}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .color = {1, 1, 1, 1}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .size = 16, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .offset = 80, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .length = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .font = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .pos = {0, 153}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .color = {1, 1, 1, 1}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .size = 16, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .offset = 100, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .length = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .font = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .pos = {0, 173}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .color = {1, 1, 1, 1}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .size = 16, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .offset = 120, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .length = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .font = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   }; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   GPUDrawable drawables[] = { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .pos = {0, 0}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .size = {225, 200}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       .color = {0.4, 0.4, 0.4, 0.4}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   }; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   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 = 0x01, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     .size = {225, 200}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     .offset = {0, 0}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     .anchor = ANCHOR_BOTTOM_RIGHT, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     .layers = &layer, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     .layer_count = 1, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   }; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | uint32_t region_info_str_off[] = { |  |  |  |   return create_container(&container, context->render, context->ui); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   0, |  |  |  | } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   11, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   18, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   25, |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | }; |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | VkResult region_info_ui(ClientContext* context) { |  |  |  | VkResult region_info_ui(ClientContext* context) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -109,43 +190,36 @@ VkResult region_info_ui(ClientContext* context) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       .pos = {0, 33}, |  |  |  |       .pos = {0, 33}, | 
			
		
	
		
		
			
				
					
					|  |  |  |       .color = {1, 1, 1, 1}, |  |  |  |       .color = {1, 1, 1, 1}, | 
			
		
	
		
		
			
				
					
					|  |  |  |       .size = 32, |  |  |  |       .size = 32, | 
			
		
	
		
		
			
				
					
					|  |  |  |       .offset = region_info_str_off[0], |  |  |  |       .offset = 0, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       .length = strlen(region_info_strs[0]), |  |  |  |       .length = 0, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       .font = 0, |  |  |  |       .font = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |     }, |  |  |  |     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |     { |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |       .pos = {0, 33 + 1*40}, |  |  |  |       .pos = {0, 33 + 1*40}, | 
			
		
	
		
		
			
				
					
					|  |  |  |       .color = {1, 1, 1, 1}, |  |  |  |       .color = {1, 1, 1, 1}, | 
			
		
	
		
		
			
				
					
					|  |  |  |       .size = 32, |  |  |  |       .size = 32, | 
			
		
	
		
		
			
				
					
					|  |  |  |       .offset = region_info_str_off[1], |  |  |  |       .offset = 11, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       .length = strlen(region_info_strs[1]), |  |  |  |       .length = 0, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       .font = 0, |  |  |  |       .font = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |     }, |  |  |  |     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |     { |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |       .pos = {0, 33 + 2*40}, |  |  |  |       .pos = {0, 33 + 2*40}, | 
			
		
	
		
		
			
				
					
					|  |  |  |       .color = {1, 1, 1, 1}, |  |  |  |       .color = {1, 1, 1, 1}, | 
			
		
	
		
		
			
				
					
					|  |  |  |       .size = 32, |  |  |  |       .size = 32, | 
			
		
	
		
		
			
				
					
					|  |  |  |       .offset = region_info_str_off[2], |  |  |  |       .offset = 18, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       .length = strlen(region_info_strs[2]), |  |  |  |       .length = 0, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       .font = 0, |  |  |  |       .font = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |     }, |  |  |  |     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |     { |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |       .pos = {0, 33 + 3*40}, |  |  |  |       .pos = {0, 33 + 3*40}, | 
			
		
	
		
		
			
				
					
					|  |  |  |       .color = {1, 1, 1, 1}, |  |  |  |       .color = {1, 1, 1, 1}, | 
			
		
	
		
		
			
				
					
					|  |  |  |       .size = 32, |  |  |  |       .size = 32, | 
			
		
	
		
		
			
				
					
					|  |  |  |       .offset = region_info_str_off[3], |  |  |  |       .offset = 25, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       .length = strlen(region_info_strs[3]), |  |  |  |       .length = 0, | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       .font = 0, |  |  |  |       .font = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |     }, |  |  |  |     }, | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |   }; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   uint32_t codes[43/4]; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   VkResult result; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   VK_RESULT(map_string(region_info_strs[0], codes, region_info_str_off[0], 0, context->ui)); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   VK_RESULT(map_string(region_info_strs[1], codes, region_info_str_off[1], 0, context->ui)); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   VK_RESULT(map_string(region_info_strs[2], codes, region_info_str_off[2], 0, context->ui)); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   VK_RESULT(map_string(region_info_strs[3], codes, region_info_str_off[3], 0, context->ui)); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   GPUDrawable drawables[] = { |  |  |  |   GPUDrawable drawables[] = { | 
			
		
	
		
		
			
				
					
					|  |  |  |     { |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |       .pos = {0, 0}, |  |  |  |       .pos = {0, 0}, | 
			
		
	
	
		
		
			
				
					|  |  | @ -158,14 +232,12 @@ VkResult region_info_ui(ClientContext* context) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     .strings = strings, |  |  |  |     .strings = strings, | 
			
		
	
		
		
			
				
					
					|  |  |  |     .num_strings = sizeof(strings)/sizeof(GPUString), |  |  |  |     .num_strings = sizeof(strings)/sizeof(GPUString), | 
			
		
	
		
		
			
				
					
					|  |  |  |     .max_strings = sizeof(strings)/sizeof(GPUString) + 4, |  |  |  |     .max_strings = sizeof(strings)/sizeof(GPUString) + 4, | 
			
		
	
		
		
			
				
					
					|  |  |  |     .codes = codes, |  |  |  |     .max_codes = 100, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     .num_codes = sizeof(codes)/sizeof(uint32_t), |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     .max_codes = sizeof(codes)/sizeof(uint32_t) + 100, |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     .drawables = drawables, |  |  |  |     .drawables = drawables, | 
			
		
	
		
		
			
				
					
					|  |  |  |     .num_drawables = sizeof(drawables)/sizeof(GPUDrawable), |  |  |  |     .num_drawables = sizeof(drawables)/sizeof(GPUDrawable), | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |   }; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   ContainerInput region_info = { |  |  |  |   ContainerInput container = { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     .id = 0x01, |  |  |  |     .id = 0x01, | 
			
		
	
		
		
			
				
					
					|  |  |  |     .size = {225, 155}, |  |  |  |     .size = {225, 155}, | 
			
		
	
		
		
			
				
					
					|  |  |  |     .offset = {0, 0}, |  |  |  |     .offset = {0, 0}, | 
			
		
	
	
		
		
			
				
					|  |  | @ -174,54 +246,152 @@ VkResult region_info_ui(ClientContext* context) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     .layer_count = 1, |  |  |  |     .layer_count = 1, | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |   }; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   return create_container(®ion_info, context->render, context->ui); |  |  |  |   return create_container(&container, context->render, context->ui); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | VkResult update_region_info_ui(ClientContext* context) {  |  |  |  | VkResult update_region_info_ui(ClientContext* context) {  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   char temp[20]; | 
			
		
	
		
		
			
				
					
					|  |  |  |   VkResult result; |  |  |  |   VkResult result; | 
			
		
	
		
		
			
				
					
					|  |  |  |   HexRegion* selected_region = context->hex->regions[context->selected_region]; |  |  |  |   HexRegion* selected_region = context->hex->regions[context->selected_region]; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   snprintf(region_info_strs[0], |  |  |  |   snprintf(temp, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       sizeof(region_info_strs[0]), |  |  |  |       sizeof(temp), | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       "Region %4d", context->selected_region); |  |  |  |       "Region %4d", context->selected_region); | 
			
		
	
		
		
			
				
					
					|  |  |  |   VK_RESULT(update_ui_string(region_info_strs[0], 0, 0, 0, context->ui, context->render)); |  |  |  |   VK_RESULT(update_ui_string(temp, 0, 0, 0, context->ui, context->render)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   if(selected_region == NULL) { |  |  |  |   if(selected_region == NULL) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     snprintf( |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |         region_info_strs[1], |  |  |  |         temp, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         sizeof(region_info_strs[1]), |  |  |  |         sizeof(temp), | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         ""); |  |  |  |         ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |     VK_RESULT(update_ui_string(region_info_strs[1], 0, 0, 1, context->ui, context->render)); |  |  |  |     VK_RESULT(update_ui_string(temp, 0, 0, 1, context->ui, context->render)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     snprintf( |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |         region_info_strs[2], |  |  |  |         temp, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         sizeof(region_info_strs[2]), |  |  |  |         sizeof(temp), | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         ""); |  |  |  |         ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |     VK_RESULT(update_ui_string(region_info_strs[2], 0, 0, 2, context->ui, context->render)); |  |  |  |     VK_RESULT(update_ui_string(temp, 0, 0, 2, context->ui, context->render)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     snprintf( |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |         region_info_strs[3], |  |  |  |         temp, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         sizeof(region_info_strs[3]), |  |  |  |         sizeof(temp), | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         ""); |  |  |  |         ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |     VK_RESULT(update_ui_string(region_info_strs[3], 0, 0, 3, context->ui, context->render)); |  |  |  |     VK_RESULT(update_ui_string(temp, 0, 0, 3, context->ui, context->render)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   } else { |  |  |  |   } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |     snprintf( |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |         region_info_strs[1], |  |  |  |         temp, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         sizeof(region_info_strs[1]), |  |  |  |         sizeof(temp), | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         "Q: %4d", selected_region->data.q); |  |  |  |         "Q: %4d", selected_region->data.q); | 
			
		
	
		
		
			
				
					
					|  |  |  |     VK_RESULT(update_ui_string(region_info_strs[1], 0, 0, 1, context->ui, context->render)); |  |  |  |     VK_RESULT(update_ui_string(temp, 0, 0, 1, context->ui, context->render)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     snprintf( |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |         region_info_strs[2], |  |  |  |         temp, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         sizeof(region_info_strs[2]), |  |  |  |         sizeof(temp), | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         "R: %4d", selected_region->data.r); |  |  |  |         "R: %4d", selected_region->data.r); | 
			
		
	
		
		
			
				
					
					|  |  |  |     VK_RESULT(update_ui_string(region_info_strs[2], 0, 0, 2, context->ui, context->render)); |  |  |  |     VK_RESULT(update_ui_string(temp, 0, 0, 2, context->ui, context->render)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     snprintf( |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |         region_info_strs[3], |  |  |  |         temp, | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         sizeof(region_info_strs[3]), |  |  |  |         sizeof(temp), | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         "Y: %4d", selected_region->data.y); |  |  |  |         "Y: %4d", selected_region->data.y); | 
			
		
	
		
		
			
				
					
					|  |  |  |     VK_RESULT(update_ui_string(region_info_strs[3], 0, 0, 3, context->ui, context->render)); |  |  |  |     VK_RESULT(update_ui_string(temp, 0, 0, 3, context->ui, context->render)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   return VK_SUCCESS; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | VkResult update_hex_info_ui(ClientContext* context) {  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   char temp[20]; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   VkResult result; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   HexRegion* region = context->hex->regions[context->hex->data.clicked_region]; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   snprintf(temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       "Hex %d-%d.%d", | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       context->hex->data.clicked_region, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       context->hex->data.clicked_hex, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       context->hex->data.clicked_vertex); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   VK_RESULT(update_ui_string(temp, 1, 0, 0, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   if(region == NULL) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     VK_RESULT(update_ui_string(temp, 1, 0, 1, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     VK_RESULT(update_ui_string(temp, 1, 0, 2, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     VK_RESULT(update_ui_string(temp, 1, 0, 3, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     VK_RESULT(update_ui_string(temp, 1, 0, 4, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     VK_RESULT(update_ui_string(temp, 1, 0, 5, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     VK_RESULT(update_ui_string(temp, 1, 0, 6, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     GPUHex* hex = ®ion->data.hexes[context->hex->data.clicked_hex]; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         "%02.02f %02.02f %02.02f", | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         hex->height[0], hex->height[1], hex->height[2]); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     VK_RESULT(update_ui_string(temp, 1, 0, 1, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         "%02.02f %02.02f %02.02f", | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         hex->height[3], hex->height[4], hex->height[5]); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     VK_RESULT(update_ui_string(temp, 1, 0, 2, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         "%08X", | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         hex->color[0]); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     VK_RESULT(update_ui_string(temp, 1, 0, 3, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         "%08X %08X", | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         hex->color[1], hex->color[2]); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     VK_RESULT(update_ui_string(temp, 1, 0, 4, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         "%08X %08X", | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         hex->color[3], hex->color[4]); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     VK_RESULT(update_ui_string(temp, 1, 0, 5, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     snprintf( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         temp, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         sizeof(temp), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         "%08X %08X", | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         hex->color[5], hex->color[6]); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     VK_RESULT(update_ui_string(temp, 1, 0, 6, context->ui, context->render)); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   return VK_SUCCESS; |  |  |  |   return VK_SUCCESS; | 
			
		
	
	
		
		
			
				
					|  |  | @ -231,6 +401,7 @@ VkResult main_thread(ClientContext* context) { | 
			
		
	
		
		
			
				
					
					|  |  |  |   VkResult result; |  |  |  |   VkResult result; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   VK_RESULT(region_info_ui(context)); |  |  |  |   VK_RESULT(region_info_ui(context)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   VK_RESULT(hex_info_ui(context)); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   //
 |  |  |  |   //
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   double last_frame_time = 0; |  |  |  |   double last_frame_time = 0; | 
			
		
	
	
		
		
			
				
					|  |  | @ -247,6 +418,15 @@ VkResult main_thread(ClientContext* context) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     glfwPollEvents(); |  |  |  |     glfwPollEvents(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if(context->last_clicked_region != context->hex->data.clicked_region || | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |        context->last_clicked_hex != context->hex->data.clicked_hex || | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |        context->last_clicked_vertex != context->hex->data.clicked_vertex) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       context->last_clicked_region = context->hex->data.clicked_region; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       context->last_clicked_hex = context->hex->data.clicked_hex; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       context->last_clicked_vertex = context->hex->data.clicked_vertex; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       update_hex_info_ui(context); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     if(context->selected_region != context->last_selected_region) { |  |  |  |     if(context->selected_region != context->last_selected_region) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       context->last_selected_region = context->selected_region; |  |  |  |       context->last_selected_region = context->selected_region; | 
			
		
	
		
		
			
				
					
					|  |  |  |       update_region_info_ui(context); |  |  |  |       update_region_info_ui(context); | 
			
		
	
	
		
		
			
				
					|  |  | @ -524,6 +704,7 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod | 
			
		
	
		
		
			
				
					
					|  |  |  |             sizeof(float), |  |  |  |             sizeof(float), | 
			
		
	
		
		
			
				
					
					|  |  |  |             context->render->current_frame, |  |  |  |             context->render->current_frame, | 
			
		
	
		
		
			
				
					
					|  |  |  |             context->render); |  |  |  |             context->render); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         update_hex_info_ui(context); | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     break; |  |  |  |     break; | 
			
		
	
	
		
		
			
				
					|  |  | @ -542,6 +723,7 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod | 
			
		
	
		
		
			
				
					
					|  |  |  |             sizeof(float), |  |  |  |             sizeof(float), | 
			
		
	
		
		
			
				
					
					|  |  |  |             context->render->current_frame, |  |  |  |             context->render->current_frame, | 
			
		
	
		
		
			
				
					
					|  |  |  |             context->render); |  |  |  |             context->render); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         update_hex_info_ui(context); | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     break; |  |  |  |     break; | 
			
		
	
	
		
		
			
				
					|  |  | @ -646,6 +828,8 @@ int main() { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     .selected_region = MAX_LOADED_REGIONS, |  |  |  |     .selected_region = MAX_LOADED_REGIONS, | 
			
		
	
		
		
			
				
					
					|  |  |  |     .last_selected_region = 0, |  |  |  |     .last_selected_region = 0, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     .last_clicked_region = MAX_LOADED_REGIONS, | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |   }; | 
			
		
	
		
		
			
				
					
					|  |  |  |   if(context.window == NULL || context.render == NULL || context.ui == NULL || context.hex == NULL) { |  |  |  |   if(context.window == NULL || context.render == NULL || context.ui == NULL || context.hex == NULL) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     return VK_ERROR_OUT_OF_HOST_MEMORY; |  |  |  |     return VK_ERROR_OUT_OF_HOST_MEMORY; | 
			
		
	
	
		
		
			
				
					|  |  | 
 |