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


C++ Quad::setOccupied方法代码示例

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


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

示例1: notifyKeyPressed

	// Tasta apasata
	void notifyKeyPressed(unsigned char key_pressed, int mouse_x, int mouse_y) {
		
		if(key_pressed == 27) lab::glut::close();	// ESC inchide glut.
		if(key_pressed == 32) {
			// SPACE reincarca shaderul si recalculeaza locatiile (offseti/pointeri)
			glDeleteProgram(gl_program_shader);
			gl_program_shader = lab::loadShader("shadere\\shader_vertex.glsl", "shadere\\shader_fragment.glsl");
		}
		if (key_pressed == 'a') {
			if (main_character->atDestination()) {
				// Plasez personaj principal si generez unul nou.
				glm::vec3 pos = main_character->getPosition();
				quad->setOccupied((int)ceil(pos.x - 1), (int)ceil(pos.z - 1));
				main_character->setInactive();
				main_character = new Character(MAIN_ACTIVE, main_slope, obj_build, quad);
				characters.push_back(main_character);
				delete cams[0];
				cams[0] = main_character->getFpsCam();
				delete cams[4];
				cams[4] = main_character->getTpsCam();
			}
		}
		if (key_pressed == 'r') {	// Opreste cutremur.
			x_quake = -1;
		}
		if (key_pressed == 'e') {	// Incepe cutremur.
			if (x_quake <= -1) {
				amplitude = 0.2 + ((double)rand() / RAND_MAX) * 0.8;	// intre 0.2 si 1.
				frequency = rand() % 50;
				x_quake = 0;
			}

		}
		if (key_pressed == 'c') {	// Comuta intre camere.
			cam_index = (cam_index + 1) % 7;
		}
		if (key_pressed == 'w') {	// Desenare wireframe.
			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		}
		if (key_pressed == 's') {	// Desenare solid.
			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		}
		// Taste pentru deplasarea camerei FPS de sus.
		if (key_pressed == 't') {
			if (cam_index == 6)
				cams[6]->translateForward(1.0f);
		}
		if (key_pressed == 'y') {
			if (cam_index == 6)
				cams[6]->translateForward(-1.0f);
		}
		if (key_pressed == 'u') {
			if (cam_index == 6)
				cams[6]->translateUpword(1.0f);
		}
		if (key_pressed == 'i') {
			if (cam_index == 6)
				cams[6]->translateUpword(-1.0f);
		}
		if (key_pressed == 'o') {
			if (cam_index == 6)
				cams[6]->translateRight(-1.0f);
		}
		if (key_pressed == 'p') {
			if (cam_index == 6)
				cams[6]->translateRight(1.0f);
		}
		if (key_pressed == '1') {
			if (cam_index == 6)
				cams[6]->rotateFPSoX(1.0f);
		}
		if (key_pressed == '2') {
			if (cam_index == 6)
				cams[6]->rotateFPSoX(-1.0f);
		}
		if (key_pressed == '3') {
			if (cam_index == 6)
				cams[6]->rotateFPSoY(1.0f);
		}
		if (key_pressed == '4') {
			if (cam_index == 6)
				cams[6]->rotateFPSoY(-1.0f);
		}
		if (key_pressed == '5') {
			if (cam_index == 6)
				cams[6]->rotateFPSoZ(1.0f);
		}
		if (key_pressed == '6') {
			if (cam_index == 6)
				cams[6]->rotateFPSoZ(-1.0f);
		}
		if (key_pressed == 'q') {			// Schimba modul special cu modul normal si invers.
			special_mode = !special_mode;
			for (int i = 0; i < characters.size(); ++i) {
				delete characters[i];
			}
			for (int i = 0; i < cams.size(); ++i) {
				delete cams[i];
			}
//.........这里部分代码省略.........
开发者ID:DianaDespa,项目名称:Ski-Jumping,代码行数:101,代码来源:main.cpp


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