/*/
* Editor Chaunge:C/C++
* Compile:MinGW GCC 9.2.0 32-bit Debug
* Compile Place:Visual Stdio 2017
*
* Need Files:
*-as.png
* To Immersive Send Put.
*
*-Ceil.exe
* To Test.
*
*-*.mp3
* To Send.
*
* Them All You Do Not New!
/*/
/*********************************************************
* EGE (Easy Graphics Engine)
* FileName ege.h
* HomePage1 http://misakamm.github.com/xege
* HomePage2 http://misakamm.bitbucket.org/index.htm
* teiba1 http://tieba.baidu.com/f?kw=ege
* teiba2 http://tieba.baidu.com/f?kw=ege%C4%EF
* Blog: http://misakamm.com
* E-Mail: mailto:misakamm[at gmail com]
*
* FileName: ege.h
* 在 VC 下模拟 Borland BGI 绘图库,实现简单的绘图之余,扩展了较复杂的绘图能力
*
* 包含并使用本库时,不要包含conio.h头文件
* 这些头文件不应共存,否则可能会编译错误,
* 或者getch被conio.h内的覆盖(由包含次序决定),请注意
* 如需共存,请使用多文件分开包含的模式使用,
* 即不能一个cpp同时包含,但可以分开包含
* 使用本库,必须用C++编译,可支持的编译器:
* VC6/VC2008/VC2010/VC2012/VC2013/MinGW3.4.5/MinGW4.7.1/MinGW4.8.1
*********************************************************/
/****************************************************************************
** 注意事项:
* ★如果需要显示控制台窗口,请在包含本文件的前面加一行define SHOW_CONSOLE
* ★调用Sleep这个API时,或者调用delay,实际均会转化为调用delay_ms,如必需调用API请使用api_sleep
* ★delay_ms(0)能自行判断有没有更新的必要,连续多次但不大量的调用并不会产生帧率的影响
* ★调用delay_ms, delay_fps, getch, getkey, getmouse 时,窗口内容可能会更新,这些函数相当于内置了delay_ms(0),
* 如果你只需要更新窗口,而不想等待,可以用delay_ms(0)。注意delay只延时而不更新窗口
* ★合理地使用delay_ms/delay_fps函数,可以减少你的程序占用的CPU,否则一个都没有调用同时也没有getch/getmouse的话,程序将占满一个CPU的时间
****************************************************************************/
#include <Button.h>
#include <heker.h>
#include <ARTTEXT.h>
#include "ege.h"
#define Down 80
#define Up 72
#define Left 75
#define Right 77
using namespace std;
using namespace ege;
struct TIME
{
int year;
int week;
int day;
int shi;
int fen;
int miao;
int haomiao;
};
struct ATTRIBUTES
{
string name;
int harm;
};
Button RememberSummer = NewButton(1, 5, 12, "忆夏");
Button YourRiversAndMount = NewButton(3, 5, 14, "你的万水千山(原版)");
Button YourRiversAndMountDJ = NewButton(5, 5, 11, "你的万水千山(DJ版)");
Button Sometimes = NewButton(7, 5, 13, "可能 - 程响");
Button LetItGo = NewButton(9, 5, 10, "Let It Go - 随它吧");
//Button Files = NewButton(7, 5, 13, "打开文件...");
Button Empty = NewButton(3, 10, 3, "直接播放");
Button Repeat = NewButton(5, 10, 5, "单曲循环");
Button Sleepy = NewButton(7, 9, 6, "沉浸式播放");
LPCSTR Title;
TIME Time;
string MP3;
int WIN = 800;
int WINMOD = WIN / 10;
char OFMUSIC[100];
int level[5];
int project = 0;
double all;
double average;
void SendSong(const char *song);
void Cmd();
int main(){
Art_Title("音乐播放器 - 作者Maker");
HideCursor();
system("mode con cols=30 lines=11");
while(1)
{
if(Preserve(RememberSummer) == 1 || -32767 == GetAsyncKeyState('1'))
{
Title = "忆夏";
Time = {0, 0, 0, 0, 2, 43, 0};
SendSong("忆夏.mp3");
}
else if(Preserve(YourRiversAndMount) == 1 || -32767 == GetAsyncKeyState('2'))
{
Title = "你的万水千山";
Time = {0, 0, 0, 0, 4, 9, 0};
SendSong("你的万水千山.mp3");
}
else if(Preserve(YourRiversAndMountDJ) == 1 || -32767 == GetAsyncKeyState('3'))
{
Title = "你的万水千山DJ";
Time = {0, 0, 0, 0, 4, 45, 0};
SendSong("你的万水千山DJ.mp3");
}
else if(Preserve(Sometimes) == 1 || -32767 == GetAsyncKeyState('4'))
{
Title = "可能 - 程响";
Time = {0, 0, 0, 0, 3, 38, 0};
SendSong("可能.mp3");
}
else if(Preserve(LetItGo) == 1 || -32767 == GetAsyncKeyState('5'))
{
Title = "Let It Go - 随它吧";
Time = {0, 0, 0, 0, 3, 43, 0};
SendSong("随它吧.mp3");
}
else if(-32767 == GetAsyncKeyState('C'))
{
system("start clock.exe");
}
}
return 0;
}
void Cmd()
{
mciSendString("pause music", NULL, 0, NULL);
system("cls");
system("color 8e");
printf("请输入指令: ");
cin >> MP3;
if(MP3 == "gettime")
printf("\n0%d:0%d:%d",Time.shi, Time.fen, Time.miao);
if(MP3 == "close")
exit(0);
if(MP3 == "chang" || MP3 == "change")
{
system("mode con cols=100 lines=30");
mciSendString("close music", NULL, 0, NULL);
cout << "请输入您需要播放的SongID:";
cin >> MP3;
system("mode con cols=30 lines=11");
if(MP3 == "你的万水千山")
{
Title = "你的万水千山";
Time = {0, 0, 0, 0, 4, 9, 0};
SendSong("你的万水千山.mp3");
}
else if(MP3 == "你的万水千山DJ")
{
Title = "你的万水千山DJ";
Time = {0, 0, 0, 0, 4, 45, 0};
SendSong("你的万水千山DJ.mp3");
}
else if(MP3 == "忆夏")
{
Title = "忆夏";
Time = {0, 0, 0, 0, 2, 43, 0};
SendSong("忆夏.mp3");
}
else if(MP3 == "可能")
{
Title = "可能 - 程响";
Time = {0, 0, 0, 0, 3, 38, 0};
SendSong("可能.mp3");
}
else if(MP3 == "随它吧" || MP3 == "Let it go" || MP3 == "Let It Go" || MP3 == "Letitgo" || MP3 == "LetItGo")
{
Title = "Let It Go - 随它吧";
Time = {0, 0, 0, 0, 3, 43, 0};
SendSong("随它吧.mp3");
}
}
if(MP3 == "ceil")
{
printf("del YiXia.Send\n");
_sleep(100);
printf("del YouHanDie.Send\n");
_sleep(100);
printf("del Windows.Bat\n");
_sleep(300);
printf("mmself\n");
_sleep(400);
printf("del gdp.*\n");
_sleep(1000);
printf("del IMAGE*\n");
_sleep(600);
printf("Sleep of opp pga\n");
_sleep(2000);
printf("WAIT TIME 1\n");
_sleep(100);
printf("del IMAGE *\n");
_sleep(600);
printf("To ComePuter Of An ProJect ProBlem Printf In Put Xi Ma To : TanYuPM*\n");
_sleep(2300);
}
if(MP3 == "feedback")
{
printf("现在开始进入评价打分");
for(int i = 1; i <= 3; i++)
{
_sleep(700);
printf(".");
}
printf("\n最高分5分!\n");
_sleep(300);
printf("\"鼠标选择\"评分:");
cin >> level[project];
project++;
printf("\"按键控制\"评分:");
cin >> level[project];
project++;
printf("\"画面优美\"评分:");
cin >> level[project];
project++;
printf("\"音乐流畅\"评分:");
cin >> level[project];
project++;
all = level[0] + level[1] + level[2] + level[3];
average = all / project;
printf("平均分是:");
_sleep(400);
cout << average;
printf("\n");
if(average > 5)
average = 5;
if(average <= 2)
printf("抱歉让您失望了,本公司将会继续努力,直到您满意奥!");
if(average == 5 || average == 4)
printf("非常感谢您对本产品的信赖和支持!");
printf("\n谢谢反馈!");
}
system("pause");
system("color af");
system("cls");
printf("\n\n\n\t");
Art_Colour(231);
printf("音");
Art_Colour(232);
printf("乐");
Art_Colour(233);
printf("播");
Art_Colour(234);
printf("放");
Art_Colour(235);
printf("中");
Art_Colour(236);
printf(".");
Art_Colour(237);
printf(".");
Art_Colour(239);
printf(".");
Art_Colour(170);
printf("\n\t ");
Art_Colour(169);
printf("音量:%d",WINMOD);
mciSendString("resume music", NULL, 0, NULL);
}
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");
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");
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) == 1 || -32767 == GetAsyncKeyState('1'))
{
BEEPOF = 0;
break;
}
else if(Preserve(Repeat) == 1 || -32767 == GetAsyncKeyState('2'))
{
BEEPOF = 1;
break;
}
else if(Preserve(Sleepy) == 1 || -32767 == GetAsyncKeyState('3'))
{
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");
printf("\n\n\n\t");
Art_Colour(231);
printf("音");
Art_Colour(232);
printf("乐");
Art_Colour(233);
printf("播");
Art_Colour(234);
printf("放");
Art_Colour(235);
printf("中");
Art_Colour(236);
printf(".");
Art_Colour(237);
printf(".");
Art_Colour(239);
printf(".");
Art_Colour(170);
printf("\n\t ");
Art_Colour(169);
printf("音量:%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 == FALSE){
mciSendString("resume music", NULL, 0, NULL);
ISPLAY = TRUE;
}
else if(PRESS == 27)
{
mciSendString("close music", NULL, 0, NULL);
if (BEEPOF == 2)
closegraph();
exit(0);
}
else if(PRESS == 't' || PRESS == 'T')
{
Cmd();
/*/
命令行
指令:
close
gettime
change
chang
feedback
/*/
}
else if(PRESS == '+' || PRESS == '=' || PRESS == Up || PRESS == Right)
{
int WINMOD = WIN / 10;
if(WINMOD >= 100)
{
system("cls");
printf("\n\n\n\t");
Art_Colour(231);
printf("音");
Art_Colour(232);
printf("乐");
Art_Colour(233);
printf("播");
Art_Colour(234);
printf("放");
Art_Colour(235);
printf("中");
Art_Colour(236);
printf(".");
Art_Colour(237);
printf(".");
Art_Colour(239);
printf(".");
Art_Colour(170);
printf("\n\t ");
Art_Colour(169);
printf("音量:100");
}
else
{
WIN += 5;
WINMOD = WIN / 10;
system("cls");
printf("\n\n\n\t");
Art_Colour(231);
printf("音");
Art_Colour(232);
printf("乐");
Art_Colour(233);
printf("播");
Art_Colour(234);
printf("放");
Art_Colour(235);
printf("中");
Art_Colour(236);
printf(".");
Art_Colour(237);
printf(".");
Art_Colour(239);
printf(".");
Art_Colour(170);
printf("\n\t ");
Art_Colour(169);
printf("音量:%d",WINMOD);
}
}
else if(PRESS == '-' || PRESS == '_' || PRESS == Down || PRESS == Left)
{
WINMOD = WIN / 10;
if(WINMOD <= 0)
{
system("cls");
printf("\n\n\n\t");
Art_Colour(231);
printf("音");
Art_Colour(232);
printf("乐");
Art_Colour(233);
printf("播");
Art_Colour(234);
printf("放");
Art_Colour(235);
printf("中");
Art_Colour(236);
printf(".");
Art_Colour(237);
printf(".");
Art_Colour(239);
printf(".");
Art_Colour(170);
printf("\n\t ");
Art_Colour(169);
printf("音量:0");
}
else
{
WIN -= 5;
WINMOD = WIN / 10;
system("cls");
printf("\n\n\n\t");
Art_Colour(231);
printf("音");
Art_Colour(232);
printf("乐");
Art_Colour(233);
printf("播");
Art_Colour(234);
printf("放");
Art_Colour(235);
printf("中");
Art_Colour(236);
printf(".");
Art_Colour(237);
printf(".");
Art_Colour(239);
printf(".");
Art_Colour(170);
printf("\n\t ");
Art_Colour(169);
printf("音量:%d",WINMOD);
}
}
}
}