本文整理汇总了C++中Road::getSideCenterPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Road::getSideCenterPosition方法的具体用法?C++ Road::getSideCenterPosition怎么用?C++ Road::getSideCenterPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Road
的用法示例。
在下文中一共展示了Road::getSideCenterPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onIdle
//.........这里部分代码省略.........
Transform3D::applyTransform(enemies[j]->getElement(i));
}
}
}
}
}
// Adaugare inamic la un anumit interval de timp;
elipsedTime++;
// afisez un nou obiect, random pe una din benzi, la un interval de timp
// invers proportional cu viteza de deplasare a masinii
// in cazul in care viteza e 0, nu mai afisez niciun inamic
if ((car.getSpeed() != 0) && (elipsedTime >= 600/car.getSpeed())) {
unsigned int ii;
while(1) {
ii = rand() % enemies.size();
if (enemies[ii]->isShowable() == false) {
if (enemies[ii]->getType() == 4) {
if (speedBonus == false) {
if (rand() % 3 == 0) {
enemies[ii]->doShow();
break;
}
}
} else {
enemies[ii]->doShow();
break;
}
}
}
if (ii < enemies.size()) {
int rnd = rand() % 3;
enemies[ii]->setPosition(drum.getSideCenterPosition(rnd));
}
elipsedTime = 0;
}
// Animatie masina
Point3D crtPos = car.getPosition();
Transform3D::loadIdentityModelMatrix();
Transform3D::rotateMatrixOy(car.getAngle());
Transform3D::translateMatrix(crtPos.x, crtPos.y, crtPos.z);
Transform3D::loadIdentityProjectionMatrix();
Transform3D::perspectiveProjectionMatrix(xc,yc,zc);
for (unsigned int i = 0; i < car.getNoOfElements(); i++) {
Transform3D::applyTransform(car.getElement(i));
}
// roatire roti
crtPos = car.getPosition();
for (unsigned int i = 0; i < 4; i++) {
Transform3D::loadIdentityModelMatrix();
Transform3D::translateMatrix(-car.getOffset(i).x, 0, -car.getOffset(i).y);
if ( i < 2) {
Transform3D::rotateMatrixOz(-PI/2); //(cu pi/2 fata de oz ca sa nu mai fie culcate)
} else {
Transform3D::rotateMatrixOz(+PI/2); // celelalte 2 roti trebuiesc rotice cu +Pi/2
}
car.setWheelAngle(car.getWheelAngle() - car.getSpeed() / 100 * 0.2); // rotire roti in sensul de mers
Transform3D::rotateMatrixOx(car.getWheelAngle());
Transform3D::translateMatrix(car.getOffset(i).x, 0, car.getOffset(i).y);
Transform3D::rotateMatrixOy(car.getAngle());
Transform3D::translateMatrix(crtPos.x, crtPos.y, crtPos.z); // aduc rotile in aceeasi pozitie cu masina