|  |  |  | @ -30,6 +30,8 @@ typedef struct ClientContextStruct { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   vec3    position; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   vec3    velocity; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   vec2    rotation; | 
		
	
		
			
				|  |  |  |  |   int32_t key_spin[2]; | 
		
	
		
			
				|  |  |  |  |   vec2    cur_spin; | 
		
	
	
		
			
				
					|  |  |  | @ -41,6 +43,7 @@ typedef struct ClientContextStruct { | 
		
	
		
			
				|  |  |  |  |   float   key_spin_speed; | 
		
	
		
			
				|  |  |  |  |   float   cur_spin_speed; | 
		
	
		
			
				|  |  |  |  |   float   zoom_speed; | 
		
	
		
			
				|  |  |  |  |   float   move_speed; | 
		
	
		
			
				|  |  |  |  | } ClientContext; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | void* network_thread(void* data) { | 
		
	
	
		
			
				
					|  |  |  | @ -131,9 +134,12 @@ VkResult main_thread(ClientContext* context) { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     glfwPollEvents(); | 
		
	
		
			
				|  |  |  |  |     if((context->key_spin[0] != 0 || context->key_spin[1] != 0 || | 
		
	
		
			
				|  |  |  |  |        context->velocity[0] != 0 || context->velocity[1] != 0 || context->velocity[2] != 0 || | 
		
	
		
			
				|  |  |  |  |        context->zoom != 0 || | 
		
	
		
			
				|  |  |  |  |        context->cur_spin[0] != 0 || context->cur_spin[1] != 0 || | 
		
	
		
			
				|  |  |  |  |        context->render->framebuffer_recreated == true) && frame > 0) { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       if(context->render->framebuffer_recreated == true) { | 
		
	
		
			
				|  |  |  |  |         context->render->framebuffer_recreated = false; | 
		
	
		
			
				|  |  |  |  |         VK_RESULT(update_hex_proj(context->render, context->hex)); | 
		
	
	
		
			
				
					|  |  |  | @ -155,6 +161,14 @@ VkResult main_thread(ClientContext* context) { | 
		
	
		
			
				|  |  |  |  |         context->rotation[1] = 0; | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       context->position[0] += - context->velocity[2]*context->move_speed*cos(context->rotation[0]) | 
		
	
		
			
				|  |  |  |  |                             - context->velocity[0]*context->move_speed*sin(context->rotation[0]); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       context->position[2] += context->velocity[0]*context->move_speed*cos(context->rotation[0]) | 
		
	
		
			
				|  |  |  |  |                             - context->velocity[2]*context->move_speed*sin(context->rotation[0]); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       context->position[1] += context->velocity[1]*context->move_speed; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       context->distance += context->zoom*delta_time*context->zoom_speed; | 
		
	
		
			
				|  |  |  |  |       if(context->distance < 1) { | 
		
	
		
			
				|  |  |  |  |         context->distance = 1; | 
		
	
	
		
			
				
					|  |  |  | @ -216,6 +230,51 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod | 
		
	
		
			
				|  |  |  |  |       context->key_spin[1] += 1; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_UP: | 
		
	
		
			
				|  |  |  |  |     if(action == GLFW_PRESS) { | 
		
	
		
			
				|  |  |  |  |       context->velocity[2] += 1; | 
		
	
		
			
				|  |  |  |  |     } else if(action == GLFW_RELEASE) { | 
		
	
		
			
				|  |  |  |  |       context->velocity[2] -= 1; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_DOWN: | 
		
	
		
			
				|  |  |  |  |     if(action == GLFW_PRESS) { | 
		
	
		
			
				|  |  |  |  |       context->velocity[2] -= 1; | 
		
	
		
			
				|  |  |  |  |     } else if(action == GLFW_RELEASE) { | 
		
	
		
			
				|  |  |  |  |       context->velocity[2] += 1; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_LEFT: | 
		
	
		
			
				|  |  |  |  |     if(action == GLFW_PRESS) { | 
		
	
		
			
				|  |  |  |  |       context->velocity[0] -= 1; | 
		
	
		
			
				|  |  |  |  |     } else if(action == GLFW_RELEASE) { | 
		
	
		
			
				|  |  |  |  |       context->velocity[0] += 1; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_RIGHT: | 
		
	
		
			
				|  |  |  |  |     if(action == GLFW_PRESS) { | 
		
	
		
			
				|  |  |  |  |       context->velocity[0] += 1; | 
		
	
		
			
				|  |  |  |  |     } else if(action == GLFW_RELEASE) { | 
		
	
		
			
				|  |  |  |  |       context->velocity[0] -= 1; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_LEFT_SHIFT: | 
		
	
		
			
				|  |  |  |  |     if(action == GLFW_PRESS) { | 
		
	
		
			
				|  |  |  |  |       context->velocity[1] -= 1; | 
		
	
		
			
				|  |  |  |  |     } else if(action == GLFW_RELEASE) { | 
		
	
		
			
				|  |  |  |  |       context->velocity[1] += 1; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  |   case GLFW_KEY_SPACE: | 
		
	
		
			
				|  |  |  |  |     if(action == GLFW_PRESS) { | 
		
	
		
			
				|  |  |  |  |       context->velocity[1] += 1; | 
		
	
		
			
				|  |  |  |  |     } else if(action == GLFW_RELEASE) { | 
		
	
		
			
				|  |  |  |  |       context->velocity[1] -= 1; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     break; | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -313,6 +372,7 @@ int main() { | 
		
	
		
			
				|  |  |  |  |     .key_spin_speed = 1.0, | 
		
	
		
			
				|  |  |  |  |     .cur_spin_speed = 1.0, | 
		
	
		
			
				|  |  |  |  |     .zoom_speed = 1.0, | 
		
	
		
			
				|  |  |  |  |     .move_speed = 0.1, | 
		
	
		
			
				|  |  |  |  |   }; | 
		
	
		
			
				|  |  |  |  |   if(context.window == NULL || context.render == NULL || context.ui == NULL || context.hex == NULL) { | 
		
	
		
			
				|  |  |  |  |     return VK_ERROR_OUT_OF_HOST_MEMORY; | 
		
	
	
		
			
				
					|  |  |  | 
 |