本文整理汇总了C++中AList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ AList::push_back方法的具体用法?C++ AList::push_back怎么用?C++ AList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AList
的用法示例。
在下文中一共展示了AList::push_back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KeyPressed
void KeyPressed(unsigned char ch, int x, int y)
{
if(ch == ' ')
{
Point3 p(Xpos,Ypos,Zpos);
Vector d(Xrot,Yrot,Zrot);
Agent a(p,2.0,2.0,1.0,1.0,d,1,NULL);
//a.xrot=Xrot; a.yrot=Yrot; a.zrot=Zrot;
Agents.push_back(a);
nAgents++;
}
switch (ch)
{
// ESC key to exit program
case 27: /* ESC */
//delete Env; //->CloseOutFile();
exit(0);
break;
case 'y' :
Ypos +=0.5;
if(Ypos > bb->center.y+bb->height/2)
Ypos =bb->center.y+bb->height/2;
break;
case 'b' :
Ypos -=0.5;
if(Ypos < bb->center.y-bb->height/2)
Ypos =bb->center.y-bb->height/2;
break;
case 'h' :
Xpos +=0.5;
if(Xpos > bb->center.x+bb->width/2)
Xpos =bb->center.x+bb->width/2;
break;
case 'g' :
Xpos -=0.5;
if(Xpos < bb->center.x-bb->width/2)
Xpos =bb->center.x-bb->width/2;
break;
case 'j' :
Zpos +=0.5;
if(Zpos > bb->center.z+bb->depth/2)
Zpos =bb->center.z+bb->depth/2;
break;
case 'u' : Zpos -=0.5;
if(Zpos < bb->center.z-bb->depth/2)
Zpos =bb->center.z-bb->depth/2;
break;
case 'z' : Zrot +=0.5; break;
case 'Z' : Zrot -=0.5; break;
case 'x' : Xrot +=0.5; break;
case 'X' : Xrot -=0.5; break;
case 'c' : Yrot +=0.5; break;
case 'C' : Yrot -=0.5; break;
case 's' :
if ((stream = fopen(fname, "wt")) == NULL)
{
cout << "Failed to open file for writing : "<< fname<<endl;
exit(0);
}
fprintf(stream,"%ld\n",nAgents);
for(unsigned long int i=0; i<nAgents; i++)
{
fprintf(stream,"%f %f %f %f %f %f\n",Agents[i].Pos.x,Agents[i].Pos.y,Agents[i].Pos.z,
Agents[i].Dir.x,Agents[i].Dir.y,Agents[i].Dir.z);
}
fclose(stream);
default :
break;
}
// tell the system we need to redisplay
glutPostRedisplay();
}