|  |  |  | @ -15,191 +15,91 @@ typedef struct ClientContextStruct { | 
		
	
		
			
				|  |  |  |  |   UIContext ui; | 
		
	
		
			
				|  |  |  |  | } ClientContext; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | VkResult test_ui(RenderContext* gpu, UIContext* ui) { | 
		
	
		
			
				|  |  |  |  | void* network_thread(void* data) { | 
		
	
		
			
				|  |  |  |  |   ClientContext* context = (ClientContext*)data; | 
		
	
		
			
				|  |  |  |  |   (void)context; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   return NULL; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | VkResult main_thread(ClientContext* context) { | 
		
	
		
			
				|  |  |  |  |   VkResult result; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   GPUString context_strings[] = { | 
		
	
		
			
				|  |  |  |  |   GPUString strings[] = { | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |       .pos = {0, 32}, | 
		
	
		
			
				|  |  |  |  |       .size = 32, | 
		
	
		
			
				|  |  |  |  |       .color = {1.0, 1.0, 1.0, 1.0}, | 
		
	
		
			
				|  |  |  |  |       .offset = 0, | 
		
	
		
			
				|  |  |  |  |       .length = strlen("Example Text"), | 
		
	
		
			
				|  |  |  |  |       .length = 0, | 
		
	
		
			
				|  |  |  |  |       .font = 0, | 
		
	
		
			
				|  |  |  |  |     }, | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |       .pos = {0, 64}, | 
		
	
		
			
				|  |  |  |  |       .pos = {110, 138}, | 
		
	
		
			
				|  |  |  |  |       .size = 32, | 
		
	
		
			
				|  |  |  |  |       .color = {1.0, 1.0, 1.0, 1.0}, | 
		
	
		
			
				|  |  |  |  |       .offset = strlen("Example Text"), | 
		
	
		
			
				|  |  |  |  |       .length = strlen("Example Text"), | 
		
	
		
			
				|  |  |  |  |       .font = 1, | 
		
	
		
			
				|  |  |  |  |       .offset = 20, | 
		
	
		
			
				|  |  |  |  |       .length = 1, | 
		
	
		
			
				|  |  |  |  |       .font = 0, | 
		
	
		
			
				|  |  |  |  |     }, | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |       .pos = {0, 96}, | 
		
	
		
			
				|  |  |  |  |       .pos = {210, 138}, | 
		
	
		
			
				|  |  |  |  |       .size = 32, | 
		
	
		
			
				|  |  |  |  |       .color = {1.0, 1.0, 1.0, 1.0}, | 
		
	
		
			
				|  |  |  |  |       .offset = 2*strlen("Example Text"), | 
		
	
		
			
				|  |  |  |  |       .length = strlen("Example Text"), | 
		
	
		
			
				|  |  |  |  |       .font = 2, | 
		
	
		
			
				|  |  |  |  |     }, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   uint32_t context_codes[256]; | 
		
	
		
			
				|  |  |  |  |   map_string("Example Text", context_codes, 0, 0, ui); | 
		
	
		
			
				|  |  |  |  |   map_string("Example Text", context_codes, strlen("Example Text"), 1, ui); | 
		
	
		
			
				|  |  |  |  |   map_string("Example Text", context_codes, 2*strlen("Example Text"), 2, ui); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   LayerInput context_layers[] = { | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |       .num_strings = sizeof(context_strings)/sizeof(GPUString), | 
		
	
		
			
				|  |  |  |  |       .strings = context_strings, | 
		
	
		
			
				|  |  |  |  |       .num_codes = sizeof(context_codes)/sizeof(uint32_t), | 
		
	
		
			
				|  |  |  |  |       .codes = context_codes, | 
		
	
		
			
				|  |  |  |  |     }, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   ContainerInput context_info = { | 
		
	
		
			
				|  |  |  |  |     .id = 0x01, | 
		
	
		
			
				|  |  |  |  |     .anchor = ANCHOR_TOP_LEFT, | 
		
	
		
			
				|  |  |  |  |     .size = {WINDOW_MIN_WIDTH, WINDOW_MIN_HEIGHT}, | 
		
	
		
			
				|  |  |  |  |     .layer_count = sizeof(context_layers)/sizeof(LayerInput), | 
		
	
		
			
				|  |  |  |  |     .layers = context_layers, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   vec2 map_size = {250, 200}; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   GPUDrawable map_rects[] = { | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |       .pos = {0.0, 0.0}, | 
		
	
		
			
				|  |  |  |  |       .size = {map_size[0], map_size[1]}, | 
		
	
		
			
				|  |  |  |  |       .color = {0.0, 0.5,0.8, 1.0}, | 
		
	
		
			
				|  |  |  |  |       .type = 0, | 
		
	
		
			
				|  |  |  |  |     }, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   LayerInput map_layers[] = { | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |       .num_drawables = sizeof(map_rects)/sizeof(GPUDrawable), | 
		
	
		
			
				|  |  |  |  |       .drawables = map_rects, | 
		
	
		
			
				|  |  |  |  |       .offset = 21, | 
		
	
		
			
				|  |  |  |  |       .length = 1, | 
		
	
		
			
				|  |  |  |  |       .font = 0, | 
		
	
		
			
				|  |  |  |  |     }, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   ContainerInput map_info = { | 
		
	
		
			
				|  |  |  |  |     .id = 0x02, | 
		
	
		
			
				|  |  |  |  |     .anchor = ANCHOR_TOP_RIGHT, | 
		
	
		
			
				|  |  |  |  |     .size = {map_size[0], map_size[1]}, | 
		
	
		
			
				|  |  |  |  |     .layer_count = sizeof(map_layers)/sizeof(LayerInput), | 
		
	
		
			
				|  |  |  |  |     .layers = map_layers, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   vec2 inventory_size = {map_size[0], WINDOW_MIN_HEIGHT-map_size[1]}; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   GPUDrawable inventory_rects[] = { | 
		
	
		
			
				|  |  |  |  |   GPUDrawable drawables[] = { | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |       .pos = {0, 0}, | 
		
	
		
			
				|  |  |  |  |       .size = {inventory_size[0], inventory_size[1]}, | 
		
	
		
			
				|  |  |  |  |       .color = {0.5, 0.8, 0.0, 1.0}, | 
		
	
		
			
				|  |  |  |  |       .pos = {100, 100}, | 
		
	
		
			
				|  |  |  |  |       .size = {50, 50}, | 
		
	
		
			
				|  |  |  |  |       .color = {1, 0, 0, 1}, | 
		
	
		
			
				|  |  |  |  |       .type = 0, | 
		
	
		
			
				|  |  |  |  |       .id = 1, | 
		
	
		
			
				|  |  |  |  |     }, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   LayerInput inventory_layers[] = { | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |       .num_drawables = sizeof(inventory_rects)/sizeof(GPUDrawable), | 
		
	
		
			
				|  |  |  |  |       .drawables = inventory_rects, | 
		
	
		
			
				|  |  |  |  |     }, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   ContainerInput inventory_info = { | 
		
	
		
			
				|  |  |  |  |     .id = 0x03, | 
		
	
		
			
				|  |  |  |  |     .anchor = ANCHOR_BOTTOM_RIGHT, | 
		
	
		
			
				|  |  |  |  |     .size = {inventory_size[0], inventory_size[1]}, | 
		
	
		
			
				|  |  |  |  |     .layer_count = sizeof(inventory_layers)/sizeof(LayerInput), | 
		
	
		
			
				|  |  |  |  |     .layers = inventory_layers, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   vec2 chat_size = {WINDOW_MIN_WIDTH-inventory_size[0], 200}; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   GPUDrawable chat_rects[] = { | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |       .pos = {0, 0}, | 
		
	
		
			
				|  |  |  |  |       .size = {chat_size[0], chat_size[1]}, | 
		
	
		
			
				|  |  |  |  |       .color = {0.8, 0.0, 0.5, 1.0}, | 
		
	
		
			
				|  |  |  |  |       .pos = {200, 100}, | 
		
	
		
			
				|  |  |  |  |       .size = {50, 50}, | 
		
	
		
			
				|  |  |  |  |       .color = {0, 1, 0, 1}, | 
		
	
		
			
				|  |  |  |  |       .type = 0, | 
		
	
		
			
				|  |  |  |  |       .id = 2, | 
		
	
		
			
				|  |  |  |  |     }, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   LayerInput chat_layers[] = { | 
		
	
		
			
				|  |  |  |  |     { | 
		
	
		
			
				|  |  |  |  |       .num_drawables = sizeof(chat_rects)/sizeof(GPUDrawable), | 
		
	
		
			
				|  |  |  |  |       .drawables = chat_rects, | 
		
	
		
			
				|  |  |  |  |     }, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   ContainerInput chat_info = { | 
		
	
		
			
				|  |  |  |  |     .id = 0x04, | 
		
	
		
			
				|  |  |  |  |     .anchor = ANCHOR_BOTTOM_LEFT, | 
		
	
		
			
				|  |  |  |  |     .size = {chat_size[0], chat_size[1]}, | 
		
	
		
			
				|  |  |  |  |     .layer_count = sizeof(chat_layers)/sizeof(LayerInput), | 
		
	
		
			
				|  |  |  |  |     .layers = chat_layers, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   VK_RESULT(create_container(&context_info, gpu, ui)); | 
		
	
		
			
				|  |  |  |  |   VK_RESULT(create_container(&map_info, gpu, ui)); | 
		
	
		
			
				|  |  |  |  |   VK_RESULT(create_container(&inventory_info, gpu, ui)); | 
		
	
		
			
				|  |  |  |  |   VK_RESULT(create_container(&chat_info, gpu, ui)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   return VK_SUCCESS; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void* network_thread(void* data) { | 
		
	
		
			
				|  |  |  |  |   ClientContext* context = (ClientContext*)data; | 
		
	
		
			
				|  |  |  |  |   (void)context; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   return NULL; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | VkResult main_thread(ClientContext* context) { | 
		
	
		
			
				|  |  |  |  |   VkResult result; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   GPUString fps_string = { | 
		
	
		
			
				|  |  |  |  |     .pos = {0, 32}, | 
		
	
		
			
				|  |  |  |  |     .size = 32, | 
		
	
		
			
				|  |  |  |  |     .color = {1.0, 1.0, 1.0, 1.0}, | 
		
	
		
			
				|  |  |  |  |     .offset = 0, | 
		
	
		
			
				|  |  |  |  |     .length = 0, | 
		
	
		
			
				|  |  |  |  |     .font = 0, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  |   LayerInput layer = { | 
		
	
		
			
				|  |  |  |  |     .strings = strings, | 
		
	
		
			
				|  |  |  |  |     .num_strings = sizeof(strings)/sizeof(GPUString), | 
		
	
		
			
				|  |  |  |  |     .max_codes = 24, | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   LayerInput fps_layer = { | 
		
	
		
			
				|  |  |  |  |     .num_strings = 1, | 
		
	
		
			
				|  |  |  |  |     .strings = &fps_string, | 
		
	
		
			
				|  |  |  |  |     .max_codes = 1000, | 
		
	
		
			
				|  |  |  |  |     .drawables = drawables, | 
		
	
		
			
				|  |  |  |  |     .num_drawables = sizeof(drawables)/sizeof(GPUDrawable), | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   ContainerInput fps_container = { | 
		
	
		
			
				|  |  |  |  |   ContainerInput container = { | 
		
	
		
			
				|  |  |  |  |     .id = 1, | 
		
	
		
			
				|  |  |  |  |     .size = {200, 200}, | 
		
	
		
			
				|  |  |  |  |     .size = {WINDOW_MIN_WIDTH, WINDOW_MIN_HEIGHT}, | 
		
	
		
			
				|  |  |  |  |     .layer_count = 1, | 
		
	
		
			
				|  |  |  |  |     .layers = &fps_layer, | 
		
	
		
			
				|  |  |  |  |     .layers = &layer, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   create_container(&fps_container, &context->render, &context->ui); | 
		
	
		
			
				|  |  |  |  |   create_container(&container, &context->render, &context->ui); | 
		
	
		
			
				|  |  |  |  |   map_string("1234", context->ui.containers[0].layers[0].codes_buffer, 20, 0, &context->ui); | 
		
	
		
			
				|  |  |  |  |   VK_RESULT(add_transfers( | 
		
	
		
			
				|  |  |  |  |         &context->ui.containers[0].layers[0].codes_buffer[20], | 
		
	
		
			
				|  |  |  |  |         context->ui.containers[0].layers[0].codes, | 
		
	
		
			
				|  |  |  |  |         20*sizeof(uint32_t), | 
		
	
		
			
				|  |  |  |  |         4*sizeof(uint32_t), | 
		
	
		
			
				|  |  |  |  |         &context->render)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   //
 | 
		
	
		
			
				|  |  |  |  |   double last_draw = 0; | 
		
	
		
			
				|  |  |  |  |   double draw_interval = 0.25; | 
		
	
		
			
				|  |  |  |  |   uint32_t* mapped_codes = context->ui.containers[0].layers[0].codes_buffer; | 
		
	
		
			
				|  |  |  |  |   GPUString* mapped_string = context->ui.containers[0].layers[0].strings_buffer; | 
		
	
		
			
				|  |  |  |  |   char str[11] = "1234567890"; | 
		
	
		
			
				|  |  |  |  |   map_string(str, mapped_codes, 0, 0, &context->ui); | 
		
	
		
			
				|  |  |  |  |   VK_RESULT(add_transfers( | 
		
	
		
			
				|  |  |  |  |         context->ui.containers[0].layers[0].codes_buffer, | 
		
	
		
			
				|  |  |  |  |         context->ui.containers[0].layers[0].codes, | 
		
	
		
			
				|  |  |  |  |         0, | 
		
	
		
			
				|  |  |  |  |         10*sizeof(uint32_t), | 
		
	
		
			
				|  |  |  |  |         &context->render)); | 
		
	
		
			
				|  |  |  |  |   char str[21] = "1234567890"; | 
		
	
		
			
				|  |  |  |  |   uint32_t last_id = 0; | 
		
	
		
			
				|  |  |  |  |   uint32_t last_last_id = -1; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   int test = 0; | 
		
	
		
			
				|  |  |  |  |   //
 | 
		
	
	
		
			
				
					|  |  |  | @ -208,12 +108,19 @@ VkResult main_thread(ClientContext* context) { | 
		
	
		
			
				|  |  |  |  |     glfwPollEvents(); | 
		
	
		
			
				|  |  |  |  |     double frame_time = glfwGetTime(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     if((frame_time - last_draw) > draw_interval) { | 
		
	
		
			
				|  |  |  |  |     if(last_id != last_last_id) { | 
		
	
		
			
				|  |  |  |  |       last_last_id = last_id; | 
		
	
		
			
				|  |  |  |  |       test = (test + 1) % 7; | 
		
	
		
			
				|  |  |  |  |       mapped_string->length = test; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       last_draw = frame_time; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       snprintf(str, 21, "Last ID: %d", last_id); | 
		
	
		
			
				|  |  |  |  |       map_string(str, mapped_codes, 0, 0, &context->ui); | 
		
	
		
			
				|  |  |  |  |       VK_RESULT(add_transfers( | 
		
	
		
			
				|  |  |  |  |             context->ui.containers[0].layers[0].codes_buffer, | 
		
	
		
			
				|  |  |  |  |             context->ui.containers[0].layers[0].codes, | 
		
	
		
			
				|  |  |  |  |             0, | 
		
	
		
			
				|  |  |  |  |             strlen(str)*sizeof(uint32_t), | 
		
	
		
			
				|  |  |  |  |             &context->render)); | 
		
	
		
			
				|  |  |  |  |       mapped_string->length = strlen(str); | 
		
	
		
			
				|  |  |  |  |       VK_RESULT(add_transfers( | 
		
	
		
			
				|  |  |  |  |             &context->ui.containers[0].layers[0].strings_buffer[0].length, | 
		
	
		
			
				|  |  |  |  |             context->ui.containers[0].layers[0].strings, | 
		
	
	
		
			
				
					|  |  |  | @ -243,11 +150,24 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod | 
		
	
		
			
				|  |  |  |  |   (void)mods; | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | bool contains(double* point, GPUContainer* container, GPUDrawable* rect) { | 
		
	
		
			
				|  |  |  |  |   vec2 pos = { | 
		
	
		
			
				|  |  |  |  |     container->offset[0] + rect->pos[0], | 
		
	
		
			
				|  |  |  |  |     container->offset[1] + rect->pos[1], | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  |   return (point[0] >= pos[0] && point[0] <= pos[0] + rect->size[0]) && | 
		
	
		
			
				|  |  |  |  |          (point[1] >= pos[1] && point[1] <= pos[1] + rect->size[1]) && | 
		
	
		
			
				|  |  |  |  |          (point[0] >= container->offset[0] && point[0] <= container->offset[0] + container->size[0]) && | 
		
	
		
			
				|  |  |  |  |          (point[1] >= container->offset[1] && point[1] <= container->offset[1] + container->size[1]); | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) { | 
		
	
		
			
				|  |  |  |  |   ClientContext* context = (ClientContext*)glfwGetWindowUserPointer(window); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   (void)mods; | 
		
	
		
			
				|  |  |  |  |   (void)context; | 
		
	
		
			
				|  |  |  |  |   double cursor[2]; | 
		
	
		
			
				|  |  |  |  |   glfwGetCursorPos(window, &cursor[0], &cursor[1]); | 
		
	
		
			
				|  |  |  |  |   switch(button) { | 
		
	
		
			
				|  |  |  |  |   // Handle camera hover
 | 
		
	
		
			
				|  |  |  |  |   case GLFW_MOUSE_BUTTON_MIDDLE: | 
		
	
	
		
			
				
					|  |  |  | @ -259,6 +179,19 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  |   case GLFW_MOUSE_BUTTON_LEFT: | 
		
	
		
			
				|  |  |  |  |     if(action == GLFW_PRESS) { | 
		
	
		
			
				|  |  |  |  |       for(uint32_t c = context->ui.max_containers - 1; c >= 0; c--) { | 
		
	
		
			
				|  |  |  |  |         if(context->ui.containers[c].id == 0x00000000) { | 
		
	
		
			
				|  |  |  |  |           continue; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         for(uint32_t l = 0; l < context->ui.containers[c].layer_count; l++) { | 
		
	
		
			
				|  |  |  |  |           for(uint32_t d = 0; d < context->ui.containers[c].layers[l].data.num_drawables; d++) { | 
		
	
		
			
				|  |  |  |  |             if(contains(cursor, &context->ui.containers[c].data, &context->ui.containers[c].layers[l].drawables_buffer[d])) { | 
		
	
		
			
				|  |  |  |  |               fprintf(stderr, "hit\n"); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       // NOTE: this logic is the same as it would be for right-click(just with different outcomes), so dont repeat yourself
 | 
		
	
		
			
				|  |  |  |  |       // 1. Search through the UI context for the first element that the contains the mouse point
 | 
		
	
		
			
				|  |  |  |  |       // 2. If no UI element intersection, cast a ray through the world scene to find the "clicked entity" 
 | 
		
	
	
		
			
				
					|  |  |  | 
 |