当前位置: 首页>>代码示例>>C++>>正文


C++ Timer函数代码示例

本文整理汇总了C++中Timer函数的典型用法代码示例。如果您正苦于以下问题:C++ Timer函数的具体用法?C++ Timer怎么用?C++ Timer使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Timer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Timer

void __fastcall TPrintRecord::BitBtn1MouseMove(TObject *Sender,
      TShiftState Shift, int X, int Y)
{
  // get selected name
  AnsiString Dname;
  for(int i=0;i<ListBox1->Items->Count;i++)
  {
    if (ListBox1->Selected[i])
    {
     Dname=ListBox1->Items->Strings[i];
     break;
    }
  }
//Label1->Caption=Dname;
  if(Dname.Length()>1)
  {
    for(int t=0;t<Panel2->ControlCount;t++)
    {
      if (Panel2->Controls[t]->ClassNameIs("TStaticText"))
      {
        label=dynamic_cast<TStaticText*>(Panel2->Controls[t]);
        if(label->Name == Dname)
        {
          if(label->Left > 0)
          {
          label->Left=label->Left-1;
          Timer(50);
//          break;
          }
        }
      }
    }
  }

}
开发者ID:Spidersbox,项目名称:CBuilder6-CMXed,代码行数:35,代码来源:Copy+(2)+of+PrintRecordForm.cpp

示例2: Timer

void Arc::delay( double millis )
{
    Timer delayTimer = Timer();

    delayTimer.start();
    delayTimer.sleepUntilElapsed(millis);
}
开发者ID:RyanHuggins,项目名称:ProjectFall,代码行数:7,代码来源:TimeFunc.cpp

示例3: Timer

void LoomWidget::LoomUp()
{
    _loom_mode = true;
      _running = true;
    _loom_time = Timer();
    Widget::SetDirty();
}
开发者ID:BackupTheBerlios,项目名称:utgs-svn,代码行数:7,代码来源:LoomWidget.cpp

示例4: KeyPressed

// this function has 3 arguments 
// the first is the key and the rest are coordinates of the mouse
void KeyPressed (int Key, int x, int y) {
	if ((ScreenType != GAME_ARCADE) && (ScreenType != GAME_CLASSIC)) return;

	switch (Key) {
	case GLUT_KEY_LEFT :
		if (!Pause)
			Tetris.KeyEvent (Game::LEFT);
		break;
	case GLUT_KEY_RIGHT :
		if (!Pause)
			Tetris.KeyEvent (Game::RIGHT);
		break;
	case GLUT_KEY_UP :
		if (!Pause)	
			Tetris.KeyEvent (Game::UP);
		break;
	case GLUT_KEY_DOWN :
		if (!Pause) 
			Tetris.KeyEvent (Game::DOWN);
		break;
	case GLUT_KEY_F1 :
		Pause = !Pause;
		if (!Pause) 
			Timer (0);
		break;
	}

	DisplayGame ();
}
开发者ID:AIexei,项目名称:CursTetris,代码行数:31,代码来源:main.cpp

示例5: do_init_party

// 初期化
void do_init_party(void)
{
    Timer(gettick() + PARTY_SEND_XYHP_INVERVAL,
            party_send_xyhp_timer,
            PARTY_SEND_XYHP_INVERVAL
    ).detach();
}
开发者ID:qiuhw,项目名称:tmwa,代码行数:8,代码来源:party.cpp

示例6: ISendRecvSediBedData3D

/*
 * Function: ISendRecvSediBedData3D
 * Usage: ISendRecvSediBedData3D(SediCbed or Thickness,grid,myproc,comm);
 * ----------------------------------------------------
 * This function will transfer the 3D cell data for sediment bed back and forth between
 * processors using nonblocking sends/recvs.
 *
 */
void ISendRecvSediBedData3D(REAL **celldata, gridT *grid, int nlayer,int myproc,MPI_Comm comm) {
  int k, n, nstart, neigh, neighproc;
  REAL t0=Timer();
  
  for(neigh=0;neigh<grid->Nneighs;neigh++) {
    neighproc = grid->myneighs[neigh];
    
    nstart=0;
    for(n=0;n<grid->num_cells_send[neigh];n++) {
      for(k=0;k<nlayer;k++) 
        grid->send[neigh][nstart+k]=celldata[grid->cell_send[neigh][n]][k];
      nstart+=nlayer;
    }
    
    MPI_Isend((void *)(grid->send[neigh]),grid->total_cells_send[neigh],MPI_DOUBLE,neighproc,1,
	      comm,&(grid->request[neigh])); 
  }
  
  for(neigh=0;neigh<grid->Nneighs;neigh++) {
    neighproc = grid->myneighs[neigh];
    MPI_Irecv((void *)(grid->recv[neigh]),grid->total_cells_recv[neigh],MPI_DOUBLE,neighproc,1,
	      comm,&(grid->request[grid->Nneighs+neigh]));
  }
  MPI_Waitall(2*grid->Nneighs,grid->request,grid->status);
  
  for(neigh=0;neigh<grid->Nneighs;neigh++) {
    nstart=0;
    for(n=0;n<grid->num_cells_recv[neigh];n++) {
      for(k=0;k<nlayer;k++) 
        celldata[grid->cell_recv[neigh][n]][k]=grid->recv[neigh][nstart+k];
      nstart+=nlayer;
    }
  }
  // t_comm+=Timer()-t0;
}
开发者ID:ofringer,项目名称:suntans,代码行数:43,代码来源:sediments.c

示例7: npc_timerevent

/// Callback for npc OnTimer*: labels.
/// This will be called later if you call npc_timerevent_start.
/// This function may only expire, but not deactivate, the counter.
static
void npc_timerevent(TimerData *, tick_t tick, BlockId id, interval_t data)
{
    dumb_ptr<npc_data_script> nd = map_id2bl(id)->is_npc()->is_script();
    assert (nd != nullptr);
    assert (nd->npc_subtype == NpcSubtype::SCRIPT);
    assert (nd->scr.next_event != nd->scr.timer_eventv.end());

    nd->scr.timertick = tick;
    const auto te = nd->scr.next_event;
    // nd->scr.timerid = nullptr;

    // er, isn't this the same as nd->scr.timer = te->timer?
    interval_t t = nd->scr.timer += data;
    assert (t == te->timer);
    ++nd->scr.next_event;
    if (nd->scr.next_event != nd->scr.timer_eventv.end())
    {
        interval_t next = nd->scr.next_event->timer - t;
        nd->scr.timerid = Timer(tick + next,
                std::bind(npc_timerevent, ph::_1, ph::_2,
                    id, next));
    }

    run_script(ScriptPointer(borrow(*nd->scr.script), te->pos), BlockId(), nd->bl_id);
}
开发者ID:GermanTMW2015,项目名称:tmwa,代码行数:29,代码来源:npc.cpp

示例8: FixAll

int MEPdfPartialB::TryParameters(RooDataSet *ds){
  FixAll();
  pdf_part->fitTo(*ds,Verbose(),Timer(true));
  Draw(ds);
  PrintParameters();
  return 0;
}
开发者ID:VitalyVorobyev,项目名称:B0toD0h0,代码行数:7,代码来源:mepdfpartialb.cpp

示例9: Timer

TestResults TestingSuite::runAppendTestsForHeap(int repeats)
{
	Timer timer;
	Heap * heap;
	double avgTime = 0;
	for (int i = 0; i < repeats; i++) {
		timer = Timer();
		heap = new Heap();
		if (randomizeEachRepeat) prepareTestData();
		
		timer.startTimer();
		for (int q = 0; q < dataSize; q++) {
			heap->insert(randomData[q]);
		}
		timer.endTimer();

		avgTime += timer.getTimeInNanoseconds();

		delete heap;
	}

	avgTime = avgTime / (double)repeats;

	return TestResults("Heap Insert Test", dataSize, avgTime);
}
开发者ID:Dzejkop,项目名称:SDiZO-Struktury-Danych,代码行数:25,代码来源:TestingSuite.cpp

示例10: Timer

void CameraNode::render()
{
    if (m_bIsPlaying) {
        ScopeTimer Timer(CameraProfilingZone);
        blt32(getTransform(), getSize(), getEffectiveOpacity(), getBlendMode());
    }
}
开发者ID:cnxsoft,项目名称:xibo4arm,代码行数:7,代码来源:CameraNode.cpp

示例11: HawkAgent

// ######################################################################
HawkScanner::HawkScanner(std::string myName, int argc, char* argv[])
: HawkAgent(myName, argc, argv) {
	// Help section
	helpTitle = "HawkScanner";
	helpDescription = "Interface between the URG-04LX-UG01 laser scanner and ICE.";
	helpOptions.push_back("\t--refreshPeriod\t(100000) Microseconds between each scanner message.");
	
	// Parameters
	refreshPeriod = loadIntParameter("refreshPeriod", 100000);
	
	if(!helpParameter()) {
		// Setup to laser scanner
		if(!urg.connect(SCANNER_ADDRESS)) {
			printf("UrgCtrl::connect: %s\n", urg.what());
			exit(1);
		}
	
		// Print useful parameters
		std::cout << "frontIndex: " << urg.rad2index(0.0) << std::endl;
		std::cout << "halfRangeRadians: " << urg.index2rad(0) << std::endl;
		std::cout << "maxScanLines: " << urg.maxScanLines() << std::endl;
	
		// Setup timer
		timer = Timer(1000000);
	}
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:27,代码来源:HawkScanner.C

示例12: Timer

void ImageNode::render(GLContext* pContext, const glm::mat4& transform)
{
    ScopeTimer Timer(RenderProfilingZone);
    if (m_pGPUImage->getSource() != GPUImage::NONE) {
        blt32(pContext, transform);
    }
}
开发者ID:ming-hai,项目名称:libavg,代码行数:7,代码来源:ImageNode.cpp

示例13: TNLAssert

void TeamHistoryManager::addPlayer(const string &name, S32 teamCount, S32 teamIndex)
{
    TNLAssert(teamCount > 0, "Surely there's at least one team here!");

    // No need to track which team players are on in a 1-team game... so we won't!
    if(teamCount <= 1)
        return;

    // See if we already know this player
    if(mNames.getIndex(name) == -1)
    {
        mNames.push_back(name);
        mTimers.push_back(Timer(LockedTeamsForgetClientTime));
        mTimers.last().clear();    // Don't start timer until player quits
    }

    // Make sure we have enough slots available for this teamCount
    // Use teamCount - 2 because Vectors are 0-based, and there are no 0-team configurations;
    //    furthermore, with 1-team configuration, we know everyone is on team 1, so don't bother with it.
    // +1 because slots are a count of how many spots we need, which is inherently 1-indexed.
    S32 slotsRequired = teamCount - 2 + 1;
    if(mTeamAssignmentNames.size() < slotsRequired)
    {
        mTeamAssignmentNames.resize(slotsRequired);
        mTeamAssignmentTeams.resize(slotsRequired);
    }

    // Is player already known to this configuration?
    if(mTeamAssignmentNames[teamCount - 2].getIndex(name) != -1)
        return;

    mTeamAssignmentNames[teamCount - 2].push_back(name);
    mTeamAssignmentTeams[teamCount - 2].push_back(teamIndex);
}
开发者ID:bitfighter,项目名称:bitfighter,代码行数:34,代码来源:TeamHistoryManager.cpp

示例14: switch

//---------------------------------------------------------------------------
// Reset operations, that must be done before new modelling
// will start
void    NaLinearUnit::Reset ()
{
    int d;

    // Reset delay vector
    yd.clean();

    switch(kind){
    case lckGain:
    case lckDifferential:
        // No delay is needed
        break;
    case lckInertial:
    case lckIntegral:
    case lckDiffStatic:
        // 1st order units
        yd.addh(new NaReal(0.0));
        break;
    case lckOscillation:
    case lckConservative:
        // 2nd order units
        yd.addh(new NaReal(0.0));
        yd.addh(new NaReal(0.0));
        break;
    case lckDelay:
        // High order unit
        d = 1 + (int)(Tau / Timer().GetSamplingRate());
        while(d-- != 0)
            yd.addh(new NaReal(0.0));
        break;
    }
}
开发者ID:evlad,项目名称:nnacs,代码行数:35,代码来源:NaLinCon.cpp

示例15: glClear

void QtInterface::paintGL()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	Engine()->Render();

	if ( Input()->KeyPressed( KEY_F5 ) )
	{
#ifdef _WIN32 // TODO: Update DevIl installation on linux to match newest version
		ilutGLScreenie();
#endif
	}

	m_iFrameCount += 1;
	float curtime = Timer()->CurrentTime();
	float dt = curtime - m_flLastTime;

	if ( dt >= 1.0f )
	{
		m_flFPS = (m_iFrameCount / dt);
		m_flLastTime = curtime;
		m_iFrameCount = 0;
	}
	
	if ( m_flFPS != 0.0f ) 
	{
		QString str;
		str.sprintf("%.2f fps (%.5f ms), time: %.2f", m_flFPS, (1.0f/m_flFPS), curtime);

		renderText(1, 10, str);
	}
}
开发者ID:Islandstone,项目名称:MagnificentGameEngine2,代码行数:33,代码来源:qt_gl_interface.cpp


注:本文中的Timer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。