tomatomax.net

Every rule has its exception.

JoystickState.GetButtons()

以下はジョイスティックのボタン状態を得て、ボタンが押されていたらウィンドウを閉じる部分。

byte[] buttons = JS.GetButtons();
int cnt = 0;
foreach (byte b in buttons)
{
if (0 != (b & 0x80))
{
result = cnt;
this.DialogResult = DialogResult.OK;
this.Close();
}
cnt++;
}

Managedになってもやはり最上位ビットで判断するのか……。

Leave a Reply