void MainWindow::doPlay(QString vertex){ if(game_over) return; if(players.getCurrent()->getSpecies() == "Computer"){ QString result = gtp.genmove( players.getCurrent()->getColorString() ); if(result == "pass"){ addHistory(players.currentColor(),tr("Passed")); updateScore(players.currentColor(),tr("Passed")); players.setCurrentPass(); }else if( result == "resign"){ addHistory(players.currentColor(),tr("Resigned")); updateScore(players.currentColor(),tr("Resigned")); players.setCurrentResigned(); }else{ players.setCurrentPlays(); } QString reason = players.getGameOver(); //if(reason.length()>0) emit gameOver(reason); if(reason.length()>0) setGameOver(reason); }else{ if(gtp.play( players.getCurrent()->getColorString(), vertex)){ players.setCurrentPlays(); }else{ addHistory(players.currentColor(),tr("Illegal move, try another")); return; } } int cnt= gtp.captures(players.getCurrent()->getColorString()); if(cnt != players.getCurrent()->getCaptures()){ players.getCurrent()->setCaptures(cnt); ui->gameBoard->checkStones(players.getNext()->getColorString(), gtp.list_stones( players.getNext()->getColorString())); } afterMove(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); game = new Game(); guitar = new Guitar(); guitar->setGeometry(0,0,790,140); ui->verticalLayout->insertWidget(0,guitar); result = new QLabel(); result->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); result->setAlignment(Qt::AlignCenter); ui->verticalLayout->addWidget(result); connect(ui->Note0,SIGNAL(clicked()),this,SLOT(onNote0())); connect(ui->Note1,SIGNAL(clicked()),this,SLOT(onNote1())); connect(ui->Note2,SIGNAL(clicked()),this,SLOT(onNote2())); connect(ui->Note3,SIGNAL(clicked()),this,SLOT(onNote3())); connect(ui->Note4,SIGNAL(clicked()),this,SLOT(onNote4())); connect(ui->Note5,SIGNAL(clicked()),this,SLOT(onNote5())); connect(ui->Note6,SIGNAL(clicked()),this,SLOT(onNote6())); connect(ui->start,SIGNAL(clicked()),this,SLOT(onStartStop())); connect(game,SIGNAL(statusChanged()),this,SLOT(updateScore())); connect(game,SIGNAL(positionChanged(QPoint)),guitar,SLOT(setPosition(QPoint))); updateScore(); }
void SimonLogic::newUserInput(int input) { //If user click right button, then move to next if(input==pattern[playerInputCount]) { playerInputCount++; emit updateProgress((int)(playerInputCount*100/pattern.size())); } else { emit updateScore(0); //Else, emit the signal to indicate losing if(score>highScore) highScore=score; emit loss(highScore); } //Starting new round if(playerInputCount==pattern.size()){ playerInputCount=0; score+=pattern.size()*100; //The flasing frequency would be faster in every new term if(frequency>300) frequency-=100; emit updateScore(score); addToPattern(); emit newPattern(pattern,frequency); } }
void MainWindow::validateConnection() { if(ui->IPAddress->text().length() < 7) { QMessageBox msg; msg.setWindowTitle("Error"); msg.setText("Skřítek v počítači přenesl data IP adresy a zjistil, že je prázdná nebo neni úplná."); msg.setIcon(QMessageBox::Information); msg.exec(); return; } if(ui->ServerPort->text().length() < 1) { QMessageBox msg; msg.setWindowTitle("Error"); msg.setText("Skřítek v počítači přenesl data cílového portu a zjistil, že je port prázdný. Port je třeba vyplnit, aby věděl kam má doručit data"); msg.setIcon(QMessageBox::Information); msg.exec(); return; } Client* client = new Client(ui->IPAddress->text(), ui->ServerPort->text().toInt(), this); if(client->connectToServer()) { IP = ui->IPAddress->text(); port = ui->ServerPort->text().toInt(); ui->action_rejoin->setEnabled(true); connect(ui->action_rejoin, SIGNAL(triggered()), this, SLOT(rejoin())); connect(client, SIGNAL(error(QString)), this, SLOT(showError(QString))); // Say hello to server client->sendPacket(Hello, QString("Hello"), client->toData(47777)); setCentralWidget(NULL); if(surface) delete surface; surface = new Surface(client, this); setCentralWidget(surface); connect(this, SIGNAL(key(Qt::Key&)), surface, SLOT(keyPress(Qt::Key&))); connect(surface, SIGNAL(foodEaten()), this, SLOT(updateScore())); connect(surface, SIGNAL(gameOver()), this, SLOT(gameOver())); score = -1; updateScore(); }
void TempoText::textChanged() { if (!_followText) return; // cache regexp, they are costly to create static QHash<QString, QRegExp> regexps; static QHash<QString, QRegExp> regexps2; QString s = plainText(); s.replace(",", "."); s.replace("<sym>space</sym>"," "); for (const TempoPattern& pa : tp) { QRegExp re; if (!regexps.contains(pa.pattern)) { re = QRegExp(QString("%1\\s*=\\s*(\\d+[.]{0,1}\\d*)\\s*").arg(pa.pattern)); regexps[pa.pattern] = re; } re = regexps.value(pa.pattern); if (re.indexIn(s) != -1) { QStringList sl = re.capturedTexts(); if (sl.size() == 2) { qreal nt = qreal(sl[1].toDouble()) * pa.f; if (nt != _tempo) { setTempo(qreal(sl[1].toDouble()) * pa.f); _relative = 1.0; _isRelative = false; updateScore(); } break; } } else { for (const TempoPattern& pa2 : tp) { QString key = QString("%1_%2").arg(pa.pattern).arg(pa2.pattern); QRegExp re2; if (!regexps2.contains(key)) { re2 = QRegExp(QString("%1\\s*=\\s*%2\\s*").arg(pa.pattern).arg(pa2.pattern)); regexps2[key] = re2; } re2 = regexps2.value(key); if (re2.indexIn(s) != -1) { _relative = pa2.f / pa.f; _isRelative = true; updateRelative(); updateScore(); return; } } } } }
/** * Runs the game! WHOO! */ int Game::start() { game_running = true; while(window.isOpen()) { while(game_running) { sf::Event event; while(window.pollEvent(event)) { if(event.type == sf::Event::Closed) { window.close(); game_running = false; game_over = true; } } bullets = p.getBullets(); spawnEnemies(); checkInput(); checkBorderCollision(p); checkEntityCollision(); checkDeath(); updateAnimations(); updateScore(); updateInterface(); updateGameClocks(); for(std::vector<Enemy*>::iterator iter = enemies.begin(); iter != enemies.end(); ++iter) { Enemy *eni = *iter; eni->stalkPlayer(p); } window.clear(sf::Color(0,230,0)); Sword * s = p.getSword(); if(s->isSwung()) { window.draw(s->shape); } window.draw(p.shape); for(std::vector<Enemy*>::iterator iter = enemies.begin(); iter != enemies.end(); ++iter) { Enemy *eni = *iter; window.draw(eni->shape); } for(std::vector<Bullet*>::iterator iter = bullets.begin(); iter != bullets.end(); ++iter) { Bullet *b = *iter; window.draw(b->shape); } for(std::vector<sf::Drawable*>::iterator iter = interface.begin(); iter != interface.end(); ++iter) { sf::Drawable *d = *iter; window.draw(*d); } window.display(); } setupEntities(); game_running = true; } return 0; }
void GameScene::removeCatch(bool alive, bool getScore){ if (getScore) { CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("add_point.wav"); _score += (_currentScore * _scoreMultiplier); updateScore(); } _currentScore = 0; _scoreMultiplier = 0; _currentLabel->setString(""); if (alive) { _catchedFish->setPreventAnimations(false); _catchedFish->setRotation(0); _catchedFish->setIsCatched(false); } else { _fish.erase(std::remove(_fish.begin(), _fish.end(), _catchedFish), _fish.end()); _catchedFish->removeFromParent(); if (!getScore) { CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("eaten.wav"); } } _catchedFish = NULL; _forceSharkDirection = true; _shark->resetAnimation(); }
void EnemyLayer::blowupEnemy(EnemySprite* pEnemySprite) { Animation *pAnimation = NULL; Sprite *pmsprite = NULL; char *buff = NULL; if (Enemy1 == pEnemySprite->getTag()) { buff = "a_001.png"; pAnimation = AnimationCache::getInstance()->getAnimation("Enemy1Blowup"); setScore(ENEMY1_SCORE); } else if (Enemy2 == pEnemySprite->getTag()) { buff = "b_001.png"; pAnimation = AnimationCache::getInstance()->getAnimation("Enemy2Blowup"); setScore(ENEMY2_SCORE); } else if (Enemy3 == pEnemySprite->getTag()) { buff = "d_00001.png"; pAnimation = AnimationCache::getInstance()->getAnimation("Enemy3Blowup"); setScore(ENEMY3_SCORE); } else { return; } pmsprite = Sprite::createWithSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(buff)); Point newPos = pEnemySprite->getcurPoint(); Animate *pAnimate = Animate::create(pAnimation); pmsprite->setPosition(newPos); this->addChild(pmsprite); CallFuncN* mactiondone = CallFuncN::create(CC_CALLBACK_0(EnemyLayer::f_removemyAnimation, this, pmsprite)); auto seq = Sequence::create(pAnimate, mactiondone, NULL); pmsprite->runAction(seq); removeEnemy(pEnemySprite); updateScore(m_score); }
void checkRowCompletion() { int x, y; int isFullLine = 0; int rowCount = 0; if (isGameMoving() == 0) { for (y = 1; y <= CANVAS_HEIGHT; y++) { for (x = 1; x <= CANVAS_WIDTH; x++) { if (canvas[x][y] != 0) { isFullLine++; } } if (isFullLine == CANVAS_WIDTH) { rowCount++; moveRowsAbove(y); } isFullLine = 0; } updateScore(rowCount); } }
void removeBrick(int lane, int c) { int n = vec[lane].size(); PHView * v = img[lane][c]; for (int i = c+1; i<n; i++) { vec[lane][i-1] = vec[lane][i]; img[lane][i-1] = img[lane][i]; PHImageView * v = img[lane][i]; v->beginCinematicAnimation(0.5f, PHCinematicAnimator::FadeInFunction); v->animateMove(PHPoint(0, -height)); v->commitCinematicAnimation(); } vec[lane].pop_back(); img[lane].pop_back(); PHImageView * iv = new PHImageView(v->frame()); iv->setImage(gm->imageNamed("boom")); iv->animator()->animateSection("poof", PHInv(iv, PHView::removeFromParent, NULL)); if (!snd->isPlaying()) snd->play(); pv->addChild(iv); iv->release(); v->removeFromParent(); score += 50; updateScore(); }
void SnakeItem::addPoints(int nbPoints) { if (notLost) { score += nbPoints; emit updateScore(score); } }
/* Function that will determine whether an Super Invader has been hit by player's missile */ int checkSuperInvaderHit(){ for (int k = 0; k<5; k++) { /* Rememeber Super Invaders are 5 chars long, so need to determine where the player's missile hit the invader */ if ((p.missileX == (superInvader.posX)) && ((p.missileY == (superInvader.posY+k)))) { mvprintw(superInvader.posX, superInvader.posY, " "); /* go back 5 spaces on the Y and delete the super invader*/ superInvader.alive = 0; /* super invader has been defeated */ score += 500 * level; /* add a score of 500 with regards to the current level */ updateScore(); /* pass this new score into the updateScore() function in player.c */ /* Switch statement that will prompt 'encouraging' messages to the user */ switch(rand()%3){ case 0: printStatus("Earth 1 Aliens 0!!!!!!!!!"); break; case 1: printStatus("Thats the way to gooooo!!!!!!!"); break; case 2: printStatus("We will destroy them, bravoooo !!!!"); break; } return 1; /* boolean for Super Invader has been hit */ } } return 0; }
/* Function that will determine whether an invader has been hit by player's missile */ int checkInvaderHit(){ for (int i = 0; i<INVADERS_ROWS; i++) for (int j = 0; j<INVADERS_COLUMNS; j++) { if (inv[i][j].alive) { for (int k = -1; k<2; k++) { /* Remember invaders are 3 chars long, so need to determine where the player's missile hit the invader */ if ((p.missileX == (inv[i][j].posX)) && ((p.missileY == (inv[i][j].posY+k)))) { mvprintw(inv[i][j].posX, inv[i][j].posY-1, " "); /* go back 3 spaces on the Y and delete the invader */ inv[i][j].alive = 0; /* current invader has been defeated */ count--; /* number of invaders has been decreased */ score += 100 * level; /* add a score of 100 with regards to what level user is on */ updateScore(); /* pass this new score into the updateScore() function in player.c */ /* Switch statement that will prompt 'encouraging' messages to the user */ switch(rand()%3){ case 0: printStatus("Great Shot! Just keep going."); break; case 1: printStatus("Nuke them down, nuke them down!!!"); break; case 2: printStatus("Superb shot!!!"); break; } return 1; /* boolean for invader has been hit */ } } } } return 0; }
bool WebServer::handleRequest(Pillow::HttpConnection *connection){ qDebug() << "[WebServer] ServerListener - Got Connection"; m_pMyApp->ConnectionEstablished(connection->requestPathDecoded(), ""); n += connection->requestContent().size(); n += connection->requestFragment().size(); n += connection->requestHeaderValue(someHeaderToken).size(); n += connection->requestMethod().size(); n += connection->requestPath().size(); n += connection->requestQueryString().size(); n += connection->requestUri().size(); n += connection->requestUriDecoded().size(); n += connection->requestFragmentDecoded().size(); n += connection->requestPathDecoded().size(); n += connection->requestQueryStringDecoded().size(); n += connection->requestParamValue(someParam).size(); QString response = "<html><head></head><body><font size='22'>"; qDebug() << "[WebServer] handleRequest - path decoded: " << connection->requestPathDecoded(); if (connection->requestPathDecoded() == "/"){ //this is the root page, tell the user to choose a player response.append("Choose player: <br /><span style='float: left'><a href='/luca'>Luca</a></span><span style='float: right'><a href='/don'>Don</a></span>"); } else { playerIpAddress = connection->remoteAddress().toString().toLatin1(); response.append("Player: "+playerIpAddress+"<br><a href='javascript:location.reload()'>Play again</a>"); updateScore(playerIpAddress); } response.append("</font></body></html>"); connection->writeResponse(200, Pillow::HttpHeaderCollection() << Pillow::HttpHeader("Content-Type", "text/html"), response.toLatin1()); return true; }
int main() { srand(time(NULL)); Stat stat; char name[50]; Snake snake; Pos food; ToGiveTread toGiveThread = {RIGHT, false, false}; showLeaderboard(); initStat(&stat); strcpy(name, stat.nickname); HANDLE hReadThread = CreateThread(NULL, 0, ReadThread, &toGiveThread, 0, NULL); strcpy(stat.nickname, name); initField(); initSnake(&snake); initFood(&snake, &food, &stat); updateAds(&stat); do{ Sleep(sleepTime(stat.level)); }while(!updateSnake(&snake, &food, &toGiveThread, &stat)); toGiveThread.toStopThread = true; clearScr(); updateScore(&stat); CloseHandle(hReadThread); showLeaderboard(); return 0; }
void CSimulatorWindowHandler::update() { static btVector3 ballPositionOld = m_simulator->getBallPosition(); double currentTime = CGameEngine::getInstance()->getClock().getCurrentTime(); double timeLapse = currentTime - m_previousUpdateTime; m_previousUpdateTime = currentTime; Ogre::Vector3 pos = m_cam3DNode->getPosition(); if(pos.y <= 5 && m_direction.y < 0) { m_direction.y = 0; } m_cam3DNode->translate(m_direction * timeLapse, Ogre::Node::TS_LOCAL); btVector3 ballPosition = m_simulator->getBallPosition(); ballPosition.setY(0.0); btVector3 lookAtPoint = ballPosition; lookAtPoint-=ballPositionOld; lookAtPoint/=50; lookAtPoint+=ballPositionOld; m_cam3D->lookAt(lookAtPoint.x(), lookAtPoint.y(), lookAtPoint.z()); ballPositionOld = lookAtPoint; updateScore(); m_simulator->update(); }
void GameScene::checkMatch(Pix* pix) { if (_blockManager->isMatching(pix)) { ZUtils::playEffect(SOUND_MATCH); updateScore(); pix->runAction(Sequence::create(ScaleTo::create(0.5f, 1.5f), CallFuncN::create([this](Node* node){ auto p = (Pix*)node; p->setVisible(false); p->setPosition(10000, 10000); p->setScale(1.0f); }), NULL )); } else { ZUtils::playEffect(SOUND_FAIL); auto p = ParticleSystemQuad::create("explode.plist"); p->setPosition(pix->getPosition() + Vec2(0, 64)); p->setAutoRemoveOnFinish(true); this->addChild(p, kControl); pix->setPosition(10000, 10000); pix->setVisible(false); onLoose(); } }
ga::Image::Image(default_random_engine & randEngine, Mat & source){ imageWidth = source.cols; imageHeight = source.rows; this->source = &source; uniform_int_distribution<int> xValGen(0, imageWidth-1); uniform_int_distribution<int> yValGen(0, imageHeight-1); uniform_int_distribution<int> BGRgen(0,255); uniform_real_distribution<double> alphaGen(0,1); for (int i = 0; i < NUM_OF_POLYGONS; i++) { vertexCounts[i] = MIN_VERTICES; for (int j = 0; j < vertexCounts[i]; j++) { polyArr[i][j].x = xValGen(randEngine); polyArr[i][j].y = yValGen(randEngine); } colors[i] = Scalar(BGRgen(randEngine), BGRgen(randEngine), BGRgen(randEngine), alphaGen(randEngine)); polygons[i] = &polyArr[i][0]; } updateScore(); }
QString LanguageDetector::detectLanguage(QString inputStr){ processInput(inputStr); init(); int weight = 1; QList<int> occurenceList = inputWeightMap->uniqueKeys(); QList<QString> languageList = languageScoreMap->keys(); for(int i = occurenceList.size() - 1; i > -1; i--) { QList<QString> sameWeightNGramList = inputWeightMap->values(occurenceList.at(i)); for(int j = 0; j < sameWeightNGramList.size(); j++) { QString nGram = sameWeightNGramList[j]; for(int k = 0; k < languageList.size(); k++) { QString language = languageList.at(k); updateScore(language, nGram, weight); } languageList = removeNonProbableLanguages(languageList, 3); if(languageList.size() == 1) { return languageList.at(0); } } weight++; } languageList = removeNonProbableLanguages(languageList, 0); return languageList.at(0); }
void GenericTetris::startGame() { clearBoard(); updateScore(0); updateLevel(1); newPiece(); }
void gameLoop() { --pipe.x; if(pipe.x < 232 && pipe.x > 160) { initPipe(); } movePipe(); //Scroll ground if(WX_REG == 0) WX_REG = 7; else --WX_REG; if(updateBird() != 0) { //Kill bird flash_frames = 0; bird_flag = FALSE; set_sprite_prop(0, S_FLIPY); set_sprite_prop(1, S_FLIPY); gameState = GAME_STATE_DEAD; } if(!pipe.counted && pipe.x+24 < bird_x) { pipe.counted = TRUE; if(score != 99) { ++score; updateScore(); } } moveBird(); }
void GameMain::settingEnd() { _gameState=GameState::END; this->unscheduleUpdate();//updateを止める updateScore(calcTimeBonus());//トタールスコアを表示 auto winSize=Director::getInstance()->getWinSize(); auto layer=Layer::create(); auto label=Label::createWithSystemFont(StringUtils::format("SCORE:%d",_score),"Marker Felt",64); label->setColor(Color3B(234,240,38)); label->setPosition(Vec2(winSize.width/2,winSize.height/2-100)); label->setOpacity(0); layer->addChild(label); auto highScore=UserDefault::getInstance()->getIntegerForKey(HIGHSCORE_KEY,0); if(_score>highScore){//ハイスコアを更新した UserDefault::getInstance()->setIntegerForKey(HIGHSCORE_KEY,_score); auto newLabel=Label::createWithSystemFont("NEW RECORD","Marker Felt",64); newLabel->setColor(label->getColor()); newLabel->setPosition(winSize/2); newLabel->setOpacity(0); newLabel->runAction(Sequence::create(DelayTime::create(1.2) ,FadeIn::create(0.3) ,NULL)); layer->addChild(newLabel); } auto sprite=Sprite::create("congratulations.png"); sprite->setScale(0); sprite->runAction(Sequence::create(ScaleTo::create(1,1) ,CallFunc::create([label](){ label->runAction(FadeIn::create(0.2)); }) ,NULL)); sprite->setPosition(Vec2(winSize.width/2,winSize.height/2+100)); layer->addChild(sprite); //新しいゲームをはじめるボタン auto newButton=MenuItemImage::create("button_new_off.png" ,"button_new_on.png" ,[this](Ref* pButton){ this->createCards(); this->resetGame(); }); newButton->setPosition(Vec2(winSize.width/2,winSize.height/2-300)); newButton->setOpacity(0); newButton->runAction(Sequence::create(DelayTime::create(1.5) ,FadeIn::create(0.5) ,NULL)); auto menu=Menu::create(newButton, NULL); menu->setPosition(Vec2::ZERO); layer->addChild(menu); this->addChild(layer,convertLayerZPositionIntoInt(LayerZPosition::COVER)); setEndLayer(layer); }
CDGNode *propagateScoreChange(CDGNode * node) { CDGNode *currNode; currNode = node; while (currNode) { updateScore(currNode, 0); currNode = getParent(currNode); } return node; }
void GameScene::play(){ _playing = true; _currentScore = 0; _score = 0; _scoreMultiplier = 0; _time = 50; updateScore(); _menuLayer->runAction(Sequence::createWithTwoActions(DelayTime::create(0), MoveTo::create(0.3, Point(-_visibleSize.width, 0)))); }
static void onWaitForPeakTimer() { if (waitForPeakTimer != NULL) { updateScore(); lastRemotePeak = 0; lastPeak = 0; } }
void Game::finish() { updateScore(m_score); m_ennemyManager.deleteEnnemies(); m_player.deleteShots(); m_score = 0; m_interface.setScore(0); contextManager->changeContext(MAINMENU_CONTEXT); }
void checkExplosion() { if (getDeadAlien() != DEAD && alien_explosion_count >= ALIEN_EXPLOSION_TICK_COUNT) { setInvaderKilledFlag(1); eraseAlienSpot(); setDeadAlien(DEAD); updateScore(); alien_explosion_count = 0; } }
void ActionManager::start(){ clearPools(); //clear all "old" date (from previous games) fighter->setVisible(true); inGame = true; gameOverTime = 0; currentScore = 0; updateScore(); enemyGenerator->reset(SETTINGS->gameMode); }
//update //************************************ // Method: update // FullName: GameScene::update // Access: public // Returns: void // Qualifier: // 1. 碰撞检测 // 2. 移除生命周期结束的对象 // 3. 检查player 的ship是否可以再次出现(如果被击毁之后) // 4. 移动背景图片 // Parameter: float dt //************************************ void GameScene::update(float dt) { auto config = Config::getInstance(); if (config->getGameSatus()) { Vector<Bullet *> temp; // update player and enemy bullets for (auto bullet : *config->player_bullet_list) { bullet->update(dt);// update bullet position auto posirion = bullet->getPosition(); if (posirion.y >= bullet->getOutVisible()) { bullet->destory(this); this->removeChild(bullet); temp.pushBack(bullet); } } if (temp.size() != 0) { for (auto bullet : temp) { config->player_bullet_list->eraseObject(bullet); } } temp.clear(); for (auto bullet : *config->enemy_bullet_list) { bullet->update(dt);// update bullet position auto posirion = bullet->getPosition(); if (posirion.y <= bullet->getOutVisible()) { bullet->destory(this); this->removeChild(bullet); temp.pushBack(bullet); } } if (temp.size() != 0) { for (auto bullet : temp) { config->enemy_bullet_list->eraseObject(bullet); } } temp.clear(); this->checkPeng(dt); //update score updateScore(dt); } }
int Display::showFeatures(IplImage *pImage1, IplImage *pImage2, float score) { int keyb = -1; if (score < _minScore) _minScore = score; _totalScore += score; _totalCount++; if (_displayingPreview) { cvDestroyWindow("Preview"); _displayingPreview = false; } if (Config::_FeatureDisplay) { // create windows if not already done if (! _displayingFeatures) { cvNamedWindow("Features", CV_WINDOW_NORMAL); cvResizeWindow("Features", NBPIXELS_WIDTH, NBPIXELS_HEIGHT*2); cvMoveWindow("Features", FEAT_POSX, FEAT_POSY); // offset from the UL corner of the screen cvNamedWindow("Quality", CV_WINDOW_AUTOSIZE); cvMoveWindow("Quality", INFO_POSX, INFO_POSY); // offset from the UL corner of the screen _displayingFeatures = true; } } updateScore(score); if (_displayingFeatures) { // update image buffer by stacking the 2 frames memcpy(_pImgFeatures->imageData, pImage1->imageData, pImage1->imageSize); memcpy(_pImgFeatures->imageData+(pImage1->imageSize), pImage2->imageData, pImage2->imageSize); cvShowImage("Features", _pImgFeatures); cvShowImage("Quality", _pImgInfo); keyb = cvWaitKey(CV_WAITKEY_TIMEOUT); if (! Config::_FeatureDisplay) { // destroy windows - asynchronous, it will be handled in event loop (cvWaitKey) cvShowImage("Features", NULL); cvShowImage("Quality", NULL); cvResizeWindow("Features", 1, 1); cvResizeWindow("Quality", 1, 1); cvDestroyWindow("Features"); cvDestroyWindow("Quality"); cvWaitKey(CV_WAITKEY_TIMEOUT); _displayingFeatures = false; } } // the opencv windows won't close until handled in event loop, so give a chance each time // a longer timeout has no effect here... int keyb2 = cvWaitKey(1); if (keyb==-1) keyb = keyb2; return keyb; }