本文整理汇总了C++中Jet::jetBoost方法的典型用法代码示例。如果您正苦于以下问题:C++ Jet::jetBoost方法的具体用法?C++ Jet::jetBoost怎么用?C++ Jet::jetBoost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jet
的用法示例。
在下文中一共展示了Jet::jetBoost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyboard
void keyboard(unsigned char key, int, int) {
// float radv = (jet.ver + 15) * 3.1416 / 180;
Vector3d axis;
axis = jet.up.cross(jet.forward);
float angle = PI/16;
switch(key) {
case 'w':
rotateAxisVec(angle, axis, jet.forward);
rotateAxisVec(angle, axis, jet.up);
break;
case 's':
rotateAxisVec(-angle, axis, jet.forward);
rotateAxisVec(-angle, axis, jet.up);
break;
case 'a':
rotateUpZ(-angle, jet.forward, jet.up);
break;
case 'd':
rotateUpZ(angle, jet.forward, jet.up);
break;
// case 'w':
// jet.ver = (int)( jet.ver - 10) % 360;
// break;
// case 'a':
// jet.hor = (int)( jet.hor + ((int) 10 * cos(radv)/abs(cos(radv)))) % 360;
// break;
// case 's':
// jet.ver = (int)( jet.ver + 10) % 360;
// break;
// case 'd':
// jet.hor = (int)( jet.hor - (10 * cos(radv)/abs(cos(radv)))) % 360;
// break;
case 'q':
jet.jetBoost();
break;
case 'e':
jet.jetBrake();
break;
}
jet.up.normalize();
jet.forward.normalize();
axis = jet.up.cross(jet.forward);
// debugLog(jet.forward, jet.up, axis);
}
示例2: EventLoop
//.........这里部分代码省略.........
if( sdlEvent.jaxis.value < -JOYSTICK_DEAD_ZONE ) {
camera.yawMod = (PI / 2.3) * (sdlEvent.jaxis.value + JOYSTICK_DEAD_ZONE) / (JOYSTICK_MAX_VALUE - JOYSTICK_DEAD_ZONE);
}
//Above of dead zone
else if( sdlEvent.jaxis.value > JOYSTICK_DEAD_ZONE ) {
camera.yawMod = (PI / 2.3) * (sdlEvent.jaxis.value - JOYSTICK_DEAD_ZONE) / (JOYSTICK_MAX_VALUE - JOYSTICK_DEAD_ZONE);
}
else {
camera.yawMod = 0;
}
}
//Y axis motion
else if( sdlEvent.jaxis.axis == 3 ) {
//Left of dead zone
if( sdlEvent.jaxis.value < -JOYSTICK_DEAD_ZONE ) {
camera.pitchMod = (PI / 2.3) * (sdlEvent.jaxis.value + JOYSTICK_DEAD_ZONE) / (JOYSTICK_MAX_VALUE - JOYSTICK_DEAD_ZONE);
}
//Right of dead zone
else if( sdlEvent.jaxis.value > JOYSTICK_DEAD_ZONE ) {
camera.pitchMod = (PI / 2.3) * (sdlEvent.jaxis.value - JOYSTICK_DEAD_ZONE) / (JOYSTICK_MAX_VALUE - JOYSTICK_DEAD_ZONE);
}
else {
camera.pitchMod = 0;
}
} else if( sdlEvent.jaxis.axis == 4 ) {
//Full Trigger
if( sdlEvent.jaxis.value == JOYSTICK_MAX_VALUE ) {
shooting = true;
shoot(0);
} else {
shooting = false;
}
}else {
if(abs(sdlEvent.jaxis.value) > JOYSTICK_DEAD_ZONE){
printf("Joystick %d axis %d value: %d\n",
sdlEvent.jaxis.which,
sdlEvent.jaxis.axis, sdlEvent.jaxis.value);
}
}
}
break;
case SDL_JOYHATMOTION:
printf("Joystick %d hat %d value:",
sdlEvent.jhat.which, sdlEvent.jhat.hat);
if (sdlEvent.jhat.value == SDL_HAT_CENTERED)
printf(" centered");
if (sdlEvent.jhat.value & SDL_HAT_UP)
printf(" up");
if (sdlEvent.jhat.value & SDL_HAT_RIGHT)
printf(" right");
if (sdlEvent.jhat.value & SDL_HAT_DOWN)
printf(" down");
if (sdlEvent.jhat.value & SDL_HAT_LEFT)
printf(" left");
printf("\n");
break;
case SDL_JOYBALLMOTION:
printf("Joystick %d ball %d delta: (%d,%d)\n",
sdlEvent.jball.which,
sdlEvent.jball.ball, sdlEvent.jball.xrel, sdlEvent.jball.yrel);
break;
case SDL_JOYBUTTONDOWN:
// printf("Joystick %d button %d down\n",
// sdlEvent.jbutton.which, sdlEvent.jbutton.button);
if( sdlEvent.jaxis.which == 0 ){
switch(sdlEvent.jbutton.button){
case 0:
jet.jetBoost();
break;
case 1:
jet.jetBrake();
break;
case 3:
camera.first = !camera.first;
break;
default:
printf("Joystick %d button %d down\n",
sdlEvent.jbutton.which, sdlEvent.jbutton.button);
break;
}
} else{
printf("Joystick %d button %d down\n",
sdlEvent.jbutton.which, sdlEvent.jbutton.button);
}
break;
// case SDL_JOYBUTTONUP:
// printf("Joystick %d button %d up\n",
// sdlEvent.jbutton.which, sdlEvent.jbutton.button);
// break;
case SDL_KEYDOWN:
if ((sdlEvent.key.keysym.sym != SDLK_ESCAPE) && (sdlEvent.key.keysym.sym != SDLK_AC_BACK)) {
break;
}
/* Fall through to signal quit */
// YOUR OTHER EVENT HANDLING HERE
}
}
glutTimerFunc(10, EventLoop, 0);
}