bool NodeRectangle::mouseDown( MouseEvent event )
{
	// check if mouse is inside node (convert from screen space to object space)
	vec2 pt = screenToObject( event.getPos() );
	if( !getBounds().contains( pt ) )
		return false;

	// The event specifies the mouse coordinates in screen space,
	// and our node position is specified in parent space. So, transform coordinates
	// from one space to the other using the built-in methods.
	mCurrentMouse = screenToParent( event.getPos() ) - getPosition();
	mInitialMouse = mCurrentMouse;

	mInitialPosition = getPosition();
	mInitialRotation = getRotation();
	mInitialScale = getScale();

	// drag if clicked with left, scale and rotate if clicked with right
	if( event.isLeftDown() && !event.isShiftDown() )
		mTouchMode = DRAGGING;
	else if( event.isRightDown() || ( event.isLeftDown() && event.isShiftDown() ) )
		mTouchMode = RESIZING;

	return true;
}
Beispiel #2
0
void winBodiesApp::mouseDown( MouseEvent event )
{	
	if( event.isLeftDown() && !event.isAltDown() ) {
		int sizex = (rand()%49)+30;
		int sizey = (rand()%49)+30;
		int sizez = (rand()%49)+30;
		int height = (rand()%200)+300;
		int xoff = (rand()%10)-5;
		int zoff = (rand()%10)-5;
		
		Vec3f dimensions = Vec3f(sizex,sizey,sizez);
		btRigidBody *body = bullet::createBox(m_dynamicsWorld, dimensions, Quatf(), Vec3f((float)xoff, height, (float)zoff));
		
		std::shared_ptr<RigidObject> c( new RigidCube(body, dimensions, m_dynamicsWorld) );
		mObjects.push_back(c);
		
	} 
	
	if (event.isLeftDown() && event.isAltDown()) {
		int radius = (rand()%29)+15;
		int height = (rand()%200)+300;
		int xoff = (rand()%10)-5;
		int zoff = (rand()%10)-5;
		
		float fradius = (float) radius;
		btRigidBody *body = bullet::createSphere(m_dynamicsWorld, fradius, Quatf(), Vec3f(float(xoff), height,float(zoff)));
		
		std::shared_ptr<RigidObject> s( new RigidSphere(body, fradius, m_dynamicsWorld) );
		mObjects.push_back(s);
	}

}
void ProceduralAnimApp::mouseDrag( MouseEvent event )
{
	// Added support for international mac laptop keyboards.
	bool middle = event.isMiddleDown() || ( event.isMetaDown() && event.isLeftDown() );
	bool right = event.isRightDown() || ( event.isControlDown() && event.isLeftDown() );
	mMayaCam.mouseDrag( event.getPos(), event.isLeftDown() && !middle && !right, middle, right );
}
void _TBOX_PREFIX_App::mouseDrag( MouseEvent event )
{
	mMousePos = event.getPos();
	
	// Added/hacked support for international mac laptop keyboards.
	bool middle = event.isMiddleDown() || ( event.isMetaDown() && event.isLeftDown() );
	bool right = event.isRightDown() || ( event.isControlDown() && event.isLeftDown() );
	mMayaCam.mouseDrag( event.getPos(), event.isLeftDown() && !middle && !right, middle, right );}
void MarionetteZooApp::mouseDrag( MouseEvent event )
{
	if ( mCameraLock )
		mBulletWorld->mouseDrag( event, mMayaCam.getCamera() );
	else
		mMayaCam.mouseDrag( event.getPos(), event.isLeftDown(), event.isMiddleDown(), event.isRightDown() );
}
Beispiel #6
0
void ObjLoaderApp::mouseDrag( MouseEvent event )
{
	if( event.isAltDown() )
		mMayaCam.mouseDrag( event.getPos(), event.isLeftDown(), event.isMiddleDown(), event.isRightDown() );
	else
		mArcball.mouseDrag( event.getPos() );
}
void FadeCandyClientApp::mouseDrag( MouseEvent event )
{
	// keep track of the mouse
	mMousePos = event.getPos();

	// let the camera handle the interaction
	mMayaCam.mouseDrag( event.getPos(), event.isLeftDown(), event.isMiddleDown(), event.isRightDown() );
}
void ThisFloatingTrackerApp::mouseDrag(MouseEvent event)
{
    updateMouseGlobals(event);
    if (g.enable3dView)
    {
        g.cam3d.mouseDrag(event.getPos(), event.isLeftDown(), event.isMiddleDown(), event.isRightDown());
    }
}
Beispiel #9
0
void NanoApp::mouseDrag (MouseEvent event)
{
   mousePos = event.getPos();
   // don't update cameraUI if we're using the gui
   if (!usingGui)
      cameraUI.mouseDrag (event.getPos(), event.isLeftDown(), event.isMiddleDown(), event.isRightDown());
   gui->mouseDrag (event);
}
	void mouseDown( MouseEvent event )
	{
		if (event.isLeftDown()) {
			mSelectionMode = 1; // 選択開始
			mSelectRegion.set(event.getX()-5, event.getY()-5, event.getX()+5, event.getY()+5);
		}

		mMPPrev = event.getPos();
	}
void GeometryPlotterApp::mouseDrag (MouseEvent event)
{
    m_mousePos = event.getPos ();

    if (!m_gui.isMouseOver ())
    {
        m_mayaCam.mouseDrag (event.getPos (), event.isLeftDown (), event.isMiddleDown (), event.isRightDown ());
    }
}
void StereoscopicRenderingApp::mouseDrag( MouseEvent event )
{
	// handle camera
	mMayaCam.mouseDrag( event.getPos(), event.isLeftDown(), event.isMiddleDown(), event.isRightDown() );
	
	// update stereoscopic camera
	mCamera.setEyePoint( mMayaCam.getCamera().getEyePoint() );
	mCamera.setCenterOfInterestPoint( mMayaCam.getCamera().getCenterOfInterestPoint() );
}
void Genetic_AlgorithmApp::mouseDown(MouseEvent event)
{
    if (m_isStarted && !m_isPaused)
    {
        if (event.isLeftDown())
        {
            m_isBuilder = true;
        }
    }
}
Beispiel #14
0
	void mouseDown( MouseEvent event )
	{		
		if( event.isLeftDown() ) {
			int size = Rand::randInt(1,50);
			int height = Rand::randInt(200,500);
			BulletCube * cube = new BulletCube(dynamicsWorld, size, height);
			cube->create();
			mCubes.push_back(cube);
		}
	}
//When user clicks left button of mouse, draw flowers that painted in different color--> implement stretch goal J
void RoyalSociety_jiangy9LucyApp::mouseDown( MouseEvent event )
{
	gl::enableAlphaBlending();
	if(event.isLeftDown()){
		Flower* addFlower = new Flower();
		addFlower->set((*mySurface).getData(),(float)event.getX(),(float)event.getY(), addFlowerColor);
		insertAfter(first_item->previous,addFlower);
		click++;
	}
}
Beispiel #16
0
void StarsApp::mouseDrag( MouseEvent event )
{
	mCursorPos += event.getPos() - mCursorPrevious;
	mCursorPrevious = event.getPos();

	constrainCursor( event.getPos() );

	// allow user to control camera
	mCamera.mouseDrag( mCursorPos, event.isLeftDown(), event.isMiddleDown(), event.isRightDown() );
}
void ResultScreen::mouseEvents(int type )
{
	if(_game->freezeLocation) return;

	MouseEvent event = _game->getMouseEvent();

	if (event.isLeftDown() && !returnTimer.isStopped())
	{	
		comeBackTimerStart();
	}
}
void GeometryPlotterApp::mouseDown (MouseEvent event)
{
    if (event.isLeftDown ())
    {
        m_mousePressed = true;
    }

    std::cout << "Mouse Down" << std::endl;
    
    m_mayaCam.mouseDown (event.getPos ());
}
	void mouseDrag( MouseEvent event ) 
	{
		if (mEditMode == EditMode_RECORD) return;

		// 制御点の選択を行う
		if (event.isLeftDown()) {
			if (mSelectionMode == 0) return;

			float x1 = mSelectRegion.getX1();
			float y1 = mSelectRegion.getY1();
			mSelectRegion.set(x1, y1, event.getX()+5, event.getY()+5);

			for (int k = 0; k < mCtrlPointsNum; ++k) {
				if (mSelectRegion.contains(mCtrlPoints[k].pos)) {
					mCtrlPoints[k].isSelected = true;
				} else {
					mCtrlPoints[k].isSelected = false;
				}
			}
		}

		Vec2f d = event.getPos() - mMPPrev;	

		if (event.isRightDown()) {
			for (int k = 0; k < mCtrlPointsNum; ++k) {
				if (mCtrlPoints[k].isSelected) {
					mCtrlPoints[k].mag += d;
				}
			}
		}

		if (event.isMiddleDown()) {
			int ci = -1;
			int cj = -1;
			float nearest = 1.e+10;
			for (int j = 0; j < 2; ++j) {	
				for (int i = 0; i < 2; ++i) {
					Vec2f cp(distpoints[j][i][0], distpoints[j][i][1]);
					float dist = event.getPos().distance(cp);
					if (dist < nearest) {
						ci = i;
						cj = j;
						nearest = dist;
					}
				}
			}

			if (ci > -1 &&  cj > -1) {
				distpoints[cj][ci][0] += d.x;
				distpoints[cj][ci][1] += d.y;
			}
		}
		mMPPrev = event.getPos();
	}
void wellingtonModelApp::mouseDrag(MouseEvent event)
{
//    /*
    mouseMove(event);
    
    if( event.isAltDown() )
		mMayaCam.mouseDrag( event.getPos(), event.isLeftDown(), event.isMiddleDown(), event.isRightDown() );
	else
		mArcball.mouseDrag( event.getPos() );
//     */
}
void brammejd_HW02App::mouseDown( MouseEvent event )
{	
	//Delete() method is called if the left mouse button is clicked
	if(event.isLeftDown()){
		Delete(sentinel->next);
		//deleteShape(event.getX(), event.getY());
	}
	//reverseList() method is called if the right mouse button is clicked
	if(event.isRightDown()){
		reverseList(sentinel);
	}
}
Beispiel #22
0
void Fluid2DCamAppApp::mouseDrag( MouseEvent event )
{
	float x = (event.getX()/(float)getWindowWidth())*mFluid2D.resX();
	float y = (event.getY()/(float)getWindowHeight())*mFluid2D.resY();	
	
	if( event.isLeftDown() ) {
		Vec2f dv = event.getPos() - mPrevPos;
		mFluid2D.splatVelocity( x, y, mVelScale*dv );
		mFluid2D.splatDensity( x, y, mDenScale );
	}

	mPrevPos = event.getPos();
}
Beispiel #23
0
void ITA_ForcesApp::mouseDown(MouseEvent event)
{
	if (mMouseInput)
	{
		mIdle = false;
		if (event.isLeftDown())
			mForceMode = FORCE_A;

		else if (event.isRightDown())
			mForceMode = FORCE_R;
		mouseDrag(event);
	}
}
Beispiel #24
0
void Mouse_Event::PushButton(MouseEvent& mouse_event)
{
	if (mouse_event.isLeftDown())
	{
		mouse_status->push_mouse_button.insert(MouseEvent::LEFT_DOWN);
		mouse_status->press_mouse_button.insert(MouseEvent::LEFT_DOWN);
	}

	if (mouse_event.isRightDown())
	{
		mouse_status->push_mouse_button.insert(MouseEvent::RIGHT_DOWN);
		mouse_status->press_mouse_button.insert(MouseEvent::RIGHT_DOWN);
	}
}
Beispiel #25
0
//----------------------------------------------------------------------------------------------------------------------
void View::mouseDrag(MouseEvent event)
{
  // gui
  //if(!gui.isOn())
  {
    // keep track of the mouse
    m_mouse = event.getPos();

    // let the camera handle the interaction
    m_cam3d.mouseDrag( event.getPos(), event.isLeftDown(), event.isMiddleDown(), event.isRightDown() ); 
  }
  
  m_scene2d.onMouseDrag(event);  
}
void ThisFloatingTrackerApp::updateMouseGlobals(MouseEvent event)
{
    g.mouseLeft = event.isLeftDown();
    g.mouseMiddle = event.isMiddleDown();
    g.mouseRight = event.isRightDown();
    g.mouseDeltaWindowCoordinates = event.getPos() - g.mouseWindowCoordinates;
    g.mouseWindowCoordinates = event.getPos();
    float mx = event.getX() / float(getWindowWidth());
    float my = event.getY() / float(getWindowHeight());
    g.dmx = (g.mx - mx) / g.dt;
    g.dmy = (g.my - my) / g.dt;
    g.mx = mx;
    g.my = my;

}
Beispiel #27
0
void Fluid2DTextureApp::mouseDrag( MouseEvent event )
{
	float x = (event.getX()/(float)getWindowWidth())*mFluid2D.resX();
	float y = (event.getY()/(float)getWindowHeight())*mFluid2D.resY();	
	
	if( event.isLeftDown() ) {
		vec2 dv = vec2( event.getPos() ) - mPrevPos;
		mFluid2D.splatVelocity( x, y, mVelScale*dv );
		if( mFluid2D.isBuoyancyEnabled() ) {
			mFluid2D.splatDensity( x, y, mDenScale );
		}
	}
	
	mPrevPos = event.getPos();
}
Beispiel #28
0
void  HW2::mouseDown( MouseEvent event ) {

	Node* shape = new Node();

	if (event.isLeftDown()) {
		shape->shape_= new Shape();
		shape->shape_->x_=event.getX();
		shape->shape_->y_=event.getY();
		linked_list->popOn(shape);
	}
	if (event.isRightDown()) {
		linked_list->popOff(linked_list->getEnd());
	}

	//node->shape_->x_=50;
	//node->shape_->y_=50;
	//node->insertAfter(linked_list);


	/*if(event.isLeftDown()) {
		circle->x_ = event.getX();
		circle->y_ = event.getY();
	}*/

	//linked_list->insertAfter(new Node(circle));

	/*mouse_click = 1;

	circle->circle(event.getX(),event.getY());
	node = new Node(circle);

	if(event.isLeftDown()) {
		linked_list->insertAfter(node);
		linked_list->drawList(event.getX(),event.getY());
	}*/

	/*Shape* shape_ = new Shape();

	if(event.isLeftDown()) {
		shape_->circle(event.getX(),event.getY());
	}

	linked_list->popOn(new Node(shape_));
	*/



}
void Fluid2DParticleSoupApp::mouseDrag( MouseEvent event )
{
	float x = (event.getX()/(float)getWindowWidth())*mFluid2D.resX();
	float y = (event.getY()/(float)getWindowHeight())*mFluid2D.resY();	
	
	if( event.isLeftDown() ) {
		Vec2f dv = event.getPos() - mPrevPos;
		mFluid2D.splatVelocity( x, y, mVelScale*dv );
		mFluid2D.splatRgb( x, y, mRgbScale*mColor );
		if( mFluid2D.isBuoyancyEnabled() ) {
			mFluid2D.splatDensity( x, y, mDenScale );
		}
	}
	
	mPrevPos = event.getPos();
}
Beispiel #30
0
void triMeshApp::mouseDown( MouseEvent event )
{	
	if( event.isLeftDown() && !event.isAltDown() ) {
		int sizex = (rand()%49)+30;
		int sizey = (rand()%49)+30;
		int sizez = (rand()%49)+30;
		int height = (rand()%200)+300;
		int xoff = (rand()%1000)-500;
		int zoff = (rand()%1000)-500;
		
		Vec3f dimensions = Vec3f(sizex,sizey,sizez);
		btRigidBody *body = bullet::createBox(m_dynamicsWorld, dimensions, Quatf(), Vec3f((float)xoff, height, (float)zoff));
		
		shared_ptr<RigidObject> c( new RigidCube(body, dimensions, m_dynamicsWorld) );
		mObjects.push_back(c);
		
	} 
}