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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
| #include "playerWindow.h" #include "playerPage.h" #include "menuPage.h"
char nowName[100];
enum PLAY_STATUS play_mode = STATUS_PLAY_SEQUENCE; char play_status[1000];
enum STATUS status = STATUS_STOPPED; char status_now[1000]; int num = 0; int progress_length = 90; double t = 0; double t1 = 0; double c = 0;
void createWindow() { initgraph(720, 960,0); char a[1000] = ""; strcpy(a, getPath(num));
openMusic(a); setbkcolor(WHITE);
change();
IMAGE image; loadimage(&image, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\background.png"); putimage(0, 0, &image); transparentimage(NULL,0, 0, &image);
IMAGE pause; IMAGE play2; IMAGE play; loadimage(&play2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\play2.png", 81, 81); loadimage(&pause, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\play.png", 81, 81); transparentimage(NULL, 334, 652, &pause);
IMAGE last; loadimage(&last, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\last.png", 50, 50); IMAGE last2; loadimage(&last2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\last2.png", 50, 50); transparentimage(NULL, 194, 666, &last);
IMAGE next; loadimage(&next, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\next.png", 50, 50); IMAGE next2; loadimage(&next2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\next2.png", 50, 50); transparentimage(NULL, 498, 671, &next);
IMAGE change; loadimage(&change, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\change.png",30,30); IMAGE change2; loadimage(&change2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\change2.png",30,30); transparentimage(NULL, 92, 678, &change);
IMAGE up; loadimage(&up, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\up.png", 36, 36); IMAGE up2; loadimage(&up2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\up2.png", 36, 36); transparentimage(NULL, 618, 748, &up);
IMAGE down; loadimage(&down, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\down.png", 36, 36); IMAGE down2; loadimage(&down2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\down2.png", 36, 36); transparentimage(NULL, 94, 748, &down);
IMAGE add1; loadimage(&add1, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\add.png", 40, 40); IMAGE add2; loadimage(&add2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\add2.png", 40, 40); transparentimage(NULL, 170, 870, &add1);
IMAGE add1_lr; loadimage(&add1_lr, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\cut.png", 40, 40); IMAGE add2_lr; loadimage(&add2_lr, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\cut2.png", 40, 40); transparentimage(NULL, 230, 870, &add1_lr);
IMAGE back; loadimage(&back, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\back.png", 30, 30); transparentimage(NULL, 15, 12, &back);
IMAGE circle; loadimage(&circle, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\BREATHE.png", 340, 340); transparentimage(NULL, 110, 40, &circle);
IMAGE issue; loadimage(&issue, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\issue.png", 36, 36); transparentimage(NULL, 608, 675, &issue);
setbkmode(TRANSPARENT);
while (1) { strcpy(nowName, getName(num)); printtext(242, 755, nowName); printtext(91, 598, play_status);
t = getMusicLength(); t1 = getMusicPosition(); if (t != 0) c = t1 / t; progress_length = c * 523 + 90; fillroundrect(90, 830, progress_length, 825, 10, 10);
if (MouseHit()) { MOUSEMSG msg = GetMouseMsg(); switch (msg.uMsg) {
case WM_LBUTTONDOWN: if (msg.x >= 334 && msg.x <= 412 && msg.y <= 732 && msg.y >= 652) { printtext(2222, 755, getName(num)); printtext(91, 598, play_status); strcpy(a, (const char*)getPath(num)); openMusic(a); if (status == STATUS_STOPPED) {
transparentimage(NULL, 334, 652, &play2); Sleep(100); transparentimage(NULL, 334, 652, &pause); playMusic(); status = STATUS_PLAY; strcpy(status_now, "正在播放中"); } else if (status == STATUS_PLAY) { transparentimage(NULL, 334, 652, &play2); Sleep(100); transparentimage(NULL, 334, 652, &pause); pauseMusic(); status = STATUS_PAUSE; strcpy(status_now, "暂停中"); } else if (status == STATUS_PAUSE) { transparentimage(NULL, 334, 652, &play2); Sleep(100); transparentimage(NULL, 334, 652, &pause); resumeMusic(); status = STATUS_PLAY; strcpy(status_now, "正在播放中"); }
}
if (msg.x >= 202 && msg.x <= 236 && msg.y <= 709 && msg.y >= 676) { transparentimage(NULL, 194, 666, &last2); Sleep(100); transparentimage(NULL, 194, 666, &last); if (num > 1) { num -= 1; } fillroundrect(96, 830, 613, 825, 10, 10);
closeMusic(); fundmantual(); printtext(91, 598, play_status); strcpy(a, (const char*)getPath(num));
openMusic(a); playMusic(); }
if (msg.x >= 506 && msg.x <= 542 && msg.y <= 711 && msg.y >= 676) { transparentimage(NULL, 498, 671, &next2); Sleep(100); transparentimage(NULL, 498, 671, &next); if (num < getNumOfNode()) { num += 1; } fillroundrect(96, 830, 613, 825, 10, 10); closeMusic(); fundmantual();
printtext(91, 598, play_status); strcpy(a, (const char*)getPath(num));
openMusic(a); playMusic(); }
if (msg.x >= 618 && msg.x <= 654 && msg.y <= 784 && msg.y >= 748) { transparentimage(NULL, 618, 748, &up2); Sleep(100); transparentimage(NULL, 618, 748, &up); upTo10s(); }
if (msg.x >= 94 && msg.x <= 130 && msg.y <= 784 && msg.y >= 748) { transparentimage(NULL, 94, 748, &down2); Sleep(100); transparentimage(NULL, 94, 748, &down); downTo10s(); fundmantual(); }
if (msg.x >= 92 && msg.x <= 122 && msg.y <= 708 && msg.y >= 678) { transparentimage(NULL, 92, 678, &change2); Sleep(100); transparentimage(NULL, 92, 678, &change); if (play_mode == STATUS_PLAY_SEQUENCE) { play_mode = STATUS_PLAY_RANDOM; strcpy(play_status, "当前播放状态: 随机播放"); fundmantual(); } else if (play_mode == STATUS_PLAY_RANDOM) { play_mode = STATUS_PLAY_REPEAT; strcpy(play_status, "当前播放状态: 循环播放"); fundmantual(); } else if (play_mode == STATUS_PLAY_REPEAT) { play_mode = STATUS_PLAY_SEQUENCE; strcpy(play_status, "当前播放状态: 列表播放"); fundmantual(); } }
if (getMusicLength() == getMusicPosition() && play_mode == STATUS_PLAY_SEQUENCE) { if (num > 1) { num -= 1; } fillroundrect(96, 830, 613, 825, 10, 10); closeMusic(); fundmantual(); printtext(91, 598, play_status); strcpy(a, (const char*)getPath(num));
openMusic(a); playMusic(); }
if (getMusicLength() == getMusicPosition() && play_mode == STATUS_PLAY_REPEAT) { fundmantual(); playMusicRepeat(); } if (getMusicLength() == getMusicPosition() && play_mode == STATUS_PLAY_SEQUENCE) {
} if (msg.x >= 15 && msg.x <= 45 && msg.y <= 42 && msg.y >= 12) { closegraph(); menu();
}
if (msg.x >= 170 && msg.x <= 210 && msg.y <= 910 && msg.y >= 870) { transparentimage(NULL, 170, 870, &add2); Sleep(100); transparentimage(NULL, 170, 870, &add1); addVolume(); }
if (msg.x >= 230 && msg.x <= 270 && msg.y <= 910 && msg.y >= 870) { transparentimage(NULL, 230, 870, &add2_lr); Sleep(100); transparentimage(NULL, 230, 870, &add1_lr); lowVolume(); }
if (msg.x >= 608 && msg.x <= 644 && msg.y <= 711 && msg.y >= 675) {
WinExec("C:\\Program Files\\Internet Explorer\\IExplore.exe https://www.musicbooks.cn/", 1); }
break; } }
if (getMusicLength() == getMusicPosition() && play_mode == STATUS_PLAY_SEQUENCE && num > 0) { if (num > 1) { num -= 1; } fillroundrect(96, 830, 613, 825, 10, 10); closeMusic(); fundmantual(); printtext(91, 598, play_status); strcpy(a, (const char*)getPath(num)); openMusic(a); playMusic(); } if (getMusicLength() == getMusicPosition() && play_mode == STATUS_PLAY_REPEAT && num > 0) { playMusicRepeat(); } if (getMusicLength() == getMusicPosition() && play_mode == STATUS_PLAY_SEQUENCE && num > 0) { } } }
void fundmantual() { initgraph(720, 960, 0); char a[1000] = ""; strcpy(a, getPath(num));
openMusic(a); setbkcolor(WHITE);
change();
IMAGE image; loadimage(&image, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\background.png"); putimage(0, 0, &image); transparentimage(NULL, 0, 0, &image);
IMAGE pause; IMAGE play2; IMAGE play; loadimage(&play2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\play2.png", 81, 81); loadimage(&pause, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\play.png", 81, 81); transparentimage(NULL, 334, 652, &pause);
IMAGE last; loadimage(&last, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\last.png", 50, 50); IMAGE last2; loadimage(&last2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\last2.png", 50, 50); transparentimage(NULL, 194, 666, &last);
IMAGE next; loadimage(&next, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\next.png", 50, 50); IMAGE next2; loadimage(&next2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\next2.png", 50, 50); transparentimage(NULL, 498, 671, &next);
IMAGE change; loadimage(&change, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\change.png", 30, 30); IMAGE change2; loadimage(&change2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\change2.png",30, 30); transparentimage(NULL, 92, 678, &change);
IMAGE up; loadimage(&up, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\up.png", 36, 36); IMAGE up2; loadimage(&up2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\up2.png", 36, 36); transparentimage(NULL, 618, 748, &up);
IMAGE down; loadimage(&down, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\down.png", 36, 36); IMAGE down2; loadimage(&down2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\down2.png", 36, 36); transparentimage(NULL, 94, 748, &down);
IMAGE back; loadimage(&back, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\back.png", 30, 30); transparentimage(NULL, 15, 12, &back);
IMAGE circle; loadimage(&circle, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\BREATHE.png", 340, 340); transparentimage(NULL, 110, 40, &circle);
IMAGE add1; loadimage(&add1, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\add.png", 40, 40); IMAGE add2; loadimage(&add2, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\add2.png", 40, 40); transparentimage(NULL, 170, 870, &add1);
IMAGE add1_lr; loadimage(&add1_lr, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\cut.png", 40, 40); IMAGE add2_lr; loadimage(&add2_lr, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\cut2.png", 40, 40); transparentimage(NULL, 230, 870, &add1_lr);
IMAGE issue; loadimage(&issue, "D:\\visual studio project\\yuyucloudmusic v2.4\\Project_List\\picture\\issue.png", 36, 36); transparentimage(NULL, 608, 675, &issue);
}
char* attainlength(int time) { int fen = 0; int miao = 0; miao = (int)time / 1000; fen = (int)miao / 60; miao = (int)miao - fen * 60; char f[100]; char m[100]; char tatol[100]; itoa(miao, m, 10); itoa(fen, f, 10); strcpy(tatol, f); strcat(tatol, " : "); if (miao < 10) { strcat(tatol, "0"); } strcat(tatol, m); return tatol; }
void printtext(int x, int y,char text[100]) { settextcolor(WHITE); setbkmode(TRANSPARENT); outtextxy(x, y, text); }
int getnum() { return num; }
void setnum(int n) { num = n; }
|