目录
目录
回顾上集代码
#include <Button.h>
#include <heker.h>
#include <ARTTEXT.h>
#include "ege.h"
using namespace std;
using namespace ege;
Button RememberSummer = NewButton(1, 5, 12, "忆夏");
Button YourRiversAndMount = NewButton(3, 5, 14, "你的万水千山(原版)");
Button YourRiversAndMountDJ = NewButton(5, 5, 11, "你的万水千山(DJ版)");
//Button Files = NewButton(7, 5, 13, "打开文件...");
Button Empty = NewButton(1, 10, 3, "直接播放");
Button Repeat = NewButton(3, 10, 5, "单曲循环");
Button Sleepy = NewButton(5, 9, 6, "沉浸式播放");
LPCSTR Title;
void SendSong(const char *song)
{
CHAR PRESS;
BOOL ISPLAY = TRUE;
char beep[60] = "open ";
char alias[20] = " alias music";
int BEEPOF;
system("color 0f");
system("cls");
system("color 1f");
system("color 2f");
system("color 3f");
system("color 4f");
system("color 5f");
system("color 6f");
system("color 7f");
system("color 8f");
system("color 9f");
system("color af");
system("color bf");
system("color cf");
system("color df");
system("color ef");
strcat(beep, song);
strcat(beep, alias);
system("color 0f");
system("cls");
while(1)
{
if(Preserve((Empty)))
{
BEEPOF = 0;
break;
}
else if(Preserve((Repeat)))
{
BEEPOF = 1;
break;
}
else if(Preserve((Sleepy)))
{
BEEPOF = 2;
break;
}
}
system("color 0f");
system("cls");
printf("\n\n\n\t好的,马上开始...");
_sleep(1000);
system("color 08");
_sleep(500);
system("cls");
_sleep(1500);
system("color af");
system("cls");
int WIN = 500;
int WINMOD = WIN / 10;
char OFMUSIC[100];
printf("\n\n\n\t音乐播放中...");
printf("\n\t 音量:%d",WINMOD);
Art_Title(Title);
if(BEEPOF == 0)
{
mciSendString(beep, NULL, 0, NULL);
mciSendString("play music", NULL, 0, NULL);
}
if(BEEPOF == 1)
{
mciSendString(beep, NULL, 0, NULL);
mciSendString("play music repeat", NULL, 0, NULL);
}
if(BEEPOF == 2)
{
mciSendString(beep, NULL, 0, NULL);
mciSendString("play music", NULL, 0, NULL);
setinitmode(1, 0, 0);
initgraph(-1, -1);
PIMAGE a = newimage();
getimage(a, "as.png");
putimage(0, 0, a);
}
while(1)
{
sprintf(OFMUSIC, "setaudio music volume to %d", WIN);
mciSendString(OFMUSIC,0,0,0);
PRESS = getch();
if(PRESS == ' ' && ISPLAY == TRUE)
{
mciSendString("pause music", NULL, 0, NULL);
ISPLAY = FALSE;
}
else if(PRESS == ' ' && ISPLAY == 0){
mciSendString("resume music", NULL, 0, NULL);
ISPLAY = TRUE;
}
else if(PRESS == 27)
{
mciSendString("close music", NULL, 0, NULL);
closegraph();
}
else if(PRESS == '+' || PRESS == '=')
{
int WINMOD = WIN / 10;
if(WINMOD >= 100)
{
system("cls");
printf("\n\n\n\t音乐播放中...");
printf("\n\t 音量:100",WIN);
}
else
{
WIN += 5;
WINMOD = WIN / 10;
system("cls");
printf("\n\n\n\t音乐播放中...");
printf("\n\t 音量:%d",WINMOD);
}
}
else if(PRESS == '-' || PRESS == '_')
{
WINMOD = WIN / 10;
if(WINMOD <= 0)
{
system("cls");
printf("\n\n\n\t音乐播放中...");
printf("\n\t 音量:0",WINMOD);
}
else
{
WIN -= 5;
WINMOD = WIN / 10;
system("cls");
printf("\n\n\n\t音乐播放中...");
printf("\n\t 音量:%d",WINMOD);
}
}
}
}
int main(){
Art_Title("音乐播放器 - 作者Maker");
HideCursor();
system("mode con cols=30 lines=8 ");
while(1)
{
if(Preserve(RememberSummer) == 1)
{
Title = "忆夏";
SendSong("忆夏.mp3");
}
else if(Preserve(YourRiversAndMount) == 1)
{
Title = "你的万水千山";
SendSong("你的万水千山.mp3");
}
else if(Preserve(YourRiversAndMountDJ) == 1)
{
Title = "你的万水千山DJ";
SendSong("你的万水千山DJ.mp3");
}
}
return 0;
}
效果: