SVN_SILENT made messages (.desktop file)
[kdeartwork.git] / kscreensaver / kdesavers / gravity.h
blobc9ecdca70b23ab3e943f9e2c240db2b766fd8bef
1 ///-----------------------------------------------------------------------------
2 //
3 // kgravity - Partical gravity Screen Saver for KDE 2
4 //
5 // Copyright (c) Ian Reinhart Geiser 2001
6 //
7 /////
8 //NOTE:
9 // The base particle engine did not come from me, it was designed by Jeff Molofee <nehe@connect.ab.ca>
10 // I did some extensive modifications to make it work with QT's OpenGL but the base principal is about
11 // the same.
12 ////
14 #ifndef GRAVITY_H
15 #define GRAVITY_H
17 #include <qdialog.h>
18 #include <qgl.h>
19 #ifdef Q_WS_MACX
20 #include <OpenGL/glu.h>
21 #include <OpenGL/gl.h>
22 #else
23 #include <GL/glu.h>
24 #include <GL/gl.h>
25 #endif
26 #include <kscreensaver.h>
27 #include <qtimer.h>
28 #include <qimage.h>
29 #include "ui_gravitycfg.h"
30 #include <kcomponentdata.h>
31 #include <qfile.h>
32 #include <qtextstream.h>
34 #define MAX_PARTICLES 100
37 class Gravity : public QGLWidget
39 Q_OBJECT
40 class particles // Create A Structure For Particle
42 public:
43 bool active; // Active (Yes/No)
44 float life; // Particle Life
45 float fade; // Fade Speed
46 float r; // Red Value
47 float g; // Green Value
48 float b; // Blue Value
49 float x; // X Position
50 float y; // Y Position
51 float z; // Z Position
52 float xo; // X Position
53 float yo; // Y Position
54 float zo; // Z Position
55 float index; // Index
56 float indexo;
57 float size; // Particle Size
60 public:
61 Gravity( QWidget * parent=0 );
62 ~Gravity();
63 void setSize( float newSize );
64 void setStars( bool doStars );
65 protected:
66 /** paint the GL view */
67 void paintGL ();
68 /** resize the gl view */
69 void resizeGL ( int w, int h );
70 /** setup the GL environment */
71 void initializeGL ();
72 void buildParticle(int loop);
74 private:
75 /** load the partical file */
76 bool loadParticle();
78 particles particle[MAX_PARTICLES];
81 bool rainbow; // Rainbow Mode?
82 bool sp; // Spacebar Pressed?
83 bool rp; // Enter Key Pressed?
84 float slowdown; // Slow Down Particles
85 float xspeed; // Base X Speed (To Allow Keyboard Direction Of Tail)
86 float yspeed; // Base Y Speed (To Allow Keyboard Direction Of Tail)
87 float zoom; // Used To Zoom Out
88 float size;
89 float stars;
90 GLuint loop; // Misc Loop Variable
91 GLuint col; // Current Color Selection
92 GLuint delay; // Rainbow Effect Delay
93 GLuint texture[1];
94 QImage tex;
95 float index;
96 float transIndex;
97 GLfloat scale;
98 GLUquadricObj *obj;
101 class KGravitySaver : public KScreenSaver
103 Q_OBJECT
104 public:
105 KGravitySaver( WId drawable );
106 virtual ~KGravitySaver();
107 void readSettings();
108 public slots:
109 void blank();
110 void updateSize(int newSize);
111 void doStars(bool starState);
112 // void loadTextures(bool textures);
113 private:
114 Gravity *gravity;
115 QTimer *timer;
118 class KGravitySetup : public QDialog, public Ui::SetupUi
120 Q_OBJECT
121 public:
122 KGravitySetup( QWidget *parent = 0L);
123 ~KGravitySetup();
125 protected:
126 void readSettings();
128 private slots:
129 void slotOkPressed();
130 void aboutPressed();
131 private:
132 KGravitySaver *saver;
133 float size;
134 float stars;
135 float zoom;
136 float speed;
139 #endif