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;
          }
        }
      }
    }
  }

}
예제 #2
0
void Arc::delay( double millis )
{
    Timer delayTimer = Timer();

    delayTimer.start();
    delayTimer.sleepUntilElapsed(millis);
}
예제 #3
0
void LoomWidget::LoomUp()
{
    _loom_mode = true;
      _running = true;
    _loom_time = Timer();
    Widget::SetDirty();
}
예제 #4
0
파일: main.cpp 프로젝트: AIexei/CursTetris
// 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 ();
}
예제 #5
0
파일: party.cpp 프로젝트: qiuhw/tmwa
// 初期化
void do_init_party(void)
{
    Timer(gettick() + PARTY_SEND_XYHP_INVERVAL,
            party_send_xyhp_timer,
            PARTY_SEND_XYHP_INVERVAL
    ).detach();
}
예제 #6
0
/*
 * 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;
}
예제 #7
0
파일: npc.cpp 프로젝트: GermanTMW2015/tmwa
/// 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);
}
예제 #8
0
int MEPdfPartialB::TryParameters(RooDataSet *ds){
  FixAll();
  pdf_part->fitTo(*ds,Verbose(),Timer(true));
  Draw(ds);
  PrintParameters();
  return 0;
}
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);
}
예제 #10
0
void LoomWidget::Vanish()
{
    _loom_mode = false;
      _running = true;
    _loom_time = Timer();
    Widget::SetDirty();
}
TestResults TestingSuite::runAppendTestsForArray(int repeats)
{
	Timer timer;
	Array * arr;
	double avgTime = 0;
	for (int i = 0; i < repeats; i++) {
		timer = Timer();
		arr = new Array();
		if(randomizeEachRepeat) prepareTestData();
		
		timer.startTimer();
		for (int q = 0; q < dataSize; q++) {
			arr->append(randomData[q]);
		}
		timer.endTimer();

		avgTime += timer.getTimeInNanoseconds();

		delete arr;
	}

	avgTime = avgTime / (double)repeats;

	return TestResults("Array Append Test", dataSize, avgTime);
}
예제 #12
0
void CameraNode::render()
{
    if (m_bIsPlaying) {
        ScopeTimer Timer(CameraProfilingZone);
        blt32(getTransform(), getSize(), getEffectiveOpacity(), getBlendMode());
    }
}
예제 #13
0
// ######################################################################
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);
	}
}
예제 #14
0
void ImageNode::render(GLContext* pContext, const glm::mat4& transform)
{
    ScopeTimer Timer(RenderProfilingZone);
    if (m_pGPUImage->getSource() != GPUImage::NONE) {
        blt32(pContext, transform);
    }
}
예제 #15
0
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);
}
예제 #16
0
파일: NaLinCon.cpp 프로젝트: evlad/nnacs
//---------------------------------------------------------------------------
// 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;
    }
}
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);
	}
}
TestResults TestingSuite::runAppendTestsForList(int repeats)
{
	Timer timer;
	List * list;
	double avgTime = 0;
	for (int i = 0; i < repeats; i++) {
		timer = Timer();
		list = new List();
		if (randomizeEachRepeat) prepareTestData();
		
		timer.startTimer();
		for (int q = 0; q < dataSize; q++) {
			list->append(randomData[q]);
		}
		timer.endTimer();

		avgTime += timer.getTimeInNanoseconds();

		delete list;
	}

	avgTime = avgTime / (double)repeats;

	return TestResults("List Append Test", dataSize, avgTime);
}
예제 #19
0
파일: unittest.cpp 프로젝트: aveminus/freq
int UnitTest::
        test(bool rethrow_exceptions)
{
    try {
        Timer(); // Init performance counting
        TaskTimer tt("Running tests");

        RUNTEST(Tfr::FreqAxis);
        RUNTEST(Tfr::StftDesc);
        RUNTEST(Tfr::DummyTransform);
        RUNTEST(Tfr::DummyTransformDesc);
        RUNTEST(Tfr::TransformOperationDesc);

    } catch (const ExceptionAssert& x) {
        if (rethrow_exceptions)
            throw;

        char const * const * f = boost::get_error_info<boost::throw_file>(x);
        int const * l = boost::get_error_info<boost::throw_line>(x);
        char const * const * c = boost::get_error_info<ExceptionAssert::ExceptionAssert_condition>(x);
        std::string const * m = boost::get_error_info<ExceptionAssert::ExceptionAssert_message>(x);

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("%s:%d: %s. %s\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % (f?*f:0) % (l?*l:-1) % (c?*c:0) % (m?*m:0) % boost::diagnostic_information(x) % lastname ).c_str());
        fflush(stderr);
        return 1;
    } catch (const exception& x) {
        if (rethrow_exceptions)
            throw;

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("%s\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % vartype(x) % boost::diagnostic_information(x) % lastname ).c_str());
        fflush(stderr);
        return 1;
    } catch (...) {
        if (rethrow_exceptions)
            throw;

        fflush(stdout);
        fprintf(stderr, "%s",
                str(boost::format("Not an std::exception\n"
                                  "%s\n"
                                  " FAILED in %s::test()\n\n")
                    % boost::current_exception_diagnostic_information () % lastname ).c_str());
        fflush(stderr);
        return 1;
    }

    printf("\n OK\n\n");
    return 0;
}
예제 #20
0
int MEPdfPartialB::FitParameters(RooDataSet *ds,const bool etaggflag){
  FreeAll();
  if(etaggflag) k_s_mbc_part->setConstant(kTRUE);
  pdf_part->fitTo(*ds,Verbose(),Timer(true));
  Draw(ds);
  PrintParameters();
  return 0;
}
예제 #21
0
void Time_measurement::tick(const std::string &timer_name)
{
	if (enabled) {
		if (timers.find(timer_name) != timers.end())
			throw std::runtime_error("Timer with name \"" + timer_name + "\" already exists.");
		timers[timer_name] = Timer(base_point);
	}
}
예제 #22
0
파일: NPC.cpp 프로젝트: bennybroseph/Engine
void NPC::Handle(Layer_Class* Mask_Temp, float temp_x, float temp_y)
{
   Mask = Mask_Temp;
   px = temp_x;py = temp_y;
   Timer();
   Move();
   Animate();
}
예제 #23
0
PWM::PWM(uint32_t freq, float duty, uint8_t TIM_No, uint8_t CH_No,PinTypedef pin) {
  tim_ = Timer(TIM_No);
  freq_ = freq;
  duty_ = duty;
  CH_No_ = CH_No;
  pin_ = pin;
  tim_.mode_pwm_output(freq, duty, CH_No, pin);
}
예제 #24
0
CSweepingWind::CSweepingWind(void)
{
	CEntity::m_eType = ENT_SWEEPING_WIND;
	GetAnimInfo()->SetAnimationName("Wind_Special");

	SetSpeed(400.0f);
	Timer(1.7f);
}
예제 #25
0
void FilledVectorNode::render(GLContext* pContext, const glm::mat4& transform)
{
    ScopeTimer Timer(RenderProfilingZone);
    if (m_EffectiveOpacity > 0.01) {
        m_pFillShape->draw(pContext, transform, m_EffectiveOpacity);
    }
    VectorNode::render(pContext, transform);
}
예제 #26
0
파일: Canvas.cpp 프로젝트: cnxsoft/xibo4arm
void Canvas::render(IntPoint windowSize, bool bUpsideDown, FBOPtr pFBO,
        ProfilingZoneID& renderProfilingZone)
{
    {
        ScopeTimer Timer(PreRenderProfilingZone);
        m_pRootNode->preRender();
    }
    if (pFBO) {
        pFBO->activate();
    } else {
        glproc::BindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
        GLContext::getCurrent()->checkError("Canvas::render: BindFramebuffer()");
    }
    if (m_MultiSampleSamples > 1) {
        glEnable(GL_MULTISAMPLE);
        GLContext::getCurrent()->checkError( 
                "Canvas::render: glEnable(GL_MULTISAMPLE)");
    } else {
        glDisable(GL_MULTISAMPLE);
        GLContext::getCurrent()->checkError(
                "Canvas::render: glDisable(GL_MULTISAMPLE)");
    }
    clearGLBuffers(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glViewport(0, 0, windowSize.x, windowSize.y);
    GLContext::getCurrent()->checkError("Canvas::render: glViewport()");
    glMatrixMode(GL_PROJECTION);
    GLContext::getCurrent()->checkError("Canvas::render: glMatrixMode()");
    glLoadIdentity();
    GLContext::getCurrent()->checkError("Canvas::render: glLoadIdentity()");
    glm::vec2 size = m_pRootNode->getSize();
    if (bUpsideDown) {
        gluOrtho2D(0, size.x, 0, size.y);
    } else {
        gluOrtho2D(0, size.x, size.y, 0);
    }
    GLContext::getCurrent()->checkError("Canvas::render: gluOrtho2D()");
    
    glMatrixMode(GL_MODELVIEW);
    {
        ScopeTimer Timer(renderProfilingZone);
        m_pRootNode->maybeRender();

        renderOutlines();
    }
}
예제 #27
0
Enemy::Enemy( World * parentWorld, string name,
			  int maxHealth, int damage,
			  PhysicalProperties physicalProperties,
			  PhysicsComponent * physics,
			  InputComponent * input ) : 
    Actor( parentWorld, name, maxHealth, damage, 50, physicalProperties, physics, input )
{
	timers["shooting"] = Timer( 2000 );
}
예제 #28
0
/*==========================================
 * 初期化
 *------------------------------------------
 */
void do_init_script(void)
{
    script_load_mapreg();

    Timer(gettick() + MAPREG_AUTOSAVE_INTERVAL,
            script_autosave_mapreg,
            MAPREG_AUTOSAVE_INTERVAL
    ).detach();
}
예제 #29
0
void FilledVectorNode::render()
{
    ScopeTimer Timer(RenderProfilingZone);
    float curOpacity = getParent()->getEffectiveOpacity()*m_FillOpacity;
    if (curOpacity > 0.01) {
        m_pFillShape->draw(getParentTransform(), curOpacity);
    }
    VectorNode::render();
}
예제 #30
0
void TasksRunner::SetBurstCounterTaskPeriod(int period)
{
	if (Timer)
	{
		burstsCounterTimer = Timer(period);
		burstsCounterTimer->Elapsed = boost::bind(&hostapp::TasksRunner::RunBurstCounterTask, this, _1);
		return;
	}
	LOG_ERROR_APP("[TaskRunner]: no timer function for burst_counters task");
}