[ create a new paste ] login | about

Link: http://codepad.org/mXiL5Rs7    [ raw code | fork ]

C++, pasted on Dec 9:
	QMouseController * mouse = new QMouseController(d->rootEntity);

	QLogicalDevice * mouseDevice = new QLogicalDevice(d->rootEntity);

	Qt3DInput::QAction * rotAction = new Qt3DInput::QAction();
	rotAction->setName("ROT");
	Qt3DInput::QActionInput * input = new Qt3DInput::QActionInput();
	input->setSourceDevice(mouse);
	input->setKeys(QVariantList() << QMouseController::Left << QMouseController::Right);
	rotAction->addInput(input);

	Qt3DInput::QAxis * axis = new Qt3DInput::QAxis();
	axis->setName("RX");
	Qt3DInput::QAxisInput * ainput = new Qt3DInput::QAxisInput();
	ainput->setSourceDevice(mouse);
	ainput->setAxis(QMouseController::X);
	axis->addInput(ainput);

	mouseDevice->addAction(rotAction);
	mouseDevice->addAxis(axis);

	Qt3DInput::QAxisActionHandler * cameraHandler = new Qt3DInput::QAxisActionHandler();
	cameraHandler->setLogicalDevice(mouseDevice);

	AgCameraController * controller = new AgCameraController(this);
	controller->setCamera(d->camera);

	QObject::connect(cameraHandler, SIGNAL(actionStarted(QString)), controller, SLOT(startAction(QString)));
	QObject::connect(cameraHandler, SIGNAL(actionFinished(QString)), controller, SLOT(finishAction(QString)));
	QObject::connect(cameraHandler, SIGNAL(axisValueChanged(QString,float)), controller, SLOT(changeAxisValue(QString,float)));

	d->camera->addComponent(cameraHandler);


Create a new paste based on this one


Comments: