資源簡介
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? 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.em
?????文件?????????732??2014-06-12?16:59??Elevator?Simulation\Elevator?Simulation\Debug\Elevator?Simulation.exe.em
?????文件?????????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\li
?????文件???????????2??2014-06-12?22:11??Elevator?Simulation\Elevator?Simulation\Debug\li
?????文件???????????2??2014-06-12?22:11??Elevator?Simulation\Elevator?Simulation\Debug\li
?????文件???????????2??2014-06-12?22:11??Elevator?Simulation\Elevator?Simulation\Debug\li
?????文件???????????2??2014-06-12?22:11??Elevator?Simulation\Elevator?Simulation\Debug\li
............此處省略45個文件信息
- 上一篇:基于Zigbee和ARM技術的樓宇智能照明系統_劉超
- 下一篇:駕校網站源碼
評論
共有 條評論