• 大小: 13.32M
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-06-29
  • 语言: 其他
  • 标签: 其他  

资源简介

ElevatorSimulation.zip

资源截图

代码片段和文件信息

#include “StdAfx.h“
#include “Animation.h“
//#include “GLFont.h“



CAnimation::CAnimation(void)
{
eleTopLeftX = -2.0f;
eleTopLeftY = 5.7f;
}


CAnimation::~CAnimation(void)
{
}


// 绘制背景图
void CAnimation::drawBack()
{

GLfloat topLeftX = -6.0f;                // 左侧线条位置
GLfloat topLeftY = 4.7f;
GLfloat topRightX = -2.0f;               //右侧线条位置
GLfloat topRightY = 4.7f;


glColor3f(000);                          //黑色

glLineWidth(0.5);
glBegin(GL_QUADS); // 绘制三角形
glVertex3f(-6.0f 5.7f 0.0f); // 左上
glVertex3f( 6.0f 5.7f 0.0f); // 右上
glVertex3f( 6.0f 5.6f 0.0f); // 右下
glVertex3f(-6.0f 5.6f 0.0f);
glEnd();

for(int i = 0; i < 8; i++)                //下面八个楼层的位置
{
glBegin(GL_QUADS);
glVertex3f(topLeftX topLeftY 0);
glVertex3f(topRightX topRightY 0);
glVertex3f(topRightX topRightY - 0.1 0);
glVertex3f(topLeftX topLeftY - 0.1 0);
glEnd();
glBegin(GL_QUADS);
glVertex3f(topLeftX * -1 topLeftY 0);
glVertex3f(topRightX * -1 topRightY 0);
glVertex3f(topRightX * -1 topRightY - 0.1 0);
glVertex3f(topLeftX * -1 topLeftY - 0.1 0);
glEnd();

topLeftY -= 1;
topRightY -= 1;
}

glBegin(GL_QUADS); // 绘制三角形
glVertex3f(-6.0f topLeftY 0.0f); // 左上
glVertex3f( 6.0f topLeftY 0.0f); // 右上
glVertex3f( 6.0f topLeftY - 0.1 0.0f);      // 右下
glVertex3f(-6.0f topLeftY - 0.1 0.0f);
glEnd();


glBegin(GL_QUADS);
glVertex3f(-2.1 5.7 0);
glVertex3f(-2.0 5.7 0);
glVertex3f(-2.0 -3.4 0);
glVertex3f(-2.1 -3.4 0);
glEnd();

glBegin(GL_QUADS);
glVertex3f(2.1 5.7 0);
glVertex3f(2.0 5.7 0);
glVertex3f(2.0 -3.4 0);
glVertex3f(2.1 -3.4 0);
glEnd();

}

void CAnimation::drawElevator()
{


glColor3f(2552550);                             //电梯颜色
glBegin(GL_QUADS);

glVertex3f(eleTopLeftX eleTopLeftY 0.0f);         //电梯形状
glVertex3f(eleTopLeftX +4 eleTopLeftY 0.0f);
glVertex3f(eleTopLeftX +4 eleTopLeftY - 1 0.0f);
glVertex3f(eleTopLeftX eleTopLeftY - 1 0.0f);

glEnd();


}

void CAnimation::nextFram(int thisFloor int nextFloor)
{
int isDown = 0;
GLfloat temp = 0;
if(thisFloor - nextFloor > 0)                        //判断电梯运行方向
isDown = 1;
else 
isDown = 0;

if(isDown)
{
temp = 5.7 + (nextFloor - 9) * 1 + 0.1 ;         //电梯向下运行时的位置变化
if(this->eleTopLeftY >= temp)
this->eleTopLeftY -= 0.04;
}
else
{
temp = 5.7 + (nextFloor - 9) * 1 ;                //电梯向上运行时的位置变化
if(this->eleTopLeftY < temp)
this->eleTopLeftY += 0.04;
}

}

void CAnimation::upfloor()                            //电梯向上运行时,箭头指示的方向
{
glColor3f(000);

glLineWidth(1);
glBegin(GL_QUADS);  //左半箭头
glVertex3f(7.1 2.0 1);
glVertex3f(7.0 1.5 1);
glVertex3f(7.0 0.0 1);
glVertex3f(7.1 0.0 1);
glEnd();
glBegin(GL_QUADS); //右半箭头
glVertex3f(7.2 1.5 1);
glVertex3f(7.1 2.0 1);
glVerte

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-06-13 00:18  Elevator Simulation\
     目录           0  2014-06-13 00:16  Elevator Simulation\Debug\
     文件      242176  2014-06-12 22:11  Elevator Simulation\Debug\Elevator Simulation.exe
     文件     2446564  2014-06-12 22:11  Elevator Simulation\Debug\Elevator Simulation.ilk
     文件     5811200  2014-06-12 22:11  Elevator Simulation\Debug\Elevator Simulation.pdb
     目录           0  2014-06-13 00:16  Elevator Simulation\Elevator Simulation\
     文件        3657  2014-06-12 22:11  Elevator Simulation\Elevator Simulation\Animation.cpp
     文件         488  2014-06-12 21:44  Elevator Simulation\Elevator Simulation\Animation.h
     文件           1  2009-08-31 02:32  Elevator Simulation\Elevator Simulation\ClassDiagram1.cd
     目录           0  2014-06-13 00:16  Elevator Simulation\Elevator Simulation\Debug\
     文件       21259  2014-06-12 22:11  Elevator Simulation\Elevator Simulation\Debug\Animation.obj
     文件      241192  2014-06-12 22:11  Elevator Simulation\Elevator Simulation\Debug\CL.read.1.tlog
     文件       19090  2014-06-12 22:11  Elevator Simulation\Elevator Simulation\Debug\CL.write.1.tlog
     文件         667  2014-06-12 14:34  Elevator Simulation\Elevator Simulation\Debug\Elevator Simulation.exe.embed.manifest
     文件         732  2014-06-12 16:59  Elevator Simulation\Elevator Simulation\Debug\Elevator Simulation.exe.embed.manifest.res
     文件         381  2014-06-12 22:11  Elevator Simulation\Elevator Simulation\Debug\Elevator Simulation.exe.intermediate.manifest
     文件         114  2014-06-13 00:16  Elevator Simulation\Elevator Simulation\Debug\Elevator Simulation.lastbuildstate
     文件        1465  2014-06-13 00:16  Elevator Simulation\Elevator Simulation\Debug\Elevator Simulation.log
     文件       59377  2014-06-12 21:44  Elevator Simulation\Elevator Simulation\Debug\Elevator Simulation.obj
     文件    33816576  2014-06-12 16:59  Elevator Simulation\Elevator Simulation\Debug\Elevator Simulation.pch
     文件       85268  2014-06-12 16:59  Elevator Simulation\Elevator Simulation\Debug\Elevator Simulation.res
     文件       58388  2014-06-12 21:44  Elevator Simulation\Elevator Simulation\Debug\Elevator SimulationDoc.obj
     文件       54849  2014-06-12 22:11  Elevator Simulation\Elevator Simulation\Debug\Elevator SimulationView.obj
     文件         228  2014-06-12 14:34  Elevator Simulation\Elevator Simulation\Debug\Elevator Simulation_manifest.rc
     文件       90018  2014-06-12 16:59  Elevator Simulation\Elevator Simulation\Debug\MainFrm.obj
     文件       16634  2014-06-12 22:11  Elevator Simulation\Elevator Simulation\Debug\cl.command.1.tlog
     文件           2  2014-06-12 22:11  Elevator Simulation\Elevator Simulation\Debug\link-cvtres.read.1.tlog
     文件           2  2014-06-12 22:11  Elevator Simulation\Elevator Simulation\Debug\link-cvtres.write.1.tlog
     文件           2  2014-06-12 22:11  Elevator Simulation\Elevator Simulation\Debug\link.8140-cvtres.read.1.tlog
     文件           2  2014-06-12 22:11  Elevator Simulation\Elevator Simulation\Debug\link.8140-cvtres.write.1.tlog
     文件           2  2014-06-12 22:11  Elevator Simulation\Elevator Simulation\Debug\link.8140.read.1.tlog
............此处省略45个文件信息

评论

共有 条评论