void GraphicsScene::setupScene() { ballCollection.append(ball); ballCollection.append(ballRouge); ballCollection.append(ballJaune); ballCollection.append(ballVerte); ballCollection.append(ballDefault); ballDefault->setStop(false); QPen pen2(Qt::white,1,Qt::SolidLine); QRectF rect(0,10,976,652); addRect(rect,pen2); prisme->setPos( width()/2-prisme->getPixmap()->width()/2, height()/2-prisme->getPixmap()->height()/2); addItem(prisme); //prismeForme->setPen(QPen(QBrush(QColor("red")),2,Qt::SolidLine)); QPolygonF polygon; polygon << QPointF( width()/2, height()/2-prisme->getPixmap()->height()/2) << QPointF( width()/2-prisme->getPixmap()->width()/2, this->height()/2+prisme->getPixmap()->height()/2)<<QPointF(this->width()/2+prisme->getPixmap()->width()/2,this->height()/2+prisme->getPixmap()->height()/2); prismeForme->setPolygon(polygon); addItem(prismeForme); barPlayer->setPos(-barPlayer->getPixmap()->width()/2,( height()/2)-(barPlayer->getPixmap()->height()/2)); addItem(barPlayer); barIA->setPos( width()-barIA->getPixmap()->width()/2,( height()/2)-(barIA->getPixmap()->height()/2)); addItem(barIA); scoreManager->getScoreView2()->setPos(670,560); addItem(scoreManager->getScoreView2()); scoreManager->getScoreView1()->setPos(210,560); addItem(scoreManager->getScoreView1()); initBallBlanche(); timer = new QTimer( this ); timer->setInterval( 20 ); timer->start(); connect( timer, SIGNAL(timeout()), this, SLOT(actualiserScene()) ); timer2 = new QTimer(this); timer2->setInterval(1000); timer2->start(); connect( timer2, SIGNAL(timeout()), this, SLOT(refreshLine()) ); connect( barPlayer, SIGNAL(inactivite()), this, SLOT(stopScene()) ); connect( this, SIGNAL(finPartie()), this, SLOT(stopScene()) ); }
/** * Save the function's contents to an XML document * * @param doc The QDomDocument to save to */ bool EFX::saveXML(QDomDocument* doc, QDomElement* wksp_root) { QDomElement root; QDomElement tag; QDomElement subtag; QDomText text; QString str; Q_ASSERT(doc != NULL); Q_ASSERT(wksp_root != NULL); /* Function tag */ root = doc->createElement(KXMLQLCFunction); wksp_root->appendChild(root); root.setAttribute(KXMLQLCFunctionID, id()); root.setAttribute(KXMLQLCFunctionType, Function::typeToString(m_type)); root.setAttribute(KXMLQLCFunctionName, name()); /* Fixtures */ QListIterator <EFXFixture*> it(m_fixtures); while (it.hasNext() == true) it.next()->saveXML(doc, &root); /* Propagation mode */ tag = doc->createElement(KXMLQLCEFXPropagationMode); root.appendChild(tag); text = doc->createTextNode(propagationModeToString(m_propagationMode)); tag.appendChild(text); /* Speed bus */ tag = doc->createElement(KXMLQLCBus); root.appendChild(tag); tag.setAttribute(KXMLQLCBusRole, KXMLQLCBusFade); str.setNum(busID()); text = doc->createTextNode(str); tag.appendChild(text); /* Direction */ tag = doc->createElement(KXMLQLCFunctionDirection); root.appendChild(tag); text = doc->createTextNode(Function::directionToString(m_direction)); tag.appendChild(text); /* Run order */ tag = doc->createElement(KXMLQLCFunctionRunOrder); root.appendChild(tag); text = doc->createTextNode(Function::runOrderToString(m_runOrder)); tag.appendChild(text); /* Algorithm */ tag = doc->createElement(KXMLQLCEFXAlgorithm); root.appendChild(tag); text = doc->createTextNode(algorithm()); tag.appendChild(text); /* Width */ tag = doc->createElement(KXMLQLCEFXWidth); root.appendChild(tag); str.setNum(width()); text = doc->createTextNode(str); tag.appendChild(text); /* Height */ tag = doc->createElement(KXMLQLCEFXHeight); root.appendChild(tag); str.setNum(height()); text = doc->createTextNode(str); tag.appendChild(text); /* Rotation */ tag = doc->createElement(KXMLQLCEFXRotation); root.appendChild(tag); str.setNum(rotation()); text = doc->createTextNode(str); tag.appendChild(text); /* Start function */ tag = doc->createElement(KXMLQLCEFXStartScene); root.appendChild(tag); str.setNum(startScene()); text = doc->createTextNode(str); tag.appendChild(text); if (startSceneEnabled() == true) tag.setAttribute(KXMLQLCFunctionEnabled, KXMLQLCTrue); else tag.setAttribute(KXMLQLCFunctionEnabled, KXMLQLCFalse); /* Stop function */ tag = doc->createElement(KXMLQLCEFXStopScene); root.appendChild(tag); str.setNum(stopScene()); text = doc->createTextNode(str); tag.appendChild(text); if (stopSceneEnabled() == true) tag.setAttribute(KXMLQLCFunctionEnabled, KXMLQLCTrue); else tag.setAttribute(KXMLQLCFunctionEnabled, KXMLQLCFalse); /******************************************** * X-Axis ********************************************/ tag = doc->createElement(KXMLQLCEFXAxis); root.appendChild(tag); tag.setAttribute(KXMLQLCFunctionName, KXMLQLCEFXX); /* Offset */ subtag = doc->createElement(KXMLQLCEFXOffset); tag.appendChild(subtag); str.setNum(xOffset()); text = doc->createTextNode(str); subtag.appendChild(text); /* Frequency */ subtag = doc->createElement(KXMLQLCEFXFrequency); tag.appendChild(subtag); str.setNum(xFrequency()); text = doc->createTextNode(str); subtag.appendChild(text); /* Phase */ subtag = doc->createElement(KXMLQLCEFXPhase); tag.appendChild(subtag); str.setNum(xPhase()); text = doc->createTextNode(str); subtag.appendChild(text); /******************************************** * Y-Axis ********************************************/ tag = doc->createElement(KXMLQLCEFXAxis); root.appendChild(tag); tag.setAttribute(KXMLQLCFunctionName, KXMLQLCEFXY); /* Offset */ subtag = doc->createElement(KXMLQLCEFXOffset); tag.appendChild(subtag); str.setNum(yOffset()); text = doc->createTextNode(str); subtag.appendChild(text); /* Frequency */ subtag = doc->createElement(KXMLQLCEFXFrequency); tag.appendChild(subtag); str.setNum(yFrequency()); text = doc->createTextNode(str); subtag.appendChild(text); /* Phase */ subtag = doc->createElement(KXMLQLCEFXPhase); tag.appendChild(subtag); str.setNum(yPhase()); text = doc->createTextNode(str); subtag.appendChild(text); return true; }