1 //-----------------------------------------------------------------------------
3 // kfountain - Partical Fountain Screen Saver for KDE 2
5 // Copyright (c) Ian Reinhart Geiser 2001
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
14 #ifndef __FOUNTAIN_H__
15 #define __FOUNTAIN_H__
20 #include <OpenGL/gl.h>
21 #include <OpenGL/glu.h>
26 #include <kscreensaver.h>
29 #include "ui_fountaincfg.h"
30 #include <kinstance.h>
32 #include <qtextstream.h>
34 #define MAX_PARTICLES 1000
37 class Fountain
: public QGLWidget
40 class particles
// Create A Structure For Particle
43 bool active
; // Active (Yes/No)
44 float life
; // Particle Life
45 float fade
; // Fade Speed
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
62 Fountain( QWidget
* parent
=0, const char * name
=0 );
64 void setSize( float newSize
);
65 void setStars( bool doStars
);
67 /** paint the GL view */
69 /** resize the gl view */
70 void resizeGL ( int w
, int h
);
71 /** setup the GL enviroment */
76 /** load the partical file */
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
92 GLuint loop
; // Misc Loop Variable
93 GLuint col
; // Current Color Selection
94 GLuint delay
; // Rainbow Effect Delay
103 class KFountainSaver
: public KScreenSaver
107 KFountainSaver( WId drawable
);
108 virtual ~KFountainSaver();
112 void updateSize(int newSize
);
113 void doStars(bool starState
);
114 // void loadTextures(bool textures);
120 class KFountainSetup
: public QDialog
, public Ui::SetupUi
124 KFountainSetup( QWidget
*parent
=0L);
130 void slotOkPressed();
133 KFountainSaver
*saver
;