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; }
bool UIElement::mouseDown( app::MouseEvent event ) { if (isPointIn(event.getPos())) _state = CLICK; else _state = NORMAL; return false; }
bool UIElement::mouseMove( app::MouseEvent event ) { if (isPointIn(event.getPos())) _state = OVER; else _state = NORMAL; return false; }
bool AssetReloader::mouseMove( app::MouseEvent event ) { if( !bVisible ) return false; if( bDragging ){ mPosition = event.getPos() - mStartDragPos; return true; } return false; }
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(); }
void CameraUi::mouseUp( app::MouseEvent &event ) { mouseUp( event.getPos() ); event.setHandled(); }