本文整理汇总了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];
}
//.........这里部分代码省略.........