fc2ブログ

2023-03

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のボタンに反応するサンプルになっています。


#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ブログユーザー)

NEW ENTRY «  | BLOG TOP |  » OLD ENTRY

カレンダー

02 | 2023/03 | 04
- - - 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31 -

FC2カウンター

最新記事

最新コメント

最新トラックバック

月別アーカイブ

カテゴリ

未分類 (7)
日記 (7)
wiiremote (1)
google (1)
回路 (3)
psp (1)
programing (15)
linux (0)
OpenWRT (3)
kinect (1)
Raspberry Pi (8)

検索フォーム

RSSリンクの表示

リンク

このブログをリンクに追加する

google adsense