VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
WaterParticle.h
1 /*
2  * Copyright (C) 2014 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef WATERPARTICLE_H
18 #define WATERPARTICLE_H
19 
20 #include "Particle.h"
21 
26 class WaterParticle : public Particle {
27 public:
38  ParticleLayer* layer,
39  const QPointF& position,
40  const QPointF& velocity,
41  const QColor& color,
42  float decayTime);
52  WaterParticle(ParticleLayer* layer, int index, float decayTime);
53 
60  void beginDecaying();
64  void resetDecayTime();
68  void update();
69 
70 private:
71  bool mIsDecaying = false;
72  float mInitialDecayTime = 0.0f;
73  float mDecayTime = 0.0f;
74 };
75 
76 #endif // WATERPARTICLE_H
void resetDecayTime()
Reset the decay time of this WaterParticle.
void update()
Process the decay timer, deleting this WaterParticle if the decay time has elapsed.
WaterParticle(ParticleLayer *layer, const QPointF &position, const QPointF &velocity, const QColor &color, float decayTime)
Constructs a WaterParticle in the given ParticleLayer with the specified position, velocity, color, and time-to-live.
A Particle which destroys itself after a decay time has elapsed.
Definition: WaterParticle.h:26
Wrapper around a LiquidFun particle.
Definition: Particle.h:34
void beginDecaying()
Start the decay of this WaterParticle.
Wrapper around a b2ParticleSystem, which represents an independent layer of particles.
Definition: ParticleLayer.h:32