- when RainEffect=false then ALSO disable rain in the main menu
This commit is contained in:
parent
94f3665285
commit
a6af5b96af
|
@ -65,20 +65,23 @@ MenuBackground::MenuBackground(){
|
|||
}
|
||||
|
||||
//rain
|
||||
rain= menuNode->getChild("rain")->getAttribute("value")->getBoolValue();
|
||||
if(rain){
|
||||
RainParticleSystem *rps= new RainParticleSystem();
|
||||
rps->setSpeed(12.f/GameConstants::updateFps);
|
||||
rps->setEmissionRate(25);
|
||||
rps->setWind(-90.f, 4.f/GameConstants::updateFps);
|
||||
rps->setPos(Vec3f(0.f, 25.f, 0.f));
|
||||
rps->setColor(Vec4f(1.f, 1.f, 1.f, 0.2f));
|
||||
rps->setRadius(30.f);
|
||||
renderer.manageParticleSystem(rps, rsMenu);
|
||||
bool withRainEffect = Config::getInstance().getBool("RainEffect","true");
|
||||
if(withRainEffect == true) {
|
||||
rain= menuNode->getChild("rain")->getAttribute("value")->getBoolValue();
|
||||
if(rain){
|
||||
RainParticleSystem *rps= new RainParticleSystem();
|
||||
rps->setSpeed(12.f/GameConstants::updateFps);
|
||||
rps->setEmissionRate(25);
|
||||
rps->setWind(-90.f, 4.f/GameConstants::updateFps);
|
||||
rps->setPos(Vec3f(0.f, 25.f, 0.f));
|
||||
rps->setColor(Vec4f(1.f, 1.f, 1.f, 0.2f));
|
||||
rps->setRadius(30.f);
|
||||
renderer.manageParticleSystem(rps, rsMenu);
|
||||
|
||||
for(int i=0; i<raindropCount; ++i){
|
||||
raindropStates[i]= random.randRange(0.f, 1.f);
|
||||
raindropPos[i]= computeRaindropPos();
|
||||
for(int i=0; i<raindropCount; ++i){
|
||||
raindropStates[i]= random.randRange(0.f, 1.f);
|
||||
raindropPos[i]= computeRaindropPos();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,11 +149,14 @@ void MenuBackground::setTargetCamera(const Camera *targetCamera){
|
|||
void MenuBackground::update(){
|
||||
|
||||
//rain drops
|
||||
for(int i=0; i<raindropCount; ++i){
|
||||
raindropStates[i]+= 1.f / GameConstants::updateFps;
|
||||
if(raindropStates[i]>=1.f){
|
||||
raindropStates[i]= 0.f;
|
||||
raindropPos[i]= computeRaindropPos();
|
||||
bool withRainEffect = Config::getInstance().getBool("RainEffect","true");
|
||||
if(withRainEffect == true) {
|
||||
for(int i=0; i<raindropCount; ++i){
|
||||
raindropStates[i]+= 1.f / GameConstants::updateFps;
|
||||
if(raindropStates[i]>=1.f){
|
||||
raindropStates[i]= 0.f;
|
||||
raindropPos[i]= computeRaindropPos();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,7 +191,7 @@ void MenuBackground::update(){
|
|||
}
|
||||
}
|
||||
|
||||
Vec2f MenuBackground::computeRaindropPos(){
|
||||
Vec2f MenuBackground::computeRaindropPos() {
|
||||
float f= static_cast<float>(meshSize);
|
||||
return Vec2f(random.randRange(-f, f), random.randRange(-f, f));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user