ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

explodingimage.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef STARK_VISUAL_EXPLODING_IMAGE_H
00024 #define STARK_VISUAL_EXPLODING_IMAGE_H
00025 
00026 #include "engines/stark/visual/visual.h"
00027 
00028 #include "common/array.h"
00029 #include "common/rect.h"
00030 
00031 #include "graphics/pixelformat.h"
00032 
00033 #include "math/vector2d.h"
00034 
00035 namespace Graphics {
00036 struct Surface;
00037 }
00038 
00039 namespace Stark {
00040 
00041 namespace Gfx {
00042 class Driver;
00043 class SurfaceRenderer;
00044 class Texture;
00045 }
00046 
00052 class VisualExplodingImage : public Visual {
00053 public:
00054     static const VisualType TYPE = Visual::kExplodingImage;
00055 
00056     explicit VisualExplodingImage(Gfx::Driver *gfx);
00057     ~VisualExplodingImage() override;
00058 
00060     void initFromSurface(const Graphics::Surface *surface);
00061 
00063     void render(const Common::Point &position);
00064 
00065 private:
00066     struct ExplosionUnit {
00067         ExplosionUnit();
00068 
00069         void setPosition(int x, int y);
00070         void setExplosionSettings(const Common::Point &center, const Common::Point &amplitude);
00071         void setColor(uint32 color, const Graphics::PixelFormat &format);
00072         void update();
00073         void draw(Graphics::Surface *surface);
00074 
00075         Math::Vector2d _position;
00076         Math::Vector2d _speed;
00077         Math::Vector2d _center;
00078 
00079         int _stillImageTimeRemaining;
00080         int _explosionFastAccelerationTimeRemaining;
00081         uint32 _mainColor;
00082         uint32 _darkColor;
00083     };
00084 
00085     Gfx::Driver *_gfx;
00086     Gfx::SurfaceRenderer *_surfaceRenderer;
00087     Gfx::Texture *_texture;
00088     Graphics::Surface *_surface;
00089 
00090     Common::Array<ExplosionUnit> _units;
00091 };
00092 
00093 } // End of namespace Stark
00094 
00095 #endif // STARK_VISUAL_EXPLODING_IMAGE_H


Generated on Sat Apr 20 2019 05:02:34 for ResidualVM by doxygen 1.7.1
curved edge   curved edge