void DifficultyIcon::SetFromDifficulty( PlayerNumber pn, Difficulty dc ) { m_bBlank = false; switch( GetNumStates() ) { case NUM_DIFFICULTIES: SetState( dc ); break; case NUM_DIFFICULTIES*2: SetState( dc*2+pn ); break; default: m_bBlank = true; break; } }
bool DifficultyIcon::Load( const CString &sPath ) { Sprite::Load( sPath ); int iStates = GetNumStates(); if( iStates != NUM_DIFFICULTIES && iStates != NUM_DIFFICULTIES*2 ) { CString sError = ssprintf( "The difficulty icon graphic '%s' must have %d or %d frames. It has %d states.", sPath.c_str(), NUM_DIFFICULTIES, NUM_DIFFICULTIES*2, iStates ); Dialog::OK( sError ); } StopAnimating(); return true; }
//----------------------------------------------------- void BackButtonSystem::OnDeviceButtonPressed(const CS::DeviceButtonSystem::DeviceButton& buttonPressed) noexcept { if (buttonPressed == CS::DeviceButtonSystem::DeviceButton::k_backButton) { auto stateManager = CS::Application::Get()->GetStateManager(); CS_ASSERT(stateManager, "No state manager active."); if (stateManager->GetNumStates() > 1) { stateManager->Pop(); } else { CS::Application::Get()->Quit(); } } }
TGraph *PeakFit::GetFitVsAngle(double *scales, const Float_t barAngles[][2]) { std::vector< int > barMap = GetBarMap(barAngles); TGraph *gr = new TGraph(); for (unsigned int barIndex = 0; barIndex < GetNumBars(); barIndex++) { int bar = barMap[barIndex]; double value = 0; for (unsigned int state = 0; state < GetNumStates(bar); state++) { value += components_[bar][state] * scales[state]; } std::cout << "Bar Index: " << barIndex << " Bar " << bar << " value " << value << "\n"; gr->SetPoint(gr->GetN(), barAngles[bar][0], value); } gr->SetLineColor(kBlue); gr->SetLineWidth(2); return gr; }
bool DifficultyIcon::Load( CString sPath ) { Sprite::Load( sPath ); int iStates = GetNumStates(); bool bWarn = iStates != NUM_DIFFICULTIES && iStates != NUM_DIFFICULTIES*2; if( sPath.Find("_blank") != -1 ) bWarn = false; if( bWarn ) { CString sError = ssprintf( "The difficulty icon graphic '%s' must have %d or %d frames. It has %d states.", sPath.c_str(), NUM_DIFFICULTIES, NUM_DIFFICULTIES*2, iStates ); Dialog::OK( sError ); } StopAnimating(); return true; }
void AnimatedTexture::SetState( int iState ) { CLAMP( iState, 0, GetNumStates()-1 ); m_iCurState = iState; }