Skip to content

Instantly share code, notes, and snippets.

@Mekapiku
Created January 15, 2014 06:14
Show Gist options
  • Save Mekapiku/8431647 to your computer and use it in GitHub Desktop.
Save Mekapiku/8431647 to your computer and use it in GitHub Desktop.
JoyStickFunc
void joystick(unsigned int buttonMask, int x, int y, int z)
{
if (x) {
/* 左スティックを左右に倒した際の処理 */
car.driver.sw = -x*2*M_PI/360/1000; // ハンドル
}
if (y) {
/* 左スティックを上下に倒した際の処理 */
car.deltaspeed = (-(double)y/1000); //アクセル、ブレーキ (y: 100->0.1km)
}
if (z) {
/* 右スティックを左右に倒した際の処理 */
}
/*switch (buttonMask) {
case GLUT_JOYSTICK_BUTTON_A:
//ボタン 1 を押した際の処理
break;
}*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment