8 Star 6 Fork 1

ssSiXxx/人生重开模拟器

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Const_View.cpp 5.97 KB
一键复制 编辑 原始数据 按行查看 历史
小邓 提交于 2023-12-01 12:43 +08:00 . 不显示控制台
#include "Count.h"
//该项将扩展功能时不需要更改的界面显示集合
//打印按键坐标时要把各个按键的左上角坐标与右下角坐标 以及各个需要填写文字的坐标信息 用批注填写清楚 便于其他函数输出界面时使用
#include<easyx.h>
#include <Windows.h>
#include <mmsystem.h>
#pragma comment(lib,"winmm.lib")
character role;
//打印主界面 以原型图为准
//要求:对每个选项进行鼠标点击判断 如果点击则调用相应的界面函数
//点击退出游戏按钮结束程序 点击切换背景可以改变背景颜色
//负责人:天河
void Start_view() {
prinStartView(); //打印界面内容
ExMessage msg ;//鼠标状态变量
while (true) {
//获取鼠标状态
if (peekmessage(&msg, EX_MOUSE)) {
//printf("%d\t%d\t", msg.x, msg.y);
bool a = ClickJudge(578, 403, 840, 454, &msg);
//printf("\t--%d--\t", a);
if (ClickJudge(578, 403, 840, 454, &msg)) {
/*printf("TalentSelect(character role1)");*/
TalentSelect(&role);
}
a = ClickJudge(632, 529, 808, 564, &msg);
//printf("\t--%d--\t", a);
if (ClickJudge(632, 529, 808, 564, &msg)) {
/*printf("Produceview()2");*/
Produceview();
}
a = ClickJudge(584, 630, 856, 682, &msg);
//printf("\t--%d--\t", a);
if (ClickJudge(584, 630, 856, 682, &msg)) {
/*printf("exit()3");*/
exit(0);
}
a = ClickJudge(766, 774, 876, 827, &msg);
//printf("\t--%d--\t",a);
if (ClickJudge(766, 774, 876, 827, &msg)) {
/*printf("SetView()");*/
SetView();
}
if (ClickJudge(1163, 790, 1332, 822, &msg)) {
/*printf("Maker_view()");*/
Maker_view();
}
}
//各个按键的点击判断 (立刻重开 玩法介绍 退出游戏 游戏设置 制作人员)
}
}
//打印主界面内容
//确定启动窗口大小为:
void prinStartView() {
initgraph(1440, 900);
setbkcolor(RED);
cleardevice();
IMAGE start;
loadimage(&start, "./Start.jpg", 1440, 900, false);
putimage(0, 0, &start);
}
//打印制作人员名单
//负责人:落落
void Maker_view() {
initgraph(1440, 900);
//printf("woxihuanni");
cleardevice();
IMAGE img_m;
loadimage(&img_m, "./maker.jpg", 1440, 900, false);
putimage(0, 0, &img_m);
prinMaker(); //打印制作人员名单
ExMessage msg = { 0 };//鼠标状态变量
while (1) {
peekmessage(&msg, EX_MOUSE);//获取鼠标状态
if(ClickJudge(676,718,765,786,&msg)==1){
Start_view();//返回按键的点击判断
}
}
closegraph();
}
void prinMaker() {
}
// 打印游戏背景 玩法介绍 点击 返回 调用 Start_view 函数 即主界面函数
//负责人:落落
void Produceview() {
initgraph(1440, 900);
/*while (true) {*/
//prinProduce(); //打印游戏背景,玩法介绍(鼠标点击 回车播放)
//printf("woxihuanni");
cleardevice();
IMAGE img_p;
loadimage(&img_p, "./produce.jpg", 1440, 900);
putimage(0, 0, &img_p);
ExMessage msg = { 0 };//鼠标状态变量
while (1) {
peekmessage(&msg, EX_MOUSE);//获取鼠标状态
if (ClickJudge(676, 718, 765, 786, &msg) == 1) {
Start_view();//返回按键的点击判断
}
}
//}
closegraph();
}
void prinProduce() {
}
// 游戏设置 暂时只有音效开关
//负责人:初冬
void SetView() {
//prinSetView();//打印界面内容
initgraph(1440, 900);
setbkcolor(RGB(79, 79, 79));
cleardevice();
IMAGE png_background;
IMAGE png_b1;
IMAGE png_b2;
IMAGE png_w1;
IMAGE png_w2;
loadimage(&png_background, "./background.png", 1440, 900);
putimage(0, 0, &png_background);
loadimage(&png_b1, "./b1.png");
loadimage(&png_w1, "./w1.png");
loadimage(&png_w2, "./w2.png");
putimage(740, 400, &png_b1);
putimage(600, 410, &png_w1);
putimage(670, 650, &png_w2);
ExMessage msg = { 0 };//鼠标状态变量
bool musicPlaying = true;//判断音乐状态
bool imageb1 = true;//判断按键状态
while (true) {
//printf("______________");
if (peekmessage(&msg, EX_MOUSE)) {
//printf("%d %d ", msg.x, msg.y);
if (ClickJudge(740, 400, 940, 550, &msg)) {
imageb1 = !imageb1;
if (imageb1) {
IMAGE png_b1;
loadimage(&png_b1, "./b1.png");
//printf("hahahah");
putimage(740, 400, &png_b1);
}
else {
IMAGE png_b2;
loadimage(&png_b2, "./b2.png");
//printf("lalaalal");
putimage(740, 400, &png_b2);
}
if (musicPlaying) {
//printf("start");
mciSendString("open ./remake.mp3 alias BGM", NULL, 0, NULL);
mciSendString("play BGM", NULL, 0, NULL);
musicPlaying = false;
}
else {
//printf("stop");
mciSendString("close BGM", NULL, 0, NULL);
musicPlaying = true;
}
}
if (ClickJudge(670, 650, 800, 750, &msg)) {
//printf("ok");
Start_view();//请点两次
}
}
}
closegraph();
}
//打印演绎人生的基础界面
void prinPlayLife() {
/*cleardevice();*/
//绘画上下左右的方框
setfillcolor(RGB(79, 79, 79));
setlinecolor(RGB(79, 79, 79));
fillrectangle(0, 0, 75, 900);
fillrectangle(1365, 0, 1440, 900);
fillrectangle(0, 0, 1440, 130);
fillrectangle(0, 770, 1440, 900);
//settextstyle(50, 0, "宋体");
settextstyle(40, 0, "宋体", 0, 0, FW_BOLD, false, false, false);
char* strs[8];
char str1[] = "颜值:", str2[] = "智力:", str3[] = "家境:", str4[] = "体质:", str5[] = "自动播放", str6[] = "再来一次", str7[] = "人生经历", str8[] = "退出游戏";
strs[0] = str1; strs[1] = str2; strs[2] = str3; strs[3] = str4; strs[4] = str5;strs[5] = str6; strs[6] = str7; strs[7] = str8;
settextcolor(WHITE);
setbkmode(TRANSPARENT);
outtextxy(150, 50, strs[0]);
outtextxy(460, 50, strs[1]);
outtextxy(770, 50, strs[2]);
outtextxy(1080, 50, strs[3]);
settextcolor(RGB(204, 247, 131));
outtextxy(100, 800, strs[4]);
//printf("%d", textwidth(strs[4]));
//settextstyle(40, 0, "宋体", 0, 0, FW_BOLD, false, false, false);
settextcolor(RGB(254, 250, 1311));
outtextxy(460, 800, strs[5]);
//printf("%d", textwidth(strs[5]));
//settextstyle(40, 0, "宋体", 0, 0, FW_BOLD, false, false, false);
settextcolor(RGB(147, 210, 243));
outtextxy(820, 800, strs[6]);
//printf("%d", textwidth(strs[6]));
settextstyle(40, 0, "宋体", 0, 0, FW_BOLD, false, false, false);
settextcolor(RGB(189, 49, 36));
outtextxy(1180, 800, strs[7]);
//printf("%d", textwidth(strs[7]));
}
void prinlifeview() {
setbkcolor(RGB(79, 79, 79));
setfillcolor(RGB(109, 109, 109));
solidroundrect(75, 130, 1365, 770, 5, 5);
setlinecolor(WHITE);
line(175, 130, 175, 770);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/sssixxx/life-reboot-simulator.git
git@gitee.com:sssixxx/life-reboot-simulator.git
sssixxx
life-reboot-simulator
人生重开模拟器
master

搜索帮助