当前位置: 首页>>代码示例>>C++>>正文


C++ Road::getSideCenterPosition方法代码示例

本文整理汇总了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
开发者ID:alexditu,项目名称:EGC_Tema_2,代码行数:67,代码来源:main.cpp


注:本文中的Road::getSideCenterPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。