/** * UTQL component constructor. * * @param sName Unique name of the component. * @param subgraph UTQL subgraph */ CovarianceEstimation( const std::string& sName, boost::shared_ptr< Graph::UTQLSubgraph > subgraph ) : Dataflow::Component( sName ) , m_inPortPerturbed( "PerturbedInput", *this, boost::bind( &CovarianceEstimation::dataIn, this, _1 ) ) , m_inPortTrigger( "TriggerInput", *this, boost::bind( &CovarianceEstimation::triggerIn, this, _1 ) ) , m_outPortSync( "Sync", *this ) , m_outPortDist ( "Distribution", *this ) , m_bStopped( true ) , m_counter ( 0 ) , m_size( 100 ) , m_button( ' ' ) , m_inButton( ' ' ) { LOG4CPP_DEBUG( logger, "Setup CovarianceEstimation component" ); // read configuration for amount of samples to use subgraph->m_DataflowAttributes.getAttributeData( "size", m_size ); // read button key std::string button( " " ); std::string inButton( " " ); if ( subgraph->m_DataflowAttributes.hasAttribute( "button" ) ) button = subgraph->m_DataflowAttributes.getAttributeString( "button" ); if ( subgraph->m_DataflowAttributes.hasAttribute( "inButton" ) ) inButton = subgraph->m_DataflowAttributes.getAttributeString( "inButton" ); m_button = Math::Scalar< int >( button[ 0 ] ); m_inButton = Math::Scalar< int >( inButton[ 0 ] ); mean = Math::Vector< double, 7 >::zeros(); outProd = Math::Matrix< double, 7, 7 >::zeros( ); }
void LoginDialog::mouseMoveEvent(QMouseEvent *e) { if(inButton(exitButton, e->pos())) exitButton->setStyleSheet("border:none; background-color: rgb(255, 0, 0);"); else exitButton->setStyleSheet("border:none; background-color:transparent;"); if(inButton(minButton, e->pos())) minButton->setStyleSheet("border:none; background-color: rgba(255, 0, 0, 100);"); else minButton->setStyleSheet("border:none; background-color:transparent;"); if (e->buttons() == Qt::LeftButton) move(e->globalPos() - dPos); }
void __loadds far mouseEvent(int event, int x, int y) { #pragma aux mouseEvent parm [EAX] [ECX] [EDX]; static left_button_hold_down = 0; if (event & MOUSE_MOVE) { if (left_button_hold_down) { recMouseBackground(); saveMouseBackground(x, y); } moveMouse(x, y); } else if (event & MOUSE_RIGHT_UP) { //gameState = GAME_QUIT; } else if (event & MOUSE_LEFT_DOWN) { left_button_hold_down = 1; /* 以下为鼠标单击按钮事件处理 */ if (inButton(x, y, &quitButton)) { gameState = GAME_QUIT; } if (inButton(x, y, &playButton)) { if (playButton.state == BUTTON_UP) { playButton.state = BUTTON_DOWN; } else { playButton.state = BUTTON_UP; } handlePause(); paintButton(&playButton); } if (inButton(x, y, &soundButton)) { switchSound(); } } else if (event & MOUSE_LEFT_UP) { left_button_hold_down = 0; } else if (event & MOUSE_RIGHT_DOWN) { } }
bool Button::update(sf::Vector2i mousePos) { if(!visible) { if (usingCache) rect.setTexture(texturePointer); else rect.setTexture(&normal); return false; } bool temp = false; bool down = sf::Mouse::isButtonPressed(sf::Mouse::Left); inButton(mousePos); if (down) { if(hovered && prevState == false) //mouse button was downed in button { downed = true; rect.setTexture(&mouseDown); } } else //mouse is up { if(hovered) { if(prevState == true && downed == true) { temp = true; //mouse was downed in button and now raised in button } else { rect.setTexture(&mouseOver); } } else { rect.setTexture(&normal); } downed = false; } prevState = down; if (usingCache) { rect.setTexture(texturePointer); } return temp; }