该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
e=-dx;
x=x0;y=y0;
while(x<=x1)
{
for(i=0;i<=2;i++)
for(j=0;j<=2;j++)
video_buffer[((y-1+i)<<8)+((y-1+i)<<6)+(x-1+j)]=4;
x=x+7;
e=e-2*dy;
if(e>0){y=y-7;e=e-2*dx;}
sleep(1);
}
}
knd4(struct windows *win)
{
unsigned char far *video_buffer=(char far *)0xa0000000;
int x,y,e,dx,dy,x1,y1,x0,y0,i,j;
int *q,*p;
q=(int *)malloc(42);/*为数组q[20]申请内存空间*/
for(i=0;i<21;i++)
q[i]=80+i*7;
p=(int *)malloc(42);/*为数组p[20]申请内存空间*/
for(i=0;i<21;i++)
p[i]=10+i*7;
drawnet(q,p,24,video_buffer);/*重画网格*/
x0=101;y0=136;
x1=150;y1=24;
dx=x1-x0;
dy=y1-y0;
e=-dy;
x=x0;y=y0;
while(y>=y1)
{
for(i=0;i<=2;i++)
for(j=0;j<=2;j++)
video_buffer[((y-1+i)<<8)+((y-1+i)<<6)+(x-1+j)]=4;
y=y-7;
e=e-2*dx;
if(e<0){x=x+7;e=e-2*dy;}
sleep(1);
}
}
/*circle选项触发函数*/
knd5(struct windows *win)
{
printf("kind5 pressed");
}
knd6(struct windows *win)
{
printf("kind6 pressed");
}
/*菜单Line按钮对象函数*/
menu1(struct windows *win)/*win为Line按钮对象*/
{
windows_ptr now;
windows_ptr pre;
windows_ptr head;
windows_ptr cho;
unsigned char far *video_buffer=(char far *)0xa0000000;
int i,j;
now=win;
cho=win->next;/*cho指向circle*/
if(win->status==MIN)/*菜单未打开*/
{
if(cho->status==MAX)
menu2(cho);
while(now->next!=NULL)
now=now->next;/*将now放在链表最后一个(窗口初始化的结构体->exit对象)*/
head=now;
pre=now;
for(i=0;i<=55;i++)
for(j=0;j<=43;j++)
video_buffer[((129+i)<<8)+((129+i)<<6)+(4+j)]=24;/*绘制菜单背景*/
now=(struct windows *)malloc(sizeof(struct windows));
initstruct(now,BUTTON,5,172,46,184,15,0,"kind1",0,knd1);
drawbartool(now,video_buffer);
now->father=win;
pre->next=now;
now->pre=head;
pre=now;
now=(struct windows *)malloc(sizeof(struct windows));
initstruct(now,BUTTON,5,158,46,170,15,0,"kind2",0,knd2);
drawbartool(now,video_buffer);
pre->next=now;
now->pre=pre;
pre=now;
now=(struct windows *)malloc(sizeof(struct windows));
initstruct(now,BUTTON,5,144,46,156,15,0,"kind3",0,knd3);
drawbartool(now,video_buffer);
pre->next=now;
now->pre=pre;
pre=now;
now=(struct windows *)malloc(sizeof(struct windows));
initstruct(now,BUTTON,5,130,46,142,15,0,"kind4",0,knd4);
drawbartool(now,video_buffer);
pre->next=now;
now->pre=pre;
pre=now;
pre->next=NULL;
win->status=MAX;
}
else if(win->status==MAX)
{
for(i=0;i<=55;i++)
for(j=0;j<=43;j++)
video_buffer[((129+i)<<8)+((129+i)<<6)+(4+j)]=0;
now=now->next;
now=now->next;
head=now;/*head指向Exit结构体*/
while(now->next!=NULL)
now=now->next;
while(now->pre!=head)
{
now=now->pre;
free(now->next);/*释放最后一个结构体空间*/
}
free(now);/*释放表尾*/
head->next=NULL;/*Exit指向空*/
win->status=MIN;
}
}
/*Circle对象函数*/
menu2(struct windows *win)/*win为Line按钮对象*/
{
windows_ptr now;
windows_ptr pre;
windows_ptr head;
windows_ptr cho;
unsigned char far *video_buffer=(char far *)0xa0000000;
int i,j;
now=win;
cho=win->pre;
if(win->status==MIN)/*菜单未打开*/
{
if(cho->status==MAX)
menu1(cho);
while(now->next!=NULL)
now=now->next;/*将now放在链表最后一个(窗口初始化的结构体->exit对象)*/
head=now;
pre=now;
for(i=0;i<=27;i++)
for(j=0;j<=52;j++)
video_buffer[((157+i)<<8)+((157+i)<<6)+(49+j)]=24;/*绘制菜单背景*/
now=(struct windows *)malloc(sizeof(struct windows));
initstruct(now,BUTTON,50,172,100,184,15,0,"kind1",0,knd5);
drawbartool(now,video_buffer);
pre->next=now;
now->pre=pre;
pre=now;
now=(struct windows *)malloc(sizeof(struct windows));
initstruct(now,BUTTON,50,158,100,170,15,0,"kind2",0,knd6);
drawbartool(now,video_buffer);
pre->next=now;
now->pre=pre;
pre=now;
pre->next=NULL;
win->status=MAX;
}
else if(win->status==MAX)
{
for(i=0;i<=27;i++)
for(j=0;j<=52;j++)
video_buffer[((157+i)<<8)+((157+i)<<6)+(49+j)]=0;
now=now->next;
head=now;/*head指向Exit结构体*/
while(now->next!=NULL)
now=now->next;
while(now->pre!=head)
{
now=now->pre;
free(now->next);/*释放最后一个结构体空间*/
}
free(now);/*释放表尾*/
head->next=NULL;/*Exit指向空*/
win->status=MIN;
}
}
********************************