void GameEntity::Input()
{ 
	  if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_W))
        {
			SetAnimation("LookUp",ONCE);
			SwapUVs(UP);
			
	  }
	  if 
		  (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_A))
        {
			SetAnimation("Run",LOOP);
			SwapUVs(LEFT);
                m_v3Position -= Vector3(1.f, 0.0f, 0.0f);
        }

        if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_S))
        {
			SetAnimation("Duck",LOOP);
			SwapUVs(DOWN);
			m_v3Position += Vector3(0.0f, -1.f, 0.0f);
		}

		if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_D))
			{
				if(FacingCheck("RIGHT") != true) // if the sprite isn't already facing right..
					{
					SetAnimation("TurnAround", ONCE); //Set the animation to turn around...
					SwapUVs(RIGHT); //Swap UV's to flip the sprite...
					iFacing = "Right"; // Sets the facing flag to Right.
						if (currentAnimation !="Run")
						{
							SetAnimation("Run",LOOP);
							m_v3Position += Vector3(1.f, 0.0f, 0.0f);
						}
					}
				else
					SwapUVs(RIGHT);
					 m_v3Position += Vector3(1.f, 0.0f, 0.0f);
        }

		if (GLFW_PRESS	== glfwGetKey(GameWindow, GLFW_KEY_SPACE))
		{
			//if(this->Hitbox.CheckGrounded)
		}
	

		 if (GLFW_PRESS == glfwGetKey(GameWindow, GLFW_KEY_V))
        {
			
               SetColor(
				   Vector4((rand()%255)/255.f,(rand()%255)/255.f,(rand()%255)/255.f,1.f),
				   Vector4((rand()%255)/255.f,(rand()%255)/255.f,(rand()%255)/255.f,1.f),
				   Vector4((rand()%255)/255.f,(rand()%255)/255.f,(rand()%255)/255.f,1.f),
				   Vector4((rand()%255)/255.f,(rand()%255)/255.f,(rand()%255)/255.f,1.f)
				   );

        }
}
static void RotateUVThrough(TransformedVertex v[4]) {
    float x1 = v[2].x;
    float x2 = v[0].x;
    float y1 = v[2].y;
    float y2 = v[0].y;

    if ((x1 < x2 && y1 > y2) || (x1 > x2 && y1 < y2))
        SwapUVs(v[1], v[3]);
}
static void RotateUV(TransformedVertex v[4], float flippedMatrix[16], float ySign) {
	// Transform these two coordinates to figure out whether they're flipped or not.
	Vec4f tl;
	Vec3ByMatrix44(tl.AsArray(), v[2].pos, flippedMatrix);

	Vec4f br;
	Vec3ByMatrix44(br.AsArray(), v[0].pos, flippedMatrix);

	const float invtlw = 1.0f / tl.w;
	const float invbrw = 1.0f / br.w;
	const float x1 = tl.x * invtlw;
	const float x2 = br.x * invbrw;
	const float y1 = tl.y * invtlw * ySign;
	const float y2 = br.y * invbrw * ySign;

	if ((x1 < x2 && y1 < y2) || (x1 > x2 && y1 > y2))
		SwapUVs(v[1], v[3]);
}