Exemplo n.º 1
0
//----------------------------------------------------------------------------
void MainFrame::OnTimer (wxTimerEvent& event)
{
	if (mInited)
	{
		int ival = event.GetInterval();
		double dIval = ival/1000.0;

		EditSystem::GetSingleton().Update(dIval);
	}
}
Exemplo n.º 2
0
void nwxShiftSizer::OnTimer(wxTimerEvent &e)
{
  if(m_pCurrent != NULL)
  {
    m_nTotalInterval += e.GetInterval();
    if(m_nTotalInterval >= m_nWaitInterval)
    {
      _DoShift();
      m_nTotalInterval = 0;
    }
  }
}
Exemplo n.º 3
0
void TimerManager::OnPeriodicTimer(wxTimerEvent &event)
{
	// Get the resolution out of the event, which is the key to everything.
	size_t resolution = event.GetInterval();

	PeriodicMap::iterator itMap = mPeriodicMap.find(resolution);
	
	// Sanity check.
	if(mPeriodicMap.end() == itMap)
	{
		wxASSERT(false);
		mPeriodicMap.erase(itMap);

		mTimerMap[resolution]->Stop();
		mTimerMap.erase(mTimerMap.find(resolution));
	}
	else
	{
		PeriodicFunctionList &periodics = itMap->second;
			
		// Fire the events.
		PeriodicFunctionList::iterator it = periodics.begin(), itThis, 
			itEnd = periodics.end();
		while(it != itEnd)
		{
			itThis = it++;
			
			if ((*itThis).first)
			{
				it = periodics.erase(itThis);
			}
			else
			{
				(*itThis).second();
			}
		}

		// Remove the entry if there's nothing left.
		if(true == periodics.empty())
		{
			mPeriodicMap.erase(itMap);

			mTimerMap[resolution]->Stop();
			mTimerMap.erase(mTimerMap.find(resolution));
		}
	}
}
Exemplo n.º 4
0
//----------------------------------------------------------------------------
void RenderView::OnTimer(wxTimerEvent& event)
{
	int ival = event.GetInterval();
	double dIval = ival / 1000.0;

	if (mTimerID == event.GetId())
	{
		std::map<std::string, PX2::EditRenderViewPtr>::iterator it
			= mEditRenderViews.begin();
		for (; it != mEditRenderViews.end(); it++)
		{
			EditRenderView *renderView = it->second;
			if (renderView)
			{
				renderView->Tick(dIval);
			}
		}
	}
}
Exemplo n.º 5
0
void cMainGUI::OnStateTimer(wxTimerEvent &p_Event)
{
    // Get true elapsed time
    double v_ElapsedTime = m_StopWatch.Time();
    m_StopWatch.Start();

    // If elapsed time > timer interval + 10%, then slow down timer interval
    double v_TimeStep = p_Event.GetInterval();
    if(v_ElapsedTime > 1.1*v_TimeStep)
    {
        bool v_TimerStarted = m_StateTimer.Start(v_TimeStep*2);
        if(not v_TimerStarted)
        {
            std::cout << "ERROR in cMainGUI::OnStateTimer: timer not started." << std::endl;
        } else {
            std::cout << "WARNING in cMainGUI::OnStateTimer: slowing down timer: " << v_TimeStep << "|" << v_ElapsedTime << std::endl;
        }
    } else if(v_ElapsedTime < 0.9*v_TimeStep)
    {
        bool v_TimerStarted = m_StateTimer.Start(v_TimeStep/2);
        if(not v_TimerStarted)
        {
            std::cout << "ERROR in cMainGUI::OnStateTimer: timer not started." << std::endl;
        } else {
            std::cout << "WARNING in cMainGUI::OnStateTimer: speeding up timer: " << v_TimeStep << "|" << v_ElapsedTime << std::endl;
        }
    }


    // Calculate new time
    v_ElapsedTime = 0.1; //= 1000.0;
    m_Time += v_ElapsedTime;

    // Calculate new object state
    if(m_Object) m_Object->CalculateState(v_ElapsedTime);
}
//! @brief Is called every 1/10 seconds to update statuses
void SpringLobbyApp::OnTimer( wxTimerEvent& event )
{
    ui().OnUpdate( event.GetInterval() );
}
void CDialogVolumes::OnTimer(wxTimerEvent &e) // called from mainFrame
{
  m_volumes.RefreshLocksOnTimer(e.GetInterval());
}