本文整理汇总了C++中Paddle::recentering方法的典型用法代码示例。如果您正苦于以下问题:C++ Paddle::recentering方法的具体用法?C++ Paddle::recentering怎么用?C++ Paddle::recentering使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paddle
的用法示例。
在下文中一共展示了Paddle::recentering方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logic
//.........这里部分代码省略.........
if(queued_entries.empty() || queued_entries.back()->timestamp <= currtime+1) {
readLog(50);
}
}
std::list<Paddle*> inactivePaddles;
//update paddles
for(std::map<std::string, Paddle*>::iterator it= paddles.begin(); it!=paddles.end();it++) {
std::string paddle_token = it->first;
Paddle* paddle = it->second;
if(gPaddleMode > PADDLE_SINGLE && !paddle->moving() && !paddle->visible()) {
bool token_match = false;
//are there any requests that will match this paddle?
for(std::list<RequestBall*>::iterator bit = balls.begin(); bit != balls.end();bit++) {
RequestBall* ball = *bit;
if( gPaddleMode == PADDLE_VHOST && ball->le->vhost == paddle_token
|| gPaddleMode == PADDLE_PID && ball->le->pid == paddle_token) {
token_match = true;
break;
}
}
//mark this paddle for deletion, continue
if(!token_match) {
inactivePaddles.push_back(paddle);
continue;
}
}
// find nearest ball to this paddle
if((recentre || !paddle->moving()) && balls.size()>0) {
recentre=false;
RequestBall* ball = findNearest(paddle, paddle_token);
if(ball!=0 && !(paddle->moving() && paddle->getTarget() == ball)) {
paddle->setTarget(ball);
}
}
//if still not moving, recentre
if((!paddle->recentering()) && (!paddle->moving())) {
recentre=true;
paddle->setTarget(0);
}
it->second->logic(sdt);
}
recentre = false;
profile_start("check ball status");
for(std::list<RequestBall*>::iterator it = balls.begin(); it != balls.end();) {
RequestBall* ball = *it;
highscore += ball->logic(dt);
if(ball->isFinished()) {
it = balls.erase(it);
removeBall(ball);
} else {
it++;
}
}
profile_stop();
profile_start("ipSummarizer logic");
ipSummarizer->logic(dt);
profile_stop();
profile_start("updateGroups logic");
updateGroups(dt);
profile_stop();
screen_blank_elapsed += dt;
if(screen_blank_elapsed-screen_blank_interval > screen_blank_period)
screen_blank_elapsed = 0.0f;
//update font alpha
font_alpha = 1.0f;
if(screen_blank_elapsed>screen_blank_interval) {
font_alpha = std::min(1.0f, (float) fabs(1.0f - (screen_blank_elapsed-screen_blank_interval)/(screen_blank_period*0.5)));
font_alpha *= font_alpha;
}
}