void MainWindow::showEvent(QShowEvent *) { // Setting the QGraphicsScene scene = new QGraphicsScene(0,0,width()*2,height()*2); QPixmap bg; bg.load(":/image/backgroung.png"); bg = bg.scaled(width()*2,height()*2); scene->addPixmap(bg); ui->graphicsView->setScene(scene); ui->graphicsView-> scale(0.5,0.5); for(int i=0;i<10;i++){ scorenumberPic[i].load("://image/number_"+QString::number(i)+".png"); scorenumberPic[i]=scorenumberPic[i].scaled(scorenumberPic[i].width()*4,scorenumberPic[i].height()*4); } button = new QPushButton("",this); QPixmap icon; icon.load(":/image/restart.png"); icon = icon.scaled(800,800); button->setIcon(icon); button->setIconSize(QSize(70,70)); button->setGeometry(10,10,70,70); button->setFlat(true); button->show(); connect(button,SIGNAL(clicked(bool)),this,SLOT(restart())); button1 = new QPushButton("",this); icon.load(":/image/exit.png"); icon = icon.scaled(800,800); button1->setIcon(icon); button1->setIconSize(QSize(70,70)); button1->setGeometry(100,10,70,70); button1->setFlat(true); button1->show(); connect(button1,SIGNAL(clicked(bool)),this,SLOT(quitgame())); // Create world world = new b2World(b2Vec2(0.0f, -9.8f)); world->SetContactListener(&listener); // Setting Size GameItem::setGlobalSize(QSizeF(32,18),size()); // Create ground (You can edit here) itemList.push_back(new Land(32,-17,64,0,QPixmap(":/ground.pn").scaled(width()*2,height()/6.0),world,scene)); //itemList.push_back(new Land(32,1.5,3,35,QPixmap(":/ground.pn").scaled(width(),height()/6.0),world,scene));//r bound //itemList.push_back(new Land(0,1.5,3,35,QPixmap(":/ground.pn").scaled(width(),height()/6.0),world,scene));//l bound createStage(); createBird(blue); // Timer connect(&timer,SIGNAL(timeout()),this,SLOT(tick())); connect(&timer,SIGNAL(timeout()),this,SLOT(showScore())); timer.start(100/6); connect(this,SIGNAL(quitGame()),this,SLOT(QUITSLOT())); connect(&timer_z,SIGNAL(timeout()),this,SLOT(zoomIn())); connect(&timer_f,SIGNAL(timeout()),this,SLOT(followBird())); connect(&timer_waiter,SIGNAL(timeout()),this,SLOT(createBird())); }
void StageManager::setRank(float baseRank, float inc, int startParsec, int type) { rank = baseRank; rankInc = inc; rank += rankInc * (startParsec / 10); section = -1; parsec = startParsec - 1; stageType = type; createStage(); gotoNextSection(); }
void StageManager::gotoNextSection() { ++section; ++parsec; if (gameManager->state == P47GameManager::TITLE && section >= 4) { section = 0; parsec -= 4; } if (section >= 10) { section = 0; rank += rankInc; createStage(); } createSectionData(); }
int SmoothKernel::execute() { PointTable table; Options readerOptions; readerOptions.add("filename", m_inputFile); setCommonOptions(readerOptions); Stage& readerStage(Kernel::makeReader(m_inputFile)); readerStage.setOptions(readerOptions); // go ahead and prepare/execute on reader stage only to grab input // PointViewSet, this makes the input PointView available to both the // processing pipeline and the visualizer readerStage.prepare(table); PointViewSet viewSetIn = readerStage.execute(table); // the input PointViewSet will be used to populate a BufferReader that is // consumed by the processing pipeline PointViewPtr input_view = *viewSetIn.begin(); std::shared_ptr<BufferReader> bufferReader(new BufferReader); bufferReader->setOptions(readerOptions); bufferReader->addView(input_view); Options smoothOptions; std::ostringstream ss; ss << "{"; ss << " \"pipeline\": {"; ss << " \"filters\": [{"; ss << " \"name\": \"MovingLeastSquares\""; ss << " }]"; ss << " }"; ss << "}"; std::string json = ss.str(); smoothOptions.add("json", json); smoothOptions.add("debug", isDebug()); smoothOptions.add("verbose", getVerboseLevel()); auto& smoothStage = createStage("filters.pclblock"); smoothStage.setOptions(smoothOptions); smoothStage.setInput(*bufferReader); Options writerOptions; writerOptions.add("filename", m_outputFile); setCommonOptions(writerOptions); Stage& writer(Kernel::makeWriter(m_outputFile, smoothStage)); writer.setOptions(writerOptions); writer.prepare(table); // process the data, grabbing the PointViewSet for visualization of the // resulting PointView PointViewSet viewSetOut = writer.execute(table); if (isVisualize()) visualize(*viewSetOut.begin()); //visualize(*viewSetIn.begin(), *viewSetOut.begin()); return 0; }