有无朋友帮忙解答一下,为什么在点击角色名称后没有反应?
这个是点击人物图像之后的反应
但是点击角色名称后没有反应
(第一次用easyx做小游戏
#include <stdio.h>
//1.包含图形库头文件
#include <graphics.h>
//2.包含键盘操作头文件
#include <conio.h>
#include <vector>
#include <string>
using namespace std;
void shubiao();
void zhanshi();
//void shubiao2();
void renwuxuanze();
//void jsxd2();
void L()
{
setbkcolor(BLACK);
cleardevice();
IMAGE loading;
loadimage(&loading, "loading.jpg", 300, 100);
putimage(240, 160, &loading);
IMAGE imshow;
vector<IMAGE> run;
string imgNames[] =
{
"1.png",
"2.png",
"3.png",
"4.png",
"5.png",
"6.png",
"7.png",
"8.png",
};
for (int i = 0; i < 8; i++)
{
IMAGE im;
loadimage(&im, imgNames[i].c_str(), 80, 80);
run.push_back(im);
}
int i = 0;
while (true)
{
if (i == 7)
i = 0;
imshow = run[i];
putimage(340, 280, &imshow);
i++;
Sleep(400);
}
Sleep(5000);
}
void shubiao()
{
while (true)
{
MOUSEMSG msg = GetMouseMsg();
if (msg.uMsg == WM_LBUTTONDOWN)
{
Sleep(500);
renwuxuanze();
}
}
}
void renwuxuanze()
{
setbkcolor(RGB(109, 116, 135));
cleardevice();
BeginBatchDraw();
IMAGE y;
loadimage(&y, "鹰人.jpg", 100, 80);
putimage(200, 200, &y);
//文字输出显示选项
settextstyle(30, 15, "Showcard Gothic");
setbkmode(TRANSPARENT);
settextcolor(RGB(255, 255, 255));
outtextxy(300, 200, "战士");
EndBatchDraw();
while (true)
{
MOUSEMSG msg = GetMouseMsg();
if (msg.uMsg == WM_LBUTTONDOWN)
{
if (msg.x > 300 && msg.x < 480 && msg.y > 305 && msg.y < 325 && msg.mkLButton)
{
zhanshi();
}
if (msg.x > 200 && msg.x < 280 && msg.y > 210 && msg.y < 270 && msg.mkLButton)
{
Sleep(500);
L();
}
}
}
}
void zhanshi()
{
Sleep(500);
setbkcolor(RGB(109, 116, 135));
cleardevice();//用背景颜色刷新背景
BeginBatchDraw();
IMAGE y;
loadimage(&y, "鹰人.jpg", 100, 80);
putimage(320, 60, &y);
settextstyle(25, 10, "Showcard Gothic");
setbkmode(TRANSPARENT);
settextcolor(RGB(255, 255, 255));
outtextxy(300, 200, "角色名称:战士");
outtextxy(300, 250, "等级:1");
outtextxy(300, 300, "经验:0");
outtextxy(300, 350, "血量:200");
outtextxy(300, 400, "武力值:5");
outtextxy(300, 450, "经济:100");
settextstyle(30, 15, "Showcard Gothic");
setbkmode(TRANSPARENT);
settextcolor(RGB(255, 255, 255));
outtextxy(500, 80, "点击屏幕任意位置返回");
EndBatchDraw();
shubiao();
}
int main()
{
//2.创建窗口,确定窗口大小
initgraph(800, 500);
setbkcolor(WHITE);
cleardevice();
//插入图片
IMAGE img;
loadimage(&img, "b.jpg", 800, 500);
putimage(0, 0, &img);
//文字输出显示
settextstyle(60, 30, "Showcard Gothic");
setbkmode(TRANSPARENT);
settextcolor(RGB(255, 255, 255));
outtextxy(70, 110, "Welcome To 1037 Forest");
//文字输出显示选项
settextstyle(30, 15, "Showcard Gothic");
setbkmode(TRANSPARENT);
settextcolor(RGB(255, 255, 255));
outtextxy(340, 250, "1.新游戏");
outtextxy(300, 300, "2.从存档处开始");
while (true)
{
MOUSEMSG msg = GetMouseMsg();
if (msg.uMsg == WM_LBUTTONDOWN)
{
if (msg.x > 300 && msg.x < 480 && msg.y > 305 && msg.y < 325 && msg.mkLButton)
{
renwuxuanze();
}
}
}
getchar();
closegraph();
return 0;
}