Ejemplo n.º 1
0
void GraphicsImpl::handleMouseEvents(const DataContainer& data)
{
	InputMouseEvent ev = boost::any_cast<InputMouseEvent>(data.data);
	static bool mouseButtonPressed = false;

	gui->injectMouseMove(ev.mouseX, ev.mouseY, 0);
	camera->yaw(Ogre::Degree(-ev.mouseDeltaX * 0.13));
	camera->pitch(Ogre::Degree(-ev.mouseDeltaY * 0.13));


	
		MyGUI::MouseButton id;

		if (ev.type == BUTTON_MOUSE_LEFT) {
			id = MyGUI::MouseButton::Left;
		}

		else if (ev.type == BUTTON_MOUSE_RIGHT) {
			id = MyGUI::MouseButton::Right;
		}

		else {
			id = MyGUI::MouseButton::Middle;
		}


		if (ev.action == BUTTON_PRESSED) {
			mouseButtonPressed = true;
			gui->injectMousePress(ev.mouseX, ev.mouseY, id);
		}

		else {
			mouseButtonPressed = false;
			gui->injectMouseRelease(ev.mouseX, ev.mouseY, id);
		}
	
}
Ejemplo n.º 2
0
	bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
	{
		mGUI->injectMouseRelease(arg, id);
		return true;
	}