-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorona.h
114 lines (90 loc) · 2.46 KB
/
corona.h
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
/*
* This file is released under the GNU General Public Licence
*
* authors:
* Richard Ashbury <[email protected]>
* Jean-Christophe Hoelt <[email protected]>
*/
/////////////////////////////////////////////////////////////////////////////
//
// corona.h : Declaration of the Corona class
//
/////////////////////////////////////////////////////////////////////////////
#ifndef __CORONA_H_
#define __CORONA_H_
#include "corona_types.h"
// presets
enum {
PRESET_CORONA = 0,
PRESET_BLAZE,
PRESET_COUNT
};
// The particles
struct Particle
{
double x, y, xvel, yvel;
};
// The background swirl
struct Swirl
{
double x;
double y;
double tightness;
double pull;
};
/////////////////////////////////////////////////////////////////////////////
//
// Core Class of the Corona Visual FX
//
/////////////////////////////////////////////////////////////////////////////
class Corona
{
private:
int m_clrForeground; // foreground color
int m_nPreset;
Particle *m_particles;
int nbParticules;
// The off-screen buffer
unsigned char* m_image;
unsigned char* m_real_image;
int m_width;
int m_height;
int m_real_height;
Swirl m_swirl;
unsigned char** m_deltafield;
// Particle movement info
int m_swirltime;
Swirl m_movement;
bool m_testing;
bool m_silent;
// Beat detection
double m_avg;
double m_oldval;
int m_pos;
// Waves
double m_waveloop;
int *m_reflArray;
// Implementation functions
double random(double min, double max) const;
// void setUpPalette();
void drawLine(int x0, int y0, int x1, int y1, unsigned char col);
void drawParticules();
void drawParticulesWithShift();
void blurImage();
void drawReflected();
void chooseRandomSwirl();
void setPointDelta(int x, int y);
void applyDeltaField(bool heavy);
int getBeatVal(TimedLevel *tl);
void getAvgParticlePos(double& x, double& y) const;
void genReflectedWaves(double loop);
public:
Corona();
~Corona();
bool setUpSurface(int width, int height);
void update(TimedLevel *pLevels);
unsigned char *getSurface() const { return m_real_image; }
int getWidth() const { return m_width; }
int getHeight() const { return m_real_height; }
};
#endif //__CORONA_H_