本文整理汇总了C++中Maze::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Maze::Draw方法的具体用法?C++ Maze::Draw怎么用?C++ Maze::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Maze
的用法示例。
在下文中一共展示了Maze::Draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display
// This callback function gets called by the Glut
// system whenever it decides things need to be redrawn.
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (current_view == perspective_view) {
glEnable(GL_DEPTH_TEST);
glLoadIdentity();
gluLookAt(-3,-3,7, 3,3,0, 0,0,1);
}
else if (current_view == top_view){
glDisable(GL_DEPTH_TEST);
glLoadIdentity();
}
else if (current_view == rat_view){
glEnable(GL_DEPTH_TEST);
glLoadIdentity();
double z_level = .25;
double x = gRat.getX();
double y = gRat.getY();
//problem with dx and dy
double dx = gRat.getdX();
double dy = gRat.getdY();
//double at_x = x + dx;
//double at_y = y + dy;
double at_x =gRat.getNextX() ;
double at_y =gRat.getNextY() ;
double at_z = z_level;
//std::cout<<dx<<" "<<at_x<<"----"<<dy<<" "<<at_y<<std::endl;
gluLookAt(x,y,z_level, at_x, at_y, at_z, 0,0,1);
//gluLookAt(x,y,z_level, 360, 360, at_z, 0,0,1);
}
gMaze.Draw(current_view);
if(gMiddleButtonDown) {
gRat.Scuttle(gMaze);
glutPostRedisplay();
}
if(gLeftButtonDown){
gRat.SpinLeft();
glutPostRedisplay();
}
if(gRightButtonDown){
gRat.SpinRight();
glutPostRedisplay();
}
gRat.Draw(current_view);
glutSwapBuffers();
}