手元の環境で SetUseDirectInputFlag(TRUE); SetKeyboardNotDirectInputFlag(TRUE); の設定を使用した
以下のようなテストプログラム( GetHitKeyStateAll で取得できる値を画面に表示するプログラム )を
実行してみましたが、一度押したキーがキーを離しても 1 のままになるということはありませんでした
#include "DxLib.h"
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
char KeyBuffer[ 256 ] ;
// ウインドウモードで起動
ChangeWindowMode( TRUE ) ;
// DirectInput を使用する指定をする
SetUseDirectInputFlag( TRUE ) ;
SetKeyboardNotDirectInputFlag( TRUE ) ;
// DXライブラリの初期化
if( DxLib_Init() < 0 ) return -1 ;
// 描画先を裏画面にする
SetDrawScreen( DX_SCREEN_BACK ) ;
// メインループ
while( ProcessMessage() == 0 )
{
// 画面のクリア
ClearDrawScreen() ;
memset( KeyBuffer, 0, sizeof( KeyBuffer ) ) ;
GetHitKeyStateAll( KeyBuffer ) ;
int i, j ;
for( i = 0 ; i < 16 ; i ++ )
{
DrawFormatString( 32, 64 + i * 16, GetColor( 255,255,255 ), "%X", i ) ;
for( j = 0 ; j < 16 ; j ++ )
{
if( i == 0 )
{
DrawFormatString( 64 + j * 16, 32 + i * 16, GetColor( 255,255,255 ), "%X", j ) ;
}
DrawFormatString( 64 + j * 16, 64 + i * 16, GetColor( 255,255,255 ), "%s", KeyBuffer[ j + i * 16 ] ? "1" : "0" ) ;
}
}
// 裏画面の内容を表画面に反映
ScreenFlip() ;
}
// DXライブラリの後始末
DxLib_End() ;
// ソフトの終了
return 0 ;
}
was-blue.0793さんの環境では上記のプログラムでもキーを離しても 1 のままになってしまうか
よろしければお試し頂けないでしょうか m(_ _)m