Back to index

kdeartwork  4.3.2
firesaver.h
Go to the documentation of this file.
00001 //     This file is part of KFireSaver3D.
00002 
00003 //     KFireSaver3D is free software; you can redistribute it and/or modify
00004 //     it under the terms of the GNU General Public License as published by
00005 //     the Free Software Foundation; either version 2 of the License, or
00006 //     (at your option) any later version.
00007 
00008 //     KFireSaver3D is distributed in the hope that it will be useful,
00009 //     but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //     GNU General Public License for more details.
00012 
00013 //     You should have received a copy of the GNU General Public License
00014 //     along with KFireSaver3D; if not, write to the Free Software
00015 //     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00016 
00017 
00018 //     Author: Enrico Ros, based on the great work of David Sansome (kfiresaver)
00019 //     Email:  asy@libero.it
00020 
00021 #ifndef KFIRESAVER_H
00022 #define KFIRESAVER_H
00023 
00024 #define PERSP_MAG_FACTOR 8.0
00025 #define NUMBER_OF_FIREPARTICLES 180
00026 
00027 #define MSECPERIOD 17              // 1000ms / 60fps = 16.6667 ~= 17 [ms/frame]
00028 
00029 #define FIELDWIDTH 30.0
00030 #define FIELDW_2 (FIELDWIDTH/2.0)
00031 #define FIELDW_4 (FIELDWIDTH/4.0)
00032 
00033 #include <qgl.h>
00034 #include <qlist.h>
00035 #include <qimage.h>
00036 #include <qstring.h>
00037 #include <qcolor.h>
00038 
00039 #include <arts/kplayobject.h>
00040 #include <arts/kartsserver.h>
00041 #include <arts/kartsdispatcher.h>
00042 
00043 class Particle;
00044 class Writer;
00045 
00046 class KFireSaver : public QGLWidget
00047 {
00048     public:
00049        KFireSaver( QWidget *parent=0 );
00050        ~KFireSaver();
00051 
00052     protected:
00053        void initializeGL();
00054        void resizeGL( int, int );
00055        void paintGL();
00056        void timerEvent( class QTimerEvent * );
00057 
00058     private:
00059        enum enumFireworkType
00060        {
00061               Sphere = 0,
00062               NoFW = 1,
00063               Circle = 2,
00064               BiCircle = 3,
00065               AngelHairs = 4,
00066               Splitter = 5,
00067               Spirals = 6,
00068               SuperNova = 7,
00069               NoRender = 8
00070        };
00071 
00072        inline enumFireworkType pickType();
00073        inline int pickColour();
00074        void explodeFirework(Particle* fireWorkLeaderParticle);
00075        void burnLogo(QImage * image);
00076        void playSound(QString file);
00077        bool loadTexture(QString file, unsigned int & textureID);
00078        void freeTexture(unsigned int & textureID);
00079        void readConfig();
00080 
00081        //list of particles and stars
00082        QList<Particle *>
00083               particleList,
00084               starList;
00085 
00086        //stuff for 'exploding' pixmaps (kde, tux, icons..)
00087        QList<QImage *>
00088               imageList;
00089 
00090        //texture stuff
00091        unsigned int
00092               currentTexture,
00093               particleTexture,
00094               starTexture,
00095               flareTexture,
00096               diastarTexture; // (to add) novaTexture cometTexture
00097 
00098        //sound stuff
00099        KArtsDispatcher artsDispatcher;
00100        KArtsServer artsServer;
00101        QList<KPlayObject *> playObjectList;
00102        QString       sound_explosion,
00103               sound_debris;
00104 
00105        //other stuff
00106        class Writer * writer;
00107        float  unitX,
00108               unitY;
00109        double timeStampFrame;
00110        bool   firstGLFrame;
00111 
00112        struct {
00113           bool       enableBottomFire,    //show
00114               enableSound,
00115               enableNoOverhead,
00116               enableRealtime,
00117               enableCombos,        //fireworks
00118               enableLogos,         //specials
00119               enableReduceLogo,
00120               enableStars,
00121               enableStarFlickering,
00122               enableStarGradient,
00123               enableWritings,
00124               enableSphereLight,   //effects
00125               enableFlash,
00126               enableFade,
00127               enableMegaFlares,
00128               enableTrails;
00129           int fireworksFrequency,  //show
00130               particleSize,
00131               logoFrequency,              //specials
00132               starsNumber,
00133               flashOpacity,        //effects
00134               fadeAmount,
00135               megaFlares;
00136           QColor
00137               bottomFireColor;
00138           int colorsCount,
00139               colorsT[8],
00140               typesCount;
00141           enumFireworkType
00142               typesT[9];
00143        } parameters;
00144 
00145 
00146        enum enumShowType {
00147            Show = 0,
00148            Random = 1,
00149            Monotype = 2,
00150            Monochrome = 3
00151        };
00152 
00153        struct {
00154           enum enumShowType ShowType;
00155           int colour,
00156               colourSec;
00157           enumFireworkType
00158               type,
00159               typeSec;
00160           bool       forceBicolour,
00161               forceColour,
00162               forcePower,
00163               forceType;
00164           float powerEnvelop;
00165           double timeStamp,
00166               timeGap;
00167        } showp;
00168 };
00169 
00170 #endif