Example #1
0
void QGLView::drawDrawables(QGLView::ModelType type)
{
    if (type == NoType)
    {
        QMapIterator<ModelType, QList<Parameters*>* > i(m_drawableMap);
        while (i.hasNext()) {
            i.next();
            drawDrawables(i.key());
        }
    }
    else
    {
        switch (type)
        {
        case Cube:
        case Cylinder:
        case Cone:
        case Sphere:
            drawModelVertices(type);
            break;
        case Text:
            drawTexts();
            break;
        case Line:
            drawLines();
            break;
        default:
            return;
        }
    }
}
Example #2
0
void Gui::step(sf::RenderWindow& window) {

  //rechecks mouse position
  mouseX = sf::Mouse::getPosition(window).x;
  mouseY = sf::Mouse::getPosition(window).y;
  if (game.currentPlayer) {
    checkMouse(window, p1Units);
  }
  else {
    checkMouse(window, p2Units);
  }
  drawTexts(window);
  drawRangeCircle(window);
}
void Thermal::draw(){
    if(thermalEngine->hasImages()){
        
        thermalEngine->prev(19).draw(84, 200, 910,  450);
        thermalEngine->prev(9).draw(84, 784, 910,  450);
        thermalEngine->lastImage().draw(84, 1366, 910,  450);
    }
    
    drawElapsedTime();
    drawTexts();
    drawThermalData();
    drawTemperature();
    drawTarget();
    
    assets->wireframe_thermal.draw(0, 0);
    
};
void DrawingBoard::mouseReleaseEvent(QMouseEvent *event)
{
    if(myLine){
        if (event->button() == Qt::LeftButton && drawing) {
           // backUp.push_back(image);
            store();

            drawLineThru(startPoint, event->pos());
istore();
            drawing = false;
            }
        else if (event->button() == Qt::RightButton) {
           // QString str1 = QString::number(myPenWidth);
           // myPenWidth = 1;
           // QString str2 = QString::(myPenColor);

           // myPenColor = Qt::red;
            bool ok;
            int newWidth = QInputDialog::getInt(this, tr("Line Size"),
                                                tr("Select the size of line:"),
                                                penWidth(),
                                                1, 50, 1, &ok);
              // bool ok;
            //QString item = QInputDialog::getItem(this, tr("QInputDialog::getItem()"),
                       //                             tr("Season:"), items, 0, false, &ok);

            if (ok){
                setPenWidth(newWidth);
               // statusBar()->showMessage(tr("qweewqewdasdsakdl"));
            }
        }
    }
    else  if(myRect){
          if ((event->buttons() & Qt::LeftButton) && drawing){
             // backUp.push_back(image);
            // store();

          drawRectTo(event->pos());
        //   istore();
          drawing = false;

          }
          else if (event->button() == Qt::RightButton) {

              bool ok;
              int newWidth = QInputDialog::getInt(this, tr("Rectangle border size"),
                                                  tr("Select the size of the border:"),
                                                  penWidth(),
                                                  1, 50, 1, &ok);
                // bool ok;
              //QString item = QInputDialog::getItem(this, tr("QInputDialog::getItem()"),
                         //                             tr("Season:"), items, 0, false, &ok);

              if (ok){
                  setPenWidth(newWidth);
                 // statusBar()->showMessage(tr("qweewqewdasdsakdl"));
              }
          }
      }

    else if(myText){
        if ((event->buttons() & Qt::LeftButton) && drawing){
           // backUp.push_back(image);
            store();

        drawTexts(event->pos(),QString::fromStdString(text));
        istore();
        drawing = false;

        }
        else if (event->button() == Qt::RightButton) {
           // QString str =QString::fromStdString(text);
            bool ok;
            QString txt = QInputDialog::getText(this, tr("Enter the text you want to print"),
                                                 tr("Message"), QLineEdit::Normal,tr("Type your message"),
                                                  &ok);
            if (ok){
                text=txt.toStdString();
                //text=txt;
        }}
    }
    else if(myPen)
    {
    if (event->button() == Qt::LeftButton && drawing) {
       // backUp.push_back(image);
        store();

        drawLineTo(event->pos());
istore();
        drawing = false;
    }
    else if (event->button() == Qt::RightButton) {

        bool ok;
        int newWidth = QInputDialog::getInt(this, tr("Pen Size"),
                                            tr("Select the size of pen:"),
                                            penWidth(),
                                            1, 50, 1, &ok);
          // bool ok;
          // QString item = QInputDialog::getItem(this, tr("QInputDialog::getItem()"),
                       //                         tr("Season:"), items, 0, false, &ok);

        if (ok){
            setPenWidth(newWidth);
           // statusBar()->showMessage(tr("qweewqewdasdsakdl"));
        }
        //QMessageBox::about(this, tr("Pen tool properties"),
             //   tr("You have Clicked right button. To draw Please press left button on mouse"));
    }
    }
    else if(mypLine){
        if (event->button() == Qt::LeftButton && drawing) {
           // backUp.push_back(image);
            store();

            drawLineTemp(startPoint, event->pos());
            istore();
            drawing = false;
            }
        else if (event->button() == Qt::RightButton) {
            bool ok;
            int newWidth = QInputDialog::getInt(this, tr("Select polyline Size"),
                                                tr("Select the size of Polyline:"),
                                                penWidth(),
                                                1, 50, 1, &ok);
            if (ok)
                setPenWidth(newWidth);
          //  QMessageBox::about(this, tr("PolyLine tool properties"),
            //        tr("You have Clicked right button. To draw Please press left button on mouse"));
        }
    }
    else if(myRub)
    {
    if (event->button() == Qt::LeftButton && drawing) {
      //  backUp.push_back(image);
        store();

        erase(event->pos());//to change
istore();
        drawing = false;
    }
    else if (event->button() == Qt::RightButton) {

        bool ok;
        int newWidth = QInputDialog::getInt(this, tr("Eraser Size"),
                                            tr("Select the size of Eraser:"),
                                            rubWidth(),
                                            1, 50, 1, &ok);
        if (ok)
            setRubWidth(newWidth);
    }
    }
    else
    {
        if (event->button() == Qt::LeftButton) {
        QMessageBox::about(this, tr("Mouse Event detection"),
                tr("You have Clicked Left Button. Now, close and select your preferences"));
    }

        else if (event->button() == Qt::RightButton) {

            QMessageBox::about(this, tr("Mouse Event1 detection"),
                    tr("You have Clicked right button. Now, close and select your preferences to see the properties of tool"));
        }

}
}
void DrawingBoard::mouseMoveEvent(QMouseEvent *event)
{
    if(myLine){
        if ((event->buttons() & Qt::LeftButton) && drawing){
           // backUp.push_back(image);
           // store();

        drawLineThru(startPoint,startPoint);
        }
        else if (event->button() == Qt::RightButton) {

            QMessageBox::about(this, tr("Mouse Event detection"),
                    tr("You have Clicked right button. To draw Please press left button on mouse"));
        }
    }
  else if(myRect){
        if ((event->buttons() & Qt::LeftButton) && drawing){
           // backUp.push_back(image);
            //store();

        drawRectTo(event->pos());
         // istore();

        }
        else if (event->button() == Qt::RightButton) {

            QMessageBox::about(this, tr("Mouse Event detection"),
                    tr("You have Clicked right button. To draw Please press left button on mouse"));
        }
    }
    else if(myText){
        if ((event->buttons() & Qt::LeftButton) && drawing){
           // backUp.push_back(image);
            store();

        drawTexts(startPoint,QString::fromStdString(text));
        istore();

        }
        else if (event->button() == Qt::RightButton) {

            QMessageBox::about(this, tr("text Event detection"),
                    tr("You have Clicked right button. To draw Please press left button on mouse"));
        }
    }
    else if(myPen)
     {
        if ((event->buttons() & Qt::LeftButton) && drawing){
           // backUp.push_back(image);
            store();

        drawLineTo(event->pos());
        istore();

        }
        else if (event->button() == Qt::RightButton) {

            QMessageBox::about(this, tr("Mouse Event detection"),
                    tr("You have Clicked right button. To draw Please press left button on mouse"));
        }
    }
    else if(mypLine){
        if ((event->buttons() & Qt::LeftButton) && drawing){
           // backUp.push_back(image);
            store();
        drawLineTemp(startPoint,startPoint);
           istore();
        }
        else if (event->button() == Qt::RightButton) {

            QMessageBox::about(this, tr("Mouse Event detection"),
                    tr("You have Clicked right button. To draw Please press left button on mouse"));
        }
    }
    else if(myRub)
     {
        if ((event->buttons() & Qt::LeftButton) && drawing){
          //  backUp.push_back(image);

        erase(event->pos());//to change

        }
        else if (event->button() == Qt::RightButton) {

            QMessageBox::about(this, tr("Mouse Event detection"),
                    tr("You have Clicked right button. To erase Please press left button on mouse"));
        }
    }
    else
    {
        if (event->button() == Qt::LeftButton) {
        QMessageBox::about(this, tr("Mouse Event detection"),
                tr("You have Clicked Left Button. Now, close and select your preferences"));
    }
        else if (event->button() == Qt::RightButton) {

            QMessageBox::about(this, tr("Mouse Event detection"),
                    tr("You have Clicked right button. Now, close and select your preferences"));
        }

}
}