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


C++ Level::drawEverything方法代码示例

本文整理汇总了C++中Level::drawEverything方法的典型用法代码示例。如果您正苦于以下问题:C++ Level::drawEverything方法的具体用法?C++ Level::drawEverything怎么用?C++ Level::drawEverything使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Level的用法示例。


在下文中一共展示了Level::drawEverything方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createWizardEntity


//.........这里部分代码省略.........
		 1.0, 0.0,  3.0,
		 1.0, 0.0, -3.0,
		-1.0, 0.0, -3.0};
	PlaneEntity* tmpFloor2 = createPlaneEntity("", stepTex, HORIZONTAL, floorVert2, 0, 2.0f, -7.0f);
	GLfloat floorVert3[12] = { 
		-1.0, 2.0,  0.0,
		 1.0, 2.0,  0.0,
		 1.0, -2.0, 0.0,
		-1.0, -2.0, 0.0};
	PlaneEntity* tmpFloor3 = createPlaneEntity("", stepTex, VERTICAL_X, floorVert3, 0, 0.0f, -4.0f);

	BlockEntity* tmpBlock = createBlockEntity("", stepTex, 0.0f, 0.25f, 7.0f, 4.0f, 0.5f, 5.0f);

	//entities->add(tmpModel);
	entities->add(tmpWall1);
	entities->add(tmpWall2);
	entities->add(tmpFloor);
	entities->add(tmpFloor2);
	entities->add(tmpFloor3);
	entities->add(tmpBlock);*/
	// ========== END TEST ========== //

	while( running ) {
		if( SDL_PollEvent(&event) ) {
			if(event.key.keysym.sym == SDLK_ESCAPE || event.type == SDL_QUIT) {
				running = false;
			} else if(event.type == SDL_KEYDOWN) {
				if(event.key.keysym.sym == SDLK_SPACE) player->jump();
				else if(event.key.keysym.sym == SDLK_x) player->turn180();
				keys[event.key.keysym.scancode] = true;
			} else if(event.type == SDL_KEYUP) {
				keys[event.key.keysym.scancode] = false;
			}
		}
		movePlayer(keys, player);

		// ========== START TEST ========== //
		player->incrementYOf(VELOCITY, -0.2f); // gravity hack
		/*
			// Must be  in level superclass: ******
		glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
		glLoadIdentity();

		glColor3f(1, 1, 1);

		GLfloat matrix[16];
		glGetFloatv(GL_MODELVIEW_MATRIX, matrix);

#ifndef COLLIDED_CONSOLE_HERE
		if(player->hasCollided(tmpModel)) {
			if(!collision[0]) {
				cout << "Collision: Model" << endl;
				collision[0] = true;
			}
		} else if(collision[0] == true) collision[0] = false;
		
		if(player->hasCollided(tmpWall1)) {
			if(!collision[1]) {
				cout << "Collision: Wall1" << endl;
				collision[1] = true;
			}
		} else if(collision[1] == true) collision[1] = false;
		
		if(player->hasCollided(tmpWall2)) {
			if(!collision[2]) {
				cout << "Collision: Wall2" << endl;
				collision[2] = true;
			}
		} else if(collision[2] == true) collision[2] = false;

		if(player->hasCollided(tmpFloor)) {
			if(!collision[3]) {
				cout << "Collision: Floor" << endl;
				collision[3] = true;
			}
		} else if(collision[3] == true) collision[3] = false;
#endif
		*/
		//player->drawSelf(matrix, entities); // Used to adjust camera based on player position
		//glLoadMatrixf(matrix);

		//entities->drawSelf();
			// ******************************* //
		// ========== END TEST ========== //
		level->drawEverything();
		
		SDL_GL_SwapWindow(mainWindow);

		printFPS(frames, initialTime);
	}
	
		// ========== START TEST ========== //
	// Remember to delete all models (should be entity linked list) when done!
	delete tmpModel;
	delete tmpWall1;
	delete tmpWall2;
	delete tmpFloor;
	delete player;
		// ========== END TEST ========== //
}
开发者ID:Lefevrest,项目名称:cs495-group,代码行数:101,代码来源:main.cpp


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