void ToggleButton::ProcessToggleGroup() { if ( m_next && m_next != this ) { // One and only one button can be down. ToggleButton* firstDown = 0; ToggleButton* candidate = 0; if ( this->Down() ) firstDown = this; for( ToggleButton* it = this->m_next; it != this; it = it->m_next ) { if ( firstDown ) it->PriSetUp(); else if ( it->Down() && it->Visible() && it->Enabled() ) firstDown = it; else it->PriSetUp(); if ( !firstDown && it->Visible() && it->Enabled() ) candidate = it; } if ( !firstDown && Visible() && Enabled() ) this->PriSetDown(); else if ( candidate ) candidate->PriSetDown(); else this->PriSetDown(); } }
void ParticleScene::DoTick( U32 deltaTime ) { for( int i=0; i<buttonArr.Size(); ++i ) { ToggleButton* toggle = buttonArr[i]->ToToggleButton(); if ( toggle && toggle->Down() ) { Vector3F pos = { SIZE/2, 0.01f, SIZE/2 }; Vector3F normal = { 0, 1, 0 }; //Vector3F dir = { 1, 0, 0 }; ParticleDef* def = &particleDefArr[i]; if ( def->spread == ParticleDef::SPREAD_POINT ) { engine->particleSystem->EmitPD( *def, pos, normal, deltaTime ); } else { Rectangle3F r; r.Set( pos.x-0.5f, pos.y, pos.z-0.5f, pos.x+0.5f, pos.y, pos.z+0.5f ); engine->particleSystem->EmitPD( *def, r, normal, deltaTime ); } } } }