OpenXcom  1.0
Open-source clone of the original X-Com
Particle.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include <SDL_types.h>
21 #include <algorithm>
22 
23 namespace OpenXcom
24 {
25 
26 class Particle
27 {
28 private:
29  float _xOffset, _yOffset, _density;
30  Uint8 _color, _opacity, _size;
31 public:
33  Particle(float xOffset, float yOffset, float density, Uint8 color, Uint8 opacity);
35  ~Particle();
37  bool animate();
39  int getSize() const { return _size; }
41  Uint8 getColor() const { return _color; }
43  Uint8 getOpacity() const { return std::min((_opacity + 7) / 10, 3); }
45  float getX() const { return _xOffset; }
47  float getY() const { return _yOffset; }
48 };
49 
50 }
Definition: Particle.h:26
float getX() const
Get the horizontal shift.
Definition: Particle.h:45
Uint8 getColor() const
Get the color.
Definition: Particle.h:41
Particle(float xOffset, float yOffset, float density, Uint8 color, Uint8 opacity)
Create a particle.
Definition: Particle.cpp:34
~Particle()
Destroy a particle.
Definition: Particle.cpp:54
float getY() const
Get the vertical shift.
Definition: Particle.h:47
bool animate()
Animate a particle.
Definition: Particle.cpp:62
int getSize() const
Get the size value.
Definition: Particle.h:39
Uint8 getOpacity() const
Get the opacity.
Definition: Particle.h:43
Definition: BaseInfoState.cpp:40