Platform SDK: DirectX |
ここでは、Visual Basic でのアプリケーション開発について説明する。C++ については、「Direct3D 直接モードの C/C++ チュートリアル」を参照すること。
次のコードは、デバイスの能力を確認する方法を示す。サンプル Enumeration では、次のアルゴリズムを使って、指定されたデバイスでサポートされるディスプレイ モードを選択する。
サンプル Enumeration では、次のコードを実行してこのアルゴリズムを実装する。
For j = 1 To g_ddEnumModes.GetCount() ' このディスプレイ モードはテストされていないので、互換性がないものと見なす。 bCompatible = False ' ステップ 1: g_ddEnumModes.GetItem j, g_enumInfo ' ステップ 2: modeDepth = g_enumInfo.ddpfPixelFormat.lRGBBitCount ' ステップ 3: bitDepth = deviceDesc.lDeviceRenderBitDepth ' ステップ 4: If (32 = modeDepth) And (bitDepth And DDBD_32) Then bCompatible = True If (24 = modeDepth) And (bitDepth And DDBD_24) Then bCompatible = True If (16 = modeDepth) And (bitDepth And DDBD_16) Then bCompatible = True ' 必要なディスプレイ モードだけをコンボ ボックスに表示する。 If bCompatible Then cmbMode.AddItem Str(g_enumInfo.lWidth) + " x" + Str(g_enumInfo.lHeight) + " x" + Str(g_enumInfo.ddpfPixelFormat.lRGBBitCount) End If Next j
このアルゴリズムが完了すると、指定された条件に合致するディスプレイ モードのリストがコンボ ボックス cmbMode に保持され、それ以外のディスプレイ モードはすべて無視される。