本文整理汇总了C++中ci::app::MouseEvent::getPos方法的典型用法代码示例。如果您正苦于以下问题:C++ MouseEvent::getPos方法的具体用法?C++ MouseEvent::getPos怎么用?C++ MouseEvent::getPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ci::app::MouseEvent
的用法示例。
在下文中一共展示了MouseEvent::getPos方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseDown
void TouchDebug::mouseDown(const ci::app::MouseEvent& e) {
mReplicating = false;
if(e.isAltDown()) {
if(!mDropTouched){
mEngine.mouseTouchBegin(e, mTouchId + 2);
mDropTouched = true;
} else {
mEngine.mouseTouchEnded(e, mTouchId + 2);
mDropTouched = false;
}
} else if(e.isShiftDown()) {
mReplicating = true;
replicate(e, ds::ui::TouchInfo::Added);
} else if(e.isControlDown()){
if(mTwoTouching){
mTwoTouching = false;
} else {
mTwoTouching = true;
mTwoTouchDown = e.getPos();
}
} else if(mTwoTouching){
mEngine.mouseTouchBegin(e, mTouchId);
int deltaX = e.getPos().x - mTwoTouchDown.x;
int deltaY = e.getPos().y - mTwoTouchDown.y;
ci::app::MouseEvent mouseTwo = ci::app::MouseEvent(e.getWindow(), 0, mTwoTouchDown.x - deltaX, mTwoTouchDown.y - deltaY, e.getNativeModifiers(), e.getWheelIncrement(), e.getNativeModifiers());
mEngine.mouseTouchBegin(mouseTwo, mTouchId + 1);
} else {
mEngine.mouseTouchBegin(e, mTouchId);
}
}
示例2: mouseUp
void MultiSlider::mouseUp( ci::app::MouseEvent &event )
{
if( mHit ) {
#ifdef CINDER_COCOA_TOUCH
setState( State::NORMAL );
#else
if( isHit( event.getPos() ) ) {
setState( State::OVER );
std::string newKey = getKey( event.getPos() );
if( newKey != mHoverKey ) {
mHoverKey = newKey;
changeState();
setNeedsDisplay();
}
}
else {
setState( State::NORMAL );
}
#endif
if( (int)mTrigger & (int)Trigger::END ) {
trigger();
}
}
mHitKey = "";
mHit = false;
}
示例3: mouseDrag
bool Monitor::mouseDrag( ci::app::MouseEvent event )
{
switch( mMouseState )
{
case MS_NOTHING :
break;
case MS_MOVE :
{
Vec2i diff = event.getPos() - mPosMouseDrag;
mArea += diff;
mPosMouseDrag = event.getPos();
}
break;
case MS_RESIZE :
{
Vec2i diff = event.getPos() - mPosMouseDrag;
int width = math<int>::max( mArea.getWidth() + diff.x, mMinWidth );
int height = math<int>::max( mArea.getHeight() + diff.y, mMinHeight );
mArea.x2 = mArea.x1 + width;
mArea.y2 = mArea.y1 + height;
mPosMouseDrag = event.getPos();
}
break;
}
return mMouseState != MS_NOTHING;
}
示例4: mouseDownInternal
bool XRect::mouseDownInternal( ci::app::MouseEvent event )
{
bool hit = hitTest( event.getPos() );
if (hit && mScript)
mScript->call("mouseDown", event.getPos().x, event.getPos().y);
return hit;
}
示例5: onMouseDown
void PretzelRoot::onMouseDown(ci::app::MouseEvent &event)
{
PretzelGui *pg;
// only click the top-most gui
for( auto it = mGuiList.begin(); it!=mGuiList.end(); ++it){
pg = *it;
if( pg->getGlobalBounds().contains( event.getPos() ) ){
pg->mouseDown( event.getPos() );
break;
}
}
// If this gui isn't on top, do z sorting to bring it up
if( pg != mGuiList[0] ){
for( auto it = mGuiList.begin(); it!=mGuiList.end(); ){
if( *it == pg ){
it = mGuiList.erase(it);
}else{
++it;
}
}
mGuiList.push_front(pg);
}
}
示例6: setState
void DialerT<T>::mouseMove( ci::app::MouseEvent &event )
{
if( isHit( event.getPos() ) )
{
setState( State::OVER );
mHitPoint = event.getPos();
calculatePrecisionZone();
setNeedsDisplay();
}
else
{
setState( State::NORMAL );
}
}
示例7: setState
void RangeT<T>::mouseDown( ci::app::MouseEvent &event )
{
if( isHit( event.getPos() ) ) {
mHit = true;
setState( State::DOWN );
mHitValueHigh = mValueHigh;
mHitValueLow = mValueLow;
input( event.getPos() );
if( (int)mTrigger & (int)Trigger::BEGIN ) {
trigger();
}
} else {
setState( State::NORMAL );
}
}
示例8: mouseDown
void TextInput::mouseDown( ci::app::MouseEvent &event )
{
if( isHit( event.getPos() ) ) {
mHit = true;
mClicked = true;
setState( State::DOWN );
calculateCursorPosition( event.getPos() );
if( (int)mTrigger & (int)Trigger::BEGIN ) {
trigger();
}
}
else {
setState( State::NORMAL );
}
}
示例9: onMouseMoved
void PretzelRoot::onMouseMoved(ci::app::MouseEvent &event)
{
// for( auto it=mGuiList.begin(); it!=mGuiList.end(); ++it){
// (*it)->mouseMoved( event.getPos() );
// }
for( auto it = mGuiList.begin(); it!=mGuiList.end(); ++it){
PretzelGui *pg = *it;
if( pg->getGlobalBounds().contains( event.getPos() ) ){
(*it)->mouseMoved( event.getPos() );
break;
}
}
}
示例10: mouseUp
void Button::mouseUp( ci::app::MouseEvent &event )
{
if( mHit ) {
#if defined( CINDER_COCOA_TOUCH )
setState( State::DOWN );
#else
if( isHit( event.getPos() ) ) {
setState( State::OVER );
}
else {
setState( State::NORMAL );
}
#endif
toggleValue();
if( (int)mTrigger & (int)Trigger::END ) {
trigger();
}
}
else {
setState( State::NORMAL );
}
mHit = false;
View::mouseUp( event );
}
示例11: mouseWheel
void ColorPicker::mouseWheel( ci::app::MouseEvent &event )
{
if( isHit( event.getPos() ) && !mHit ) {
mColor.a -= event.getWheelIncrement() * mFormat.mSensitivity;
mColor.a = std::max( std::min( mColor.a, mFormat.mAlphaLimits.y ), mFormat.mAlphaLimits.x );
updateColorRef();
updateLabel();
setNeedsDisplay();
if( (int)mTrigger & (int)Trigger::CHANGE ) {
trigger();
}
}
else if( mHit ) {
vec3 color = mColor.get( mFormat.mColorModel );
color.z -= event.getWheelIncrement() * mFormat.mSensitivity;
color.z = std::max( std::min( color.z, 1.0f ), 0.0f );
mColor.set( mFormat.mColorModel, vec4( color.x, color.y, color.z, mColor.a ) );
updateColorRef();
updateLabel();
setNeedsDisplay();
if( (int)mTrigger & (int)Trigger::CHANGE ) {
trigger();
}
}
}
示例12: mouseUp
void ColorPicker::mouseUp( ci::app::MouseEvent &event )
{
if( mHit ) {
#if defined( CINDER_COCOA_TOUCH )
setState( State::NORMAL );
#else
if( isHit( event.getPos() ) ) {
setState( State::OVER );
}
else {
setState( State::NORMAL );
}
#endif
mHit = false;
updateLabel();
if( (int)mTrigger & (int)Trigger::END ) {
trigger();
}
}
else {
setState( State::NORMAL );
}
View::mouseUp( event );
}
示例13: mouseDown
void GraphNodeHandler::mouseDown(ci::app::MouseEvent &event)
{
if (glm::length(*position - ci::vec2(event.getPos())) < size)
{
if (event.isAltDown())
{
if (selection == Selection::addEdge)
{
selection = Selection::none;
}
else
{
selection = Selection::addEdge;
selectedInFrame = ci::app::getElapsedFrames();
}
}
else
{
selection = Selection::move;
}
event.setHandled(true);
}
else
{
if (selection == Selection::move)
selection = Selection::none;
}
}
示例14: mouseDown
bool Camera::mouseDown(ci::app::MouseEvent m_event) {
if (draw_interface_)
return false;
cam_->mouseDown(m_event.getPos());
return false;
}
示例15: mouseMove
void MultiSlider::mouseMove( ci::app::MouseEvent &event )
{
if( isHit( event.getPos() ) ) {
setState( State::OVER );
std::string newKey = getKey( event.getPos() );
if( newKey != mHoverKey ) {
mHoverKey = newKey;
changeState();
setNeedsDisplay();
}
}
else {
setState( State::NORMAL );
mHoverKey = "";
}
}