本文整理汇总了C++中RequestBall::logic方法的典型用法代码示例。如果您正苦于以下问题:C++ RequestBall::logic方法的具体用法?C++ RequestBall::logic怎么用?C++ RequestBall::logic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestBall
的用法示例。
在下文中一共展示了RequestBall::logic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logic
void Logstalgia::logic(float t, float dt) {
float sdt = dt * settings.simulation_speed;
//increment clock
elapsed_time += sdt;
currtime = starttime + (long)(elapsed_time);
if(settings.stop_time && currtime > settings.stop_time) {
currtime = settings.stop_time;
}
if(mousehide_timeout>0.0f) {
mousehide_timeout -= dt;
if(mousehide_timeout<0.0f) {
SDL_ShowCursor(false);
}
}
infowindow.hide();
if(end_reached && balls.empty()) {
appFinished = true;
return;
}
//if paused, dont move anything, only check what is under mouse
if(paused) {
for(auto& it: paddles) {
Paddle* paddle = it.second;
if(paddle->mouseOver(infowindow, mousepos)) {
break;
}
}
for(RequestBall* ball : balls) {
if(ball->mouseOver(infowindow, mousepos)) {
break;
}
}
if(!ipSummarizer->mouseOver(infowindow,mousepos)) {
for(Summarizer* s: summarizers) {
if(s->mouseOver(infowindow, mousepos)) break;
}
}
return;
}
//next will fast forward clock to the time of the next entry,
//if the next entry is in the future
if(next || (!settings.disable_auto_skip && balls.empty())) {
if(!queued_entries.empty()) {
LogEntry* le = queued_entries.front();
long entrytime = le->timestamp;
if(entrytime > currtime) {
elapsed_time = entrytime - starttime;
currtime = starttime + (long)(elapsed_time);
}
}
next = false;
}
//recalc spawn speed each second by
if(currtime != lasttime) {
//dont bother reading the log if we dont need to
if(queued_entries.empty() || queued_entries.back()->timestamp <= currtime) {
readLog();
}
profile_start("determine new entries");
int items_to_spawn=0;
for(LogEntry* le : queued_entries) {
if(le->timestamp > currtime) break;
items_to_spawn++;
addStrings(le);
}
profile_stop();
//debugLog("items to spawn %d\n", items_to_spawn);
if(items_to_spawn > 0) {
profile_start("add new strings");
//re-summarize
ipSummarizer->summarize();
for(Summarizer* s : summarizers) {
//.........这里部分代码省略.........