Ejemplo n.º 1
0
bool AssetReloader::mouseDown( app::MouseEvent event )
{
    if( !bVisible )
        return false;
    
    if( mDragableRect.contains( event.getPos() - mPosition ) ){
        bDragging = true;
        mStartDragPos = event.getPos() - mPosition;
        return true;
    }
    
    return false;
}
		bool Sandbox::mouseDrag( app::MouseEvent event )
		{
			if(mMouseJoint){
				mMouseJoint->SetTarget( Conversions::toPhysics(event.getPos()) );
			}
			return false;
		}
		bool Sandbox::mouseDown( app::MouseEvent event )
		{
			if (mMouseJoint != NULL)
			{
				return false;
			}
			b2Vec2 p = Conversions::toPhysics( event.getPos() );
			// Make a small box.
			b2AABB aabb;
			b2Vec2 d;
			d.Set(0.001f, 0.001f);
			aabb.lowerBound = p - d;
			aabb.upperBound = p + d;

			// Query the world for overlapping shapes.
			QueryCallback callback(p);
			mWorld->QueryAABB(&callback, aabb);

			if (callback.m_fixture)
			{
				b2Body* body = callback.m_fixture->GetBody();
				b2MouseJointDef md;
				md.bodyA = mGroundBody;
				md.bodyB = body;
				md.target = p;
				md.maxForce = 1000.0f * body->GetMass();
				mMouseJoint = (b2MouseJoint*)mWorld->CreateJoint(&md);
				body->SetAwake(true);
			}

			return false;
		}
Ejemplo n.º 4
0
bool UIElement::mouseDown( app::MouseEvent event )
{	
	if (isPointIn(event.getPos()))
		_state = CLICK;
	else
		_state = NORMAL;
	return false;
}
Ejemplo n.º 5
0
bool UIElement::mouseMove( app::MouseEvent event )
{
	if (isPointIn(event.getPos()))
		_state = OVER;
	else
		_state = NORMAL;
	return false;
}
Ejemplo n.º 6
0
bool AssetReloader::mouseMove( app::MouseEvent event )
{
    if( !bVisible )
        return false;
    
    if( bDragging ){
        mPosition = event.getPos() - mStartDragPos;
        return true;
    }
    
    return false;
}
Ejemplo n.º 7
0
void CameraUi::mouseDrag( app::MouseEvent &event )
{
	bool isLeftDown = event.isLeftDown();
	bool isMiddleDown = event.isMiddleDown() || event.isAltDown();
	bool isRightDown = event.isRightDown() || event.isControlDown();

	if( isMiddleDown )
		isLeftDown = false;

	mouseDrag( event.getPos(), isLeftDown, isMiddleDown, isRightDown );
	event.setHandled();
}
Ejemplo n.º 8
0
void CameraUi::mouseUp( app::MouseEvent &event )
{
	mouseUp( event.getPos() );
	event.setHandled();
}