summaryrefslogtreecommitdiffstats
path: root/tdescreensaver/kdesavers/Flux.h
blob: f1a98780967f80603b149d4428ae89e9eb721ec3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#ifndef __FLUXSS_H__
#define __FLUXSS_H__
//============================================================================
//
// Terence Welsh Screensaver - Flux
// http://www.reallyslick.com/
//
// Ported to KDE by Karl Robillard
//
//============================================================================


#include <tqgl.h>


#define LIGHTSIZE   64


class flux;
class particle;
class TQTimer;

class FluxWidget : public TQGLWidget
{
    Q_OBJECT
  

public:

    enum eDefault
    {
        Regular,
        Hypnotic,
        Insane,
        Sparklers,
        Paradigm,
        Galactic,
        DefaultModes
    };

    FluxWidget( TQWidget* parent=0, const char* name=0 );
    ~FluxWidget();

    void setDefaults( int which );
    void updateParameters();

protected:

    void paintGL();
    void resizeGL( int w, int h );
    void initializeGL();
#ifdef UNIT_TEST
    void keyPressEvent( TQKeyEvent* );
#endif

private slots:

    void nextFrame();

private:

    float lumdiff;
    float cameraAngle;
    float cosCameraAngle, sinCameraAngle;
    unsigned char lightTexture[LIGHTSIZE][LIGHTSIZE];

    int dFluxes;
    int dParticles;
    int dTrail;
    int dGeometry;
    float dSize;
    int dComplexity;
    int dRandomize;
    int dExpansion;
    int dRotation;
    int dWind;
    float dInstability;
    int dBlur;
    int dSmart;
    int dPriority;

    flux* _fluxes;

    // Using TQTimer rather than timerEvent() to avoid getting locked out of
    // the TQEvent loop on lower-end systems.  Ian Geiser <[email protected]>
    // says this is the way to go.
    TQTimer* _timer;
    int _frameTime;

    friend class flux;
    friend class particle;
};


#ifndef UNIT_TEST
#include <kdialogbase.h>
#include <tdescreensaver.h>


class KFluxScreenSaver : public KScreenSaver
{
    Q_OBJECT
  

public:

    KFluxScreenSaver( WId id );
    virtual ~KFluxScreenSaver();

    int mode() const { return _mode; }

public slots:

    void setMode( int );

private:

    void readSettings();

    FluxWidget* _flux;
    int _mode;
};


class TQComboBox;

class KFluxSetup : public KDialogBase
{
    Q_OBJECT
  

public:

    KFluxSetup( TQWidget* parent = 0, const char* name = 0 );
    ~KFluxSetup();

private slots:

    void slotHelp();
    void slotOk();

private:

    TQComboBox* modeW;
    KFluxScreenSaver* _saver;
};
#endif


#endif //__FLUXSS_H__