?? 2robot.c
字號:
/*2個機器人踢球的核心程序*/
int two_robot(int *x,int *y);
int DrawButtons2();
#define PI 3.1415926
int two_robot(int *x,int *y)
{
int buttons,xmin = 1,xmax = 639,ymin = 1,ymax = 479;
FootballPitch pitch;
Football ball;
Robot *team1 = malloc(53 * sizeof(char));
Robot *team2 = malloc(53 * sizeof(char));
setwritemode(COPY_PUT);
InitPitch2(&pitch);
DrawPitch2(&pitch);
DrawButtons2();
InitBall2(&ball,pitch);
InitRobot1(team1,pitch,ball);
InitRobot2(team2,pitch,ball);
setwritemode(XOR_PUT);
cursor(*x,*y);
for(;;)
{
newxy(x,y,&buttons);
if(*x > 120 && *x < 190 && *y > 420 && *y < 450 && buttons)
{
setwritemode(COPY_PUT);
important2(&ball,team1,team2,&pitch);
setwritemode(XOR_PUT);
if(*x > 450 && *x < 520 && *y > 420 && *y < 450 && buttons)
break;
}
if(*x > 450 && *x < 520 && *y > 420 && *y < 450 && buttons)
break;
}
free(team1);
free(team2);
return 0;
}
/*畫出退出的按鈕*/
int DrawButtons2()
{
setfillstyle(1,LIGHTGRAY);
bar(120,420,190,450);
bar(450,420,520,450);
drawmat(kai16S,16,140,430,WHITE);
drawmat(shin16S,16,160,430,WHITE);
drawmat(tui16S,16,470,430,WHITE);
drawmat(chu16S,16,490,430,WHITE);
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -