⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 donghua.cpp

📁 某国际贸易中心共有40层
💻 CPP
字号:
#include "egg.h"
#include "DIANTI.h"
#include <windows.h>



HEGG screen;
HEGG elevator;
HEGG egg1,egg2,egg3,egg4,egg5,egg6,egg7,egg[10],eggA[9],eggB[10],button[11],eggbase;

const double firstplace=3.5;
const double firstplace2=16.2;
const double firstplace3=18.7;
const double height=23.5;

void lift(void)
{
	int j;
	double h=0;	
	EggStart(25,25);
	
	/*电梯主体*/

	egg1=LayEgg();
    MovePen(3,20);
	DrawBitmap("lift.bmp");
    MovePen(1,20.1);
	DrawBitmap("f.bmp");
	
    egg2=LayEgg();
    MovePen(3,4.3);
	DrawBitmap("box.bmp");

	/*电梯方向*/
	
	egg4=LayEgg();
	MovePen(0.5,height);
	DrawBitmap("jiantou11.bmp");
	egg3=LayEgg();
	MovePen(0.5,height);
	DrawBitmap("jiantou10.bmp");
	
	egg6=LayEgg();
	MovePen(21.5,height);
	DrawBitmap("jiantou21.bmp");
	egg5=LayEgg();
	MovePen(21.5,height);
	DrawBitmap("jiantou20.bmp");	

/*电梯当前楼层*/
/*2F*/
	egg[2]=LayEgg();
	MovePen(firstplace,height);
	DrawBitmap("F2.bmp");
/*3F*/
	egg[3]=LayEgg();
	MovePen(firstplace,height);
	DrawBitmap("F3.bmp");
/*4F*/
	egg[4]=LayEgg();
	MovePen(firstplace,height);
	DrawBitmap("F4.bmp");
/*5F*/
	egg[5]=LayEgg();
	MovePen(firstplace,height);
	DrawBitmap("F5.bmp");
/*6F*/
	egg[6]=LayEgg();
	MovePen(firstplace,height);
	DrawBitmap("F6.bmp");
/*7F*/
	egg[7]=LayEgg();
	MovePen(firstplace,height);
	DrawBitmap("F7.bmp");
/*8F*/
	egg[8]=LayEgg();
	MovePen(firstplace,height);
	DrawBitmap("F8.bmp");
/*9F*/
	egg[9]=LayEgg();
	MovePen(firstplace,height);
	DrawBitmap("F9.bmp");
/*1F*/
	egg[1]=LayEgg();
	MovePen(firstplace,height);
	DrawBitmap("F1.bmp");
/*电梯内部按钮*/	
	button[1]=LayEgg();
	MovePen(firstplace2,7.6);
	DrawBitmap("L1.bmp");

	button[2]=LayEgg();
	MovePen(firstplace3,9);
	DrawBitmap("L2.bmp");
	
	button[3]=LayEgg();
	MovePen(firstplace2,10.1);
	DrawBitmap("L3.bmp");
	

	button[4]=LayEgg();
	MovePen(firstplace3,11.6);
	DrawBitmap("L4.bmp");
	
	button[5]=LayEgg();
	MovePen(firstplace2,12.7);
	DrawBitmap("L5.bmp");

	button[6]=LayEgg();
	MovePen(firstplace3,14.1);
	DrawBitmap("L6.bmp");

	button[7]=LayEgg();
	MovePen(firstplace2,15.2);
	DrawBitmap("L7.bmp");
	
	button[8]=LayEgg();
	MovePen(firstplace3,16.6);
	DrawBitmap("L8.bmp");
	
	button[9]=LayEgg();
	MovePen(firstplace2,17.8);
	DrawBitmap("L9.bmp");

	button[10]=LayEgg();
	MovePen(21.35,14.1);
	DrawBitmap("LGO.bmp");

	eggbase=LayEgg();
	MovePen(15,19);
	DrawBitmap("base.bmp");
/*呼叫按钮*/
	for(j=2;j<=8;j++)
	{
		eggA[j]=LayEgg();
		MovePen(11,5.8+h);
		DrawBitmap("up.bmp");
		h=h+2;
	}
	for(j=2,h=0;j<=8;j++)
	{
		eggB[j]=LayEgg();
		MovePen(12.5,5.8+h);
		DrawBitmap("down.bmp");
		h=h+2;
	}
	eggA[1]=LayEgg();
	MovePen(11.75,4);
	DrawBitmap("up.bmp");
	eggB[9]=LayEgg();
	MovePen(11.75,19.68);
	DrawBitmap("down.bmp");

	egg7=LayEgg();
	MovePen(11,20.1);
	DrawBitmap("base1.bmp");
}
/*运行*/
void run(int n)
{
	int i;
	SetAutoUpdate(0);
	/*箭头*/	
	if(n>0)
	{
		SetActiveEgg(egg3);
		ChangeEggLayer(TOP);

		SetActiveEgg(egg6);
		ChangeEggLayer(TOP);
	}
    if(n<0)
	{
	    SetActiveEgg(egg4);
		ChangeEggLayer(TOP);

		SetActiveEgg(egg5);
		ChangeEggLayer(TOP);
	}
    /*箱体*/
    for(i=0; i<=(n>0?n:-n)*48; i++)
	{
		SetActiveEgg(egg2);
	    OffsetEgg(0,0.4 * 0.1*(n>0?1:-1));
	    Update();
		Sleep(2);
	}   
}
/*楼层灯*/
void cf(int c)
{
	SetAutoUpdate(0);
	SetActiveEgg(egg[c]);
	ChangeEggLayer(TOP);
	Update();
}
/*内部按钮*/
void Button(int a[],int go) 
{
	int i;
	for( i=1; i<=9; i++ )
		if( a[i]==1 )
		{
			SetActiveEgg(button[i]);
			ChangeEggLayer(TOP);
		}
	if(go==1)
	{
	    SetActiveEgg(button[10]);
		ChangeEggLayer(TOP);
	}
}
/*熄灭内部按钮*/
void fade(int c)
{
	SetAutoUpdate(0);
	SetActiveEgg(button[c]);
	ChangeEggLayer(BOTTOM);
	SetActiveEgg(eggA[c]);
	ChangeEggLayer(BOTTOM);
	SetActiveEgg(eggB[c]);
	ChangeEggLayer(BOTTOM);
	Update();
}
void fadego(void)
{
	SetAutoUpdate(0);
	SetActiveEgg(button[10]);
	ChangeEggLayer(BOTTOM);
	Update();
}
void call(int updown,int floor)
{
	if(updown==1)
	{
		SetAutoUpdate(0);
		SetActiveEgg(eggA[floor]);
		ChangeEggLayer(TOP);
		Update();
	}
	if(updown==-1)
	{	
		SetAutoUpdate(0);
		SetActiveEgg(eggB[floor]);
		ChangeEggLayer(TOP);
		Update();
	}
}
void idle(void)
{
	SetAutoUpdate(0);
	SetActiveEgg(egg3);
	ChangeEggLayer(TOP);
	SetActiveEgg(egg5);
	ChangeEggLayer(TOP);
	Update();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -