Exemplo n.º 1
0
	void VehicleSim::mouse_move_callback(GLFWwindow* window, double x, double y)
	{
		// Get class instance
		VehicleSim* app = (VehicleSim*)glfwGetWindowUserPointer(window);
		Gwen::Controls::Canvas* canvas = app->_guiCanvas;
		common::Camera& cam = app->_camera;

		float height = (float)app->getHeight();

		// Calculate difference
		double oldX = app->_mouseX;
		double oldY = -app->_mouseY + height;
		double dx = x - app->_mouseX;
		double dy = y - app->_mouseY;
		app->_mouseX = x;
		app->_mouseY = y;

		// Update GUI
		canvas->InputMouseMoved((int)x, (int)y, (int)dx, (int)dy);

		// Update tools
		std::vector<Tool*>& tools = app->_tools;
		for (auto it = tools.begin(); it != tools.end(); ++it)
		{
			(*it)->mousemove_base(x, height - y, dx, dy);
		}
	}