看看这个 x,y 哪错了

时间:2021-11-06 01:16:46

看看这个 x,y 哪错了 'x' : undeclared identifier error C2065: 'y' : undeclared identi

程序代码:

#include<graphics.h>
#include<conio.h>
#include<stdio.h>
#define S1 60 //初始位置(S1,S1)
#define S2 20 //单位大小
#define M 18 //宽度多少单位
#define N 23 //高度多少单位
#define Width 600
#define Henght 700
IMAGE img3;
IMAGE img;
int o=0;
struct Barrier
{
int x;
int y;
COLORREF color;
}barrier[(N+1)*(M+1)];

void Region()
{
IMAGE img1;
IMAGE img2;
int i,j,p,q;

initgraph(Width,Henght);
setbkcolor(GREEN);
cleardevice();
loadimage(&img2,"D:\\C共享\\俄罗斯方块\\images\\GameRegionRim2.jpg");
putimage(S1,S1,&img2);
getimage(&img2,S1,S1,S2,S2);
loadimage(&img3,"D:\\C共享\\俄罗斯方块\\images\\square_blue.jpg");
putimage(S1,S1,&img3);
getimage(&img3,S1,S1,S2,S2);
loadimage(&img1,"E:\\Image\\c.jpg",Width,Henght);
putimage(0,0,&img1);

for (p=S1;p<S1+M*S2+1;p+=S2)
for (q=S1;q<S1+N*S2+1;q+=S2)
{
barrier[o].x=p;
barrier[o].y=q;
barrier[o].color=getpixel(x,y);
o++;
}

for (i=S1;i<S1+N*S2+1;i+=S2)
{
putimage(S1,i,&img2);
putimage(S1+M*S2,i,&img2);

}
for (j=S1;j<S1+M*S2+1;j+=S2)
{
putimage(j,S1,&img2);
putimage(j,S1+N*S2,&img2);
}
settextstyle(25, 0, _T("宋体"));
outtextxy(20,600,_T(" Ver 1.0 Your Score : Made By Yao"));

}

void move()
{
int a,b;
int count=0;
getimage(&img,S1+S2,S1+S2,(M-1)*S2,(N-1)*S2);
BeginBatchDraw();
for (a=0;;a++)
{

for (b=0;b<count+3;b++)
{

putimage(S1+9*S2,S1+S2*(1+b)+a,&img3);

}

FlushBatchDraw();
Sleep(10);
putimage(S1+S2,S1+S2,&img);
}
EndBatchDraw();

}

void main()
{

Region();
move();
getch();
}