/// Variant of the standard TieCheckBox which does the two step exchange /// between gui and stack variable and stack variable and shuttle. void ShuttleGuiBase::TieCheckBox( const wxString &Prompt, const wxString &SettingName, const bool bDefault) { bool bValue=bDefault; WrappedType WrappedRef( bValue ); if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef ); if( DoStep(2) ) TieCheckBox( Prompt, WrappedRef ); if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef ); }
/// Variant of the standard TieTextBox which does the two step exchange /// between gui and stack variable and stack variable and shuttle. /// This one does it for double values... void ShuttleGuiBase::TieTextBox( const wxString & Prompt, const wxString & SettingName, const double & Default, const int nChars) { double Temp = Default; WrappedType WrappedRef( Temp ); if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef ); if( DoStep(2) ) TieTextBox( Prompt, WrappedRef, nChars ); if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef ); }
void InterpreterDisAsmFrame::OnKeyDown(wxKeyEvent& event) { if(wxGetActiveWindow() != wxGetTopLevelParent(this)) { event.Skip(); return; } if(event.ControlDown()) { if(event.GetKeyCode() == WXK_SPACE) { DoStep(wxCommandEvent()); return; } } else { switch(event.GetKeyCode()) { case WXK_PAGEUP: ShowAddr( PC - (m_item_count * 2) * 4 ); return; case WXK_PAGEDOWN: ShowAddr( PC ); return; case WXK_UP: ShowAddr( PC - (m_item_count + 1) * 4 ); return; case WXK_DOWN: ShowAddr( PC - (m_item_count - 1) * 4 ); return; } } event.Skip(); }
void sdgEngine::DoCycle(float dist_pace, float vol_pace) { for (int i = 0; i < _nSteps; ++i) { DoStep(dist_pace, vol_pace); } }
void Integrator::step( int steps ) { timeval start, end; gettimeofday( &start, 0 ); mSimpleMinimizations = 0; mQuadraticMinimizations = 0; for( mLastCompleted = 0; mLastCompleted < steps; ++mLastCompleted ) { if( DoStep() == false ) { break; } } // Update Time context->setTime( context->getTime() + getStepSize() * mLastCompleted ); // Print Minimizations const unsigned int total = mSimpleMinimizations + mQuadraticMinimizations; const double averageSimple = ( double )mSimpleMinimizations / ( double )mLastCompleted; const double averageQuadratic = ( double )mQuadraticMinimizations / ( double )mLastCompleted; const double averageTotal = ( double )total / ( double )mLastCompleted; std::cout << "[OpenMM::Minimize] " << total << " total minimizations( " << mSimpleMinimizations << " simple, " << mQuadraticMinimizations << " quadratic ). " << averageTotal << " per-step minimizations( " << averageSimple << " simple, " << averageQuadratic << " quadratic ). Steps: " << mLastCompleted << std::endl; gettimeofday( &end, 0 ); double elapsed = ( end.tv_sec - start.tv_sec ) * 1000.0 + ( end.tv_usec - start.tv_usec ) / 1000.0; std::cout << "[Integrator] Total dynamics: " << elapsed << "ms" << std::endl; }
LRESULT CXTPSkinObjectProgress::OnStepIt(WPARAM /*wParam*/, LPARAM /*lParam*/) { if (((GetStyle() & PBS_MARQUEE) == 0)) return Default(); DoStep(1); return 1; }
bool GlobalTimer::Update() { Map *map; Game *game; GameControl* gc; unsigned long thisTime; unsigned long advance; gc = core->GetGameControl(); if (gc) gc->UpdateScrolling(); UpdateAnimations(); thisTime = GetTickCount(); if (!startTime) { startTime = thisTime; return false; } advance = thisTime - startTime; if ( advance < interval) { return false; } ieDword count = advance/interval; DoStep(count); DoFadeStep(count); if (!gc) { goto end; } game = core->GetGame(); if (!game) { goto end; } map = game->GetCurrentArea(); if (!map) { goto end; } //do spell effects expire in dialogs? //if yes, then we should remove this condition if (!(gc->GetDialogueFlags()&DF_IN_DIALOG) ) { map->UpdateFog(); map->UpdateEffects(); if (thisTime) { //this measures in-world time (affected by effects, actions, etc) game->AdvanceTime(1); } } //this measures time spent in the game (including pauses) if (thisTime) { game->RealTime++; } end: startTime = thisTime; return true; }
void Client::Step() { try { DoStep(); } catch (const std::exception& /*ex*/) { } }
void CXTPSkinObjectProgress::OnTimer(UINT_PTR nIDEvent) { if (nIDEvent == TID_TIMER && (GetStyle() & PBS_MARQUEE)) { DoStep(m_nMarqueeDelay > 50 ? 1 : 2); return; } CWnd::OnTimer(nIDEvent); }
/// Variant of the standard TieChoice which does the two step exchange /// between gui and stack variable and stack variable and shuttle. /// Difference to previous one is that the Translated choices and default /// are integers, not Strings. /// @param Prompt The prompt shown beside the control. /// @param SettingName The setting name as stored in gPrefs /// @parsm Default The default value for this control (translated) /// @param Choices An array of choices that appear on screen. /// @param TranslatedChoices The correcponding values (as an integer array) wxChoice * ShuttleGuiBase::TieChoice( const wxString &Prompt, const wxString &SettingName, const int Default, const wxArrayString & Choices, const wxArrayInt & TranslatedChoices) { wxChoice * pChoice=(wxChoice*)NULL; int TempIndex; int TranslatedInt = Default; WrappedType WrappedRef( TranslatedInt ); // Get from prefs does 1 and 2. // Put to prefs does 2 and 3. if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef ); // Get Int from Prefs. if( DoStep(1) ) TempIndex = TranslateToIndex( TranslatedInt, TranslatedChoices ); // Int to an index. if( DoStep(2) ) pChoice = TieChoice( Prompt, TempIndex, &Choices ); // Get/Put index from GUI. if( DoStep(3) ) TranslatedInt = TranslateFromIndex( TempIndex, TranslatedChoices ); // Index to int if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef ); // Put into Prefs. return pChoice; }
uint32_t Timer::Step() { TaskEx* pTask = nullptr; { std::unique_lock<std::mutex> lock(m_synchronizer); if (m_timers.empty()) { return static_cast<uint32_t>(cMaxTimeoutInMs); } auto it = m_timers.begin(); const uint64_t now = GetTickCount64(); if (now < it->first) { const uint64_t interval = std::min<uint64_t>(it->first - now, cMaxTimeoutInMs); return static_cast<uint32_t>(interval); } pTask = it->second; if (pTask->PeriodInMs > 0) { auto it2 = m_timers.insert(std::make_pair(it->first + pTask->PeriodInMs, pTask)); *(pTask->Pointer) = it2; pTask->Acquire(); } m_timers.erase(it); } DoStep(pTask); pTask->Release(); return 0; }
MT_BackgroundFrameCreator::MT_BackgroundFrameCreator(IplImage* BackgroundFrame, MT_Capture* Capture, int Mode, int NFramesToAverage, bool inpaint, int inpaintradius, const CvRect& inpaintroi, int StartFrame, int EndFrame) { m_pCapture = Capture; m_pBackgroundFrame = BackgroundFrame; m_iNFramesToAverage = NFramesToAverage; m_iStartFrame = StartFrame; m_iEndFrame = EndFrame; m_bDoInpaint = inpaint; m_iInpaintRadius = inpaintradius; if(inpaintroi.width == 0 || inpaintroi.height == 0) { m_InpaintROI = cvRect(0, 0, BackgroundFrame->width, BackgroundFrame->height); } else { m_InpaintROI = inpaintroi; } // check to make sure the capture is OK if(!Capture || (Capture->getMode() == MT_FC_MODE_OFF)) { // not OK m_iStatus = MT_MAKEBG_ERR; return; } // for movie mode, make sure the frame numbers are OK if(Capture->getMode() == MT_FC_MODE_AVI) { // can't average more frames than are in the movie! if(m_iNFramesToAverage > Capture->getNFrames()) { m_iNFramesToAverage = Capture->getNFrames(); } // set LAST_FRAME to right value if(m_iEndFrame == MT_MAKEBG_LAST_FRAME) { m_iEndFrame = Capture->getNFrames(); } // if we're asking for more frames than are in the span if((m_iEndFrame - m_iStartFrame) < m_iNFramesToAverage) { m_iNFramesToAverage = m_iEndFrame - m_iStartFrame; } } // we're going to create a background frame that is 32bits depth // so the averaging goes smoothly. we'll convert it later to match // the format provided by BackgroundFrame m_pBG = cvCreateImage( Capture->getFrameSize(), IPL_DEPTH_32F, Capture->getNChannels()); // make sure the frame is zeroed initially cvZero(m_pBG); if(Capture->getMode() == MT_FC_MODE_AVI) { m_dorg_frame_index = Capture->getFrameNumber(); } m_iStatus = MT_MAKEBG_OK; if(Mode != MT_MAKEBG_MODE_STEP) { for(int i = 0; i < NFramesToAverage; i++) { DoStep(); } Finish(); } }