DDKなしで WiiYourself を使う (DLL化)
WiiYourselfでわざわざDDKをインストールするのがめんどくさかったので簡単に使えるDLLを作ってみた。
VC++ 2008 Express
WinDDK 3790.183
で開発しました。
WiiYourSelf DLL
WiiYourself Sample
このプロジェクトをダウンロードした後、
下のように使用するプロジェクトの設定する。
C/C++ => 追加のインクルードディレクトリ => WiiYourself/include
リンカ => 追加のライブラリディレクトリ => WiiYourself/lib
あとは WiiYourself/bin から必要なDLLを持ってきてコンパイル、実行するだけ。
DDKをインストール擦る必要がないから簡単に導入できるはず。
サンプルはwiiremoteのボタンに反応するサンプルになっています。
流石に再配布はまずいかも。
アウトだったら消します。
VC++ 2008 Express
WinDDK 3790.183
で開発しました。
WiiYourSelf DLL
WiiYourself Sample
このプロジェクトをダウンロードした後、
下のように使用するプロジェクトの設定する。
C/C++ => 追加のインクルードディレクトリ => WiiYourself/include
リンカ => 追加のライブラリディレクトリ => WiiYourself/lib
あとは WiiYourself/bin から必要なDLLを持ってきてコンパイル、実行するだけ。
DDKをインストール擦る必要がないから簡単に導入できるはず。
サンプルはwiiremoteのボタンに反応するサンプルになっています。
#include
#include "wiimote.h"
int main()
{
// wiimote クラス宣言
wiimote remote;
std::cerr << "waiting connection... \t";
// 接続まで待機
while(!remote.Connect(wiimote::FIRST_AVAILABLE));
// 使用するセンサを設定(ボタン、加速度、IR、エクステンション)
remote.SetReportType(wiimote::IN_BUTTONS_ACCEL_IR_EXT);
std::cerr << "success" << std::endl;
// Homeボタンが押されたら終了
while( !remote.Button.Home() )
{
// wiimoteの状態が変化するまで待機
while( remote.RefreshState() == NO_CHANGE ) Sleep(1);
if( remote.Button.B() ) std::cerr << "B button" << std::endl;
if( remote.Button.A() ) std::cerr << "A button" << std::endl;
if( remote.Button.Up() ) std::cerr << "↑ button" << std::endl;
if( remote.Button.Down() ) std::cerr << "↓ button" << std::endl;
if( remote.Button.Right() ) std::cerr << "→ button" << std::endl;
if( remote.Button.Left() ) std::cerr << "← button" << std::endl;
}
// wiimote切断
remote.Disconnect();
return 0;
}
流石に再配布はまずいかも。
アウトだったら消します。
● COMMENT FORM ●
トラックバック
http://chicklab.blog84.fc2.com/tb.php/23-c4378bd0
この記事にトラックバックする(FC2ブログユーザー)