Skip to content

Commit 193b58f

Browse files
committed
Color,logo and loader changed
1 parent 77eff09 commit 193b58f

File tree

5 files changed

+101
-215
lines changed

5 files changed

+101
-215
lines changed

effects.cpp

Lines changed: 58 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ void circle3d()
4646
//deg+=1.5;
4747
d=0.8;
4848
glPointSize(10.0);
49-
glColor3f(1,0,1);
5049
float deg=0.0;
50+
float r1=38/255.0,g1=87/255.0,b1=235/255.0;
51+
float r2=countr/255.0,g2=countg/255.0,b2=countb/255.0;
5152
for(int i=0; i<60; i++)
5253
{
5354

@@ -57,65 +58,97 @@ void circle3d()
5758
//end of music data
5859
glBegin(GL_QUADS);
5960
//top
60-
glColor3f(1,1,0);
61+
glColor3f(r2,g2,b2);
6162
glVertex3f(x-d,y,z+d); //-x,y,z
62-
glColor3f(1,1,1);
6363
glVertex3f(x+d,y,z+d); //x,y,z
64-
glColor3f(1,0,1);
6564
glVertex3f(x+d,y,z-d); //x,y,-z
66-
glColor3f(1,0,0);
6765
glVertex3f(x-d,y,z-d); //-x,y,-z
6866

6967
//bottom
70-
glColor3f(0,1,0);
68+
glColor3f(r1,g1,b1);
7169
glVertex3f(x-d,0,z+d); //-x,y=0,z
72-
glColor3f(0,1,1);
70+
glColor3f(r1,g1,b1);
7371
glVertex3f(x+d,0,z+d); //x,y=0,z
74-
glColor3f(0,0,1);
72+
glColor3f(r1,g1,b1);
7573
glVertex3f(x+d,0,z-d); //x,y=0,-z
76-
glColor3f(0,1,1);
74+
glColor3f(r1,g1,b1);
7775
glVertex3f(x-d,0,z-d); //-x,y=0,-z
7876

7977
//left
80-
glColor3f(0,1,0);
78+
glColor3f(r1,g1,b1);
8179
glVertex3f(x-d,0,z+d); //-x,y=0,z
82-
glColor3f(0,1,1);
80+
glColor3f(r1,g1,b1);
8381
glVertex3f(x-d,0,z-d); //-x,y=0,-z
84-
glColor3f(1,0,0);
82+
glColor3f(r2,g2,b2);
8583
glVertex3f(x-d,y,z-d); //-x,y,-z
86-
glColor3f(1,1,0);
84+
glColor3f(r2,g2,b2);
8785
glVertex3f(x-d,y,z+d); //-x,y,z
8886

8987
//right
90-
glColor3f(0,1,1);
88+
glColor3f(r1,g1,b1);
9189
glVertex3f(x+d,0,z+d); //x,y=0,z
92-
glColor3f(0,0,1);
90+
glColor3f(r1,g1,b1);
9391
glVertex3f(x+d,0,z-d); //x,y=0,-z
94-
glColor3f(1,0,1);
92+
glColor3f(r2,g2,b2);
9593
glVertex3f(x+d,y,z-d); //x,y,-z
96-
glColor3f(1,1,1);
94+
glColor3f(r2,g2,b2);
9795
glVertex3f(x+d,y,z+d); //x,y,z
9896

9997
//front
100-
glColor3f(0,1,1);
98+
glColor3f(r1,g1,b1);
10199
glVertex3f(x+d,0,z+d); //x,y=0,z
102-
glColor3f(1,1,1);
100+
glColor3f(r2,g2,b2);
103101
glVertex3f(x+d,y,z+d); //x,y,z
104-
glColor3f(1,1,0);
102+
glColor3f(r2,g2,b2);
105103
glVertex3f(x-d,y,z+d); //-x,y,z
106-
glColor3f(0,1,0);
104+
glColor3f(r1,g1,b1);
107105
glVertex3f(x-d,0,z+d); //-x,y=0,z
108106

109107
//back
110-
glColor3f(0,0,1);
108+
glColor3f(r1,g1,b1);
111109
glVertex3f(x+d,0,z-d); //x,y=0,z
112-
glColor3f(1,0,1);
110+
glColor3f(r2,g2,b2);
113111
glVertex3f(x+d,y,z-d); //x,y,z
114-
glColor3f(1,0,0);
112+
glColor3f(r2,g2,b2);
115113
glVertex3f(x-d,y,z-d); //-x,y,z
116-
glColor3f(0,1,1);
114+
glColor3f(r1,g1,b1);
117115
glVertex3f(x-d,0,z-d); //-x,y=0,z
118116
glEnd();
117+
118+
glBegin(GL_LINE_LOOP);
119+
glColor3f(0,0,0);
120+
//left
121+
glVertex3f(x-d,0,z+d); //-x,y=0,z
122+
glVertex3f(x-d,0,z-d); //-x,y=0,-z
123+
glVertex3f(x-d,y,z-d); //-x,y,-z
124+
glVertex3f(x-d,y,z+d); //-x,y,z
125+
126+
//back
127+
glVertex3f(x+d,0,z-d); //x,y=0,z
128+
glVertex3f(x+d,y,z-d); //x,y,z
129+
glVertex3f(x-d,y,z-d); //-x,y,z
130+
glVertex3f(x-d,0,z-d); //-x,y=0,z
131+
132+
//right
133+
glVertex3f(x+d,0,z+d); //x,y=0,z
134+
glVertex3f(x+d,0,z-d); //x,y=0,-z
135+
glVertex3f(x+d,y,z-d); //x,y,-z
136+
glVertex3f(x+d,y,z+d); //x,y,z
137+
138+
//front
139+
glVertex3f(x+d,0,z+d); //x,y=0,z
140+
glVertex3f(x+d,y,z+d); //x,y,z
141+
glVertex3f(x-d,y,z+d); //-x,y,z
142+
glVertex3f(x-d,0,z+d); //-x,y=0,z
143+
144+
//top
145+
glVertex3f(x-d,y,z+d); //-x,y,z
146+
glVertex3f(x+d,y,z+d); //x,y,z
147+
glVertex3f(x+d,y,z-d); //x,y,-z
148+
glVertex3f(x-d,y,z-d); //-x,y,-z
149+
150+
glEnd();
151+
119152
deg+=6;
120153
//deg+=5.625;
121154
}

headers.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <GL/glut.h>
1515
#include <GL/glext.h>
1616
#include <GL/freeglut.h>
17+
#include <dirent.h> // For searching current directory
1718

1819
#ifndef M_PI
1920
#define M_PI 3.14159265358979324
@@ -25,6 +26,7 @@ using namespace std;
2526
extern std::vector<int> ampdb;
2627
extern std::vector<int> frequency;
2728

29+
extern int countr,countg,countb;
2830
extern int j;
2931
extern float r; //circle "r"
3032
extern float d; //cuboid width/2

logo.png

-11.9 KB
Loading

main.cpp

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ double SAMPLE_RATE;
2323
kiss_fft_cpx in[N], out[N];
2424
int styleselect=0;
2525
int NO_STYLE=8;
26+
int countr=0,countg=0,countb=0;
2627

2728
static timestamp_t
2829
get_timestamp ()
@@ -158,6 +159,36 @@ void processSpecialKeys(int key, int x, int y)
158159
case GLUT_KEY_RIGHT:
159160
styleselect=(styleselect+1)%NO_STYLE;
160161
break;
162+
case GLUT_KEY_UP:
163+
if(countr<255)
164+
countr+=5;
165+
else if(countr==255 && countg<255)
166+
countg+=5;
167+
else if(countr==255 && countg==255 && countb<255)
168+
countb+=5;
169+
break;
170+
case GLUT_KEY_DOWN:
171+
countr-=5;
172+
break;
173+
}
174+
}
175+
176+
void selectmusic()
177+
{
178+
DIR *d;
179+
int i=0;
180+
struct dirent *dir;
181+
d = opendir(".");
182+
if (d)
183+
{
184+
while ((dir = readdir(d)) != NULL)
185+
{
186+
//printf("%s\n", dir->d_name);
187+
instructText(dir->d_name,-250,-200+i,-500);
188+
i+=20;
189+
}
190+
191+
closedir(d);
161192
}
162193
}
163194

@@ -188,7 +219,7 @@ void display(void)
188219
std::ostringstream ss;
189220
float tottime = (int)buffer.getDuration().asSeconds();
190221
float curtime = (int)sound.getPlayingOffset().asSeconds();
191-
float timepercent = (curtime/tottime)*500;
222+
float timepercent = (curtime/tottime)*(W-100);
192223
ss << (int)curtime;
193224
const std::string tmp = "Time : " + ss.str();
194225
const char* cstr = tmp.c_str();
@@ -197,17 +228,17 @@ void display(void)
197228
{
198229
glColor3f(128/255.0,222/255.0,234/255.0);
199230
glBegin(GL_POLYGON);
200-
glVertex3f(-250,-190.0,-200.0);
201-
glVertex3f(-250,-180.0,-200.0);
202-
glVertex3f(-250+(int)timepercent,-180.0,-200.0);
203-
glVertex3f(-250+(int)timepercent,-190.0,-200);
231+
glVertex3f(-W/2+50,-190.0,-300.0);
232+
glVertex3f(-W/2+50,-180.0,-300.0);
233+
glVertex3f(-W/2+50+(int)timepercent,-180.0,-300.0);
234+
glVertex3f(-W/2+50+(int)timepercent,-190.0,-300);
204235
glEnd();
205236
glColor3f(1,1,244/255.0);
206237
glBegin(GL_LINE_LOOP);
207-
glVertex3f(-250,-192.0,-200.0);
208-
glVertex3f(-250,-178.0,-200.0);
209-
glVertex3f(-250+500,-178.0,-200.0);
210-
glVertex3f(-250+500,-192.0,-200);
238+
glVertex3f(-W/2+50,-192.0,-300.0);
239+
glVertex3f(-W/2+50,-178.0,-300.0);
240+
glVertex3f(W/2-50,-178.0,-300.0);
241+
glVertex3f(W/2-50,-192.0,-300);
211242
glEnd();
212243
instructText((char*)cstr,-250,-175,-200);
213244
nav();
@@ -247,7 +278,7 @@ void display(void)
247278
}
248279
else
249280
{
250-
instructText((char *)"Paused!",-75,-200,-200);
281+
//instructText((char *)"Paused!",-75,-200,-200);
251282
pausebutton();
252283
}
253284
}

0 commit comments

Comments
 (0)