コード例 #1
0
//
// calculateTimeElapsed()
//
//   Returns the number of seconds since the demo started playing
//
int NetDemo::calculateTimeElapsed()
{
    if (!isPlaying() && !isPaused())
        return 0;

    int elapsed = netdemotic / TICRATE;
    int totaltime = calculateTotalTime();

    if (elapsed > totaltime)
        return totaltime;

    return elapsed;
}
コード例 #2
0
void DBGProfileListViewItem::loadData(int view)
{
  if(isRoot())
  {
    switch(view)
    {
      case DBGProfileListView::ModuleView:
        setText(DBGProfileListView::LocationCol, m_data->location()->moduleName().section('/',-1));
        break;
      case DBGProfileListView::ContextView:
        setText(DBGProfileListView::LocationCol, m_data->location()->contextName());
        break;
      case DBGProfileListView::DetailedView:
        setText(DBGProfileListView::LocationCol, m_data->location()->moduleName().section('/',-1));
        setText(DBGProfileListView::LineCol, QString::number(m_data->location()->line()));
        setText(DBGProfileListView::HitsCol, QString::number(m_data->hitCount()));
        setText(DBGProfileListView::AvgCol, QString().sprintf("%.3f", m_data->timeAvgHit()));
        setText(DBGProfileListView::TotalCol, QString().sprintf("%.3f", m_data->totalTime()));
        setText(DBGProfileListView::MinCol, QString().sprintf("%.3f", m_data->minTime()));
        setText(DBGProfileListView::MaxCol, QString().sprintf("%.3f", m_data->maxTime()));
        break;
    }
    //     this->moveItem(lastItem());
  }
  else
  {
    setText(DBGProfileListView::LocationCol, m_data->location()->moduleName().section('/',-1));
    setText(DBGProfileListView::LineCol, QString::number(m_data->location()->line()));
    setText(DBGProfileListView::HitsCol, QString::number(m_data->hitCount()));
    setText(DBGProfileListView::AvgCol, QString().sprintf("%.3f", m_data->timeAvgHit()));
    setText(DBGProfileListView::TotalCol, QString().sprintf("%.3f", m_data->totalTime()));
    setText(DBGProfileListView::MinCol, QString().sprintf("%.3f", m_data->minTime()));
    setText(DBGProfileListView::MaxCol, QString().sprintf("%.3f", m_data->maxTime()));
    calculateTotalTime();
  }
}