uic4 port
[kdeartwork.git] / kscreensaver / kdesavers / fountain.h
blobf2051b290fedd62455ba2f1100dc925ef407b97a
1 //-----------------------------------------------------------------------------
2 //
3 // kfountain - Partical Fountain 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 __FOUNTAIN_H__
15 #define __FOUNTAIN_H__
17 #include <qdialog.h>
18 #include <qgl.h>
19 #ifdef Q_WS_MACX
20 #include <OpenGL/gl.h>
21 #include <OpenGL/glu.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_fountaincfg.h"
30 #include <kinstance.h>
31 #include <qfile.h>
32 #include <qtextstream.h>
34 #define MAX_PARTICLES 1000
37 class Fountain : 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 xi; // X Direction
53 float yi; // Y Direction
54 float zi; // Z Direction
55 float xg; // X Gravity
56 float yg; // Y Gravity
57 float zg; // Z Gravity
58 float size; // Particle Size
61 public:
62 Fountain( QWidget * parent=0, const char * name=0 );
63 ~Fountain();
64 void setSize( float newSize );
65 void setStars( bool doStars );
66 protected:
67 /** paint the GL view */
68 void paintGL ();
69 /** resize the gl view */
70 void resizeGL ( int w, int h );
71 /** setup the GL enviroment */
72 void initializeGL ();
75 private:
76 /** load the partical file */
77 bool loadParticle();
79 particles particle[MAX_PARTICLES];
82 bool rainbow; // Rainbow Mode?
83 bool sp; // Spacebar Pressed?
84 bool rp; // Enter Key Pressed?
86 float slowdown; // Slow Down Particles
87 float xspeed; // Base X Speed (To Allow Keyboard Direction Of Tail)
88 float yspeed; // Base Y Speed (To Allow Keyboard Direction Of Tail)
89 float zoom; // Used To Zoom Out
90 float size;
91 float stars;
92 GLuint loop; // Misc Loop Variable
93 GLuint col; // Current Color Selection
94 GLuint delay; // Rainbow Effect Delay
95 GLuint texture[1];
96 QImage tex;
97 float index;
98 float transIndex;
99 GLfloat scale;
100 GLUquadricObj *obj;
103 class KFountainSaver : public KScreenSaver
105 Q_OBJECT
106 public:
107 KFountainSaver( WId drawable );
108 virtual ~KFountainSaver();
109 void readSettings();
110 public slots:
111 void blank();
112 void updateSize(int newSize);
113 void doStars(bool starState);
114 // void loadTextures(bool textures);
115 private:
116 Fountain *fountain;
117 QTimer *timer;
120 class KFountainSetup : public QDialog, public Ui::SetupUi
122 Q_OBJECT
123 public:
124 KFountainSetup( QWidget *parent =0L);
126 protected:
127 void readSettings();
129 private slots:
130 void slotOkPressed();
131 void aboutPressed();
132 private:
133 KFountainSaver *saver;
134 float size;
135 float stars;
138 #endif