예제 #1
0
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;
}
예제 #2
0
void VideoPanApp::mouseWheel( MouseEvent event )
{
	if( !event.isShiftDown() )
	{
		//mParticleController.setWidth( event.getWheelIncrement() );
	} else {
		//mMovie.stepForward();
	}
}
예제 #3
0
void TerrainApp::mouseWheel( MouseEvent event )
{
	float dWheel	= event.getWheelIncrement();
	
	if( event.isShiftDown() ){
		mZoomMultiDest += dWheel * 0.001f;
		mZoomMultiDest = constrain( mZoomMultiDest, 0.1f, 1.0f );
	} else {
		mRoom.adjustTimeMulti( dWheel );
	}
}
예제 #4
0
void DirectionSphericalTestApp::mouseDown( MouseEvent event )
{
	if ( event.isShiftDown() )
	{
		Vec3f t = sphericalToCartesian( mVectorTarget );
		mVectorTarget = cartesianToSpherical( -t );
	}
	else
	{
		mVectorTarget = Vec3f( 1.0f, Rand::randFloat( 0.0f, M_PI ), Rand::randFloat( -M_PI, M_PI ) );
	}
	mVectorSlerp = sphericalToCartesian( mVectorSpherical );
	mVectorQuat = mVectorSlerp;
}
예제 #5
0
/**
*This function contains the code which allows items to be 
*grouped (contain each other) and considered one item. 
*Releasing an item you are dragging over another item (while
*holding shift) makes the first item the second items child.
*This means that the first item can nolonger be iteracted with
*and that moving or reordering the second item will cause the
*same to happen to the first item. Any number of items can be 
*made children of an item but if you make an item with a child 
*a child that items child will disapear.
*
*This satisfies the "move range of items" requirement, goal F
*and the "ojects can contain objects" requirement, goal I
*/
void homework2App::mouseUp(MouseEvent event){
	if(event.isShiftDown()&&event.isLeft()&&selectedNode_!=NULL){
		ListNode* currentNode = headNode_;

		do{
			if(currentNode->shape_->
				isInside(selectedNode_->shape_->x_,
				selectedNode_->shape_->y_))
			{
				selectedNode_ = selectedNode_->removeNode();
				currentNode->addChild(selectedNode_);
				selectedNode_ = NULL;
				break;
			}
			currentNode = currentNode->next_;
		}while(currentNode!=headNode_);
	}
}