void error(char type)
{
    //vTaskSuspendAll ();    //suspend tasks
    switch (type)
    {
        // Timer failed to start
        case 'a':   updateLines('[');
                    break;
        // Receive Queue full
        case 'b':   updateLines('{');
                    break;
        // Queue not created
        case 'c':   updateLines('+');
                    break;
        // Send Queue full
        case 'd':   updateLines('}');
                    break;
              
    }
}
示例#2
0
void CurveNode::calcVertexes(const VertexDataPtr& pVertexData, Pixel32 color)
{
    updateLines();
    
    pVertexData->appendPos(m_LeftCurve[0], glm::vec2(m_TC1,1), color);
    pVertexData->appendPos(m_RightCurve[0], glm::vec2(m_TC2,0), color);
    for (unsigned i = 0; i < m_LeftCurve.size()-1; ++i) {
        float ratio = i/float(m_LeftCurve.size());
        float tc = (1-ratio)*m_TC1+ratio*m_TC2;
        pVertexData->appendPos(m_LeftCurve[i+1], glm::vec2(tc,1), color);
        pVertexData->appendPos(m_RightCurve[i+1], glm::vec2(tc,0), color);
        pVertexData->appendQuadIndexes((i+1)*2, i*2, (i+1)*2+1, i*2+1);
    }
}
  void PolygonArrayDisplay::processMessage(const jsk_recognition_msgs::PolygonArray::ConstPtr& msg)
  {
    if (!validateFloats(*msg)) {
      setStatus(rviz::StatusProperty::Error, "Topic", "Message contained invalid floating point values (nans or infs)");
      return;
    }
    // create nodes and manual objects
    updateSceneNodes(msg);
    allocateMaterials(msg->polygons.size());
    updateLines(msg->polygons.size());
    
    if (only_border_) {
      // use line_
      for (size_t i = 0; i < manual_objects_.size(); i++) {
        manual_objects_[i]->setVisible(false);
      }
      for (size_t i = 0; i < msg->polygons.size(); i++) {
        geometry_msgs::PolygonStamped polygon = msg->polygons[i];
        if (polygon.polygon.points.size() >= 3) {
          processLine(i, polygon);
        }
      }
    }
    else {
      for (size_t i = 0; i < msg->polygons.size(); i++) {
        processPolygonMaterial(i);
      }
      
      for (size_t i = 0; i < msg->polygons.size(); i++) {
        geometry_msgs::PolygonStamped polygon = msg->polygons[i];
        processPolygon(i, polygon);
      }
    }

    if (show_normal_) {
      for (size_t i = 0; i < msg->polygons.size(); i++) {
        geometry_msgs::PolygonStamped polygon = msg->polygons[i];
        processNormal(i, polygon);
      }
    }
  }
示例#4
0
文件: board.cpp 项目: philarin/Tetris
/**
 * Freezes the current piece to the board and then checks for full lines.
 *
 * Returns:
 *  True if the none of the piece is located above the game board and false
 *  otherwise.
 */
bool Board::freezePiece() {
    int x, y, pX, pY;
    x = currentPiece.getX();
    y = currentPiece.getY();

    for (int i = 0; i < Piece::NUMPOINTS; i++) {
        pX = Piece::PIECES[currentPiece.getPieceIndex()] \
                [currentPiece.getOrientationIndex()][i][0] + x;
        pY = Piece::PIECES[currentPiece.getPieceIndex()] \
                [currentPiece.getOrientationIndex()][i][1] + y;
        if (pY < BOARDHEIGHT) {
            board[pY][pX].filled = true;
            board[pY][pX].colorIndex = currentPiece.getColorIndex();
        } else
            return false;
    }

    score += 5;
    updateLines();
    return true;
}
示例#5
0
//Pass in the string and the default color for this block of text.
LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_time, LLFontGL* font, F32 screen_width) 
						: mParagraphText(str), mAddTime(add_time), mMaxWidth(-1)
{
	makeParagraphColorSegments(color);
	updateLines( screen_width, font );
}
示例#6
0
//--------------------------------------------------------------
void testApp::update(){
    

    updateWiFly();
    calibrateWiFly();
    updateLines();
    
    ofSetWindowTitle(ofToString(ofGetFrameRate()));
    
    while( mReceiver.hasWaitingMessages()){
        
        ofxOscMessage m;
        
        mReceiver.getNextMessage(&m);
        
        
        if(m.getAddress() == "/Channel01/AudioAnalysis"){
            amplitude[0] = m.getArgAsFloat(0);
            pitch[0] = m.getArgAsFloat(1);
            attack[0] = m.getArgAsFloat(2);
//            cout<< "amplitude chan 1: "<< amplitude[0] << endl;
        }
        
        
        if(m.getAddress() == "/Channel02/AudioAnalysis"){
            amplitude[1] = m.getArgAsFloat(0);
            pitch[1] = m.getArgAsFloat(1);
            attack[1] = m.getArgAsFloat(2);
        }
        
        if(m.getAddress() == "/Channel03/AudioAnalysis"){
            
            amplitude[2] = m.getArgAsFloat(0);
            pitch[2] = m.getArgAsFloat(1);
            attack[2] = m.getArgAsFloat(2);
        }
        
        if(m.getAddress() == "/Channel01/FFT"){
            for (int i=0; i<17; i++){
                //FFTavg[0][i] = m.getArgAsFloat(i);
            }
        }
        
        if(m.getAddress() == "/Channel02/FFT"){
            for (int i=0; i<17; i++){
                //FFTavg[1][i] = m.getArgAsFloat(i);
            }
        }
        
        if(m.getAddress() == "/Channel03/FFT"){
            for (int i=0; i<17; i++){
               // FFTavg[2][i] = m.getArgAsFloat(i);
//                cout<< i << ": "<< FFTavg[2][i] << endl;
            }
        }
    }
//    
//    for( int i = 0; i < 3; i++){
//        
//        breath[i] = xMapped[i];
//    }
}