ScummVM API documentation
explodingimage.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program 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  * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef STARK_VISUAL_EXPLODING_IMAGE_H
23 #define STARK_VISUAL_EXPLODING_IMAGE_H
24 
25 #include "engines/stark/visual/visual.h"
26 
27 #include "common/array.h"
28 #include "common/rect.h"
29 
30 #include "graphics/pixelformat.h"
31 
32 #include "math/vector2d.h"
33 
34 namespace Graphics {
35 struct Surface;
36 }
37 
38 namespace Stark {
39 
40 namespace Gfx {
41 class Driver;
42 class SurfaceRenderer;
43 class Bitmap;
44 }
45 
51 class VisualExplodingImage : public Visual {
52 public:
53  static const VisualType TYPE = Visual::kExplodingImage;
54 
55  explicit VisualExplodingImage(Gfx::Driver *gfx);
56  ~VisualExplodingImage() override;
57 
59  void initFromSurface(const Graphics::Surface *surface, uint originalWidth, uint originalHeight);
60 
62  void render(const Common::Point &position);
63 
64 private:
65  struct ExplosionUnit {
66  ExplosionUnit();
67 
68  void setPosition(int x, int y);
69  void setExplosionSettings(const Common::Point &center, const Common::Point &amplitude, float scale);
70  void setColor(uint32 color, const Graphics::PixelFormat &format);
71  void update();
72  void draw(Graphics::Surface *surface);
73 
74  Math::Vector2d _position;
75  Math::Vector2d _speed;
76  Math::Vector2d _center;
77  float _scale;
78 
79  int _stillImageTimeRemaining;
80  int _explosionFastAccelerationTimeRemaining;
81  uint32 _mainColor;
82  uint32 _darkColor;
83  };
84 
85  Gfx::Driver *_gfx;
86  Gfx::SurfaceRenderer *_surfaceRenderer;
87  Gfx::Bitmap *_bitmap;
88  Graphics::Surface *_surface;
89 
90  uint _originalWidth;
91  uint _originalHeight;
92 
94 };
95 
96 } // End of namespace Stark
97 
98 #endif // STARK_VISUAL_EXPLODING_IMAGE_H
Definition: surface.h:67
Definition: visual.h:29
Definition: pixelformat.h:138
Definition: surfacerenderer.h:36
Definition: driver.h:44
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: console.h:27
Definition: bitmap.h:38
Definition: formatinfo.h:28
Definition: rect.h:45
Definition: explodingimage.h:51