いつもお世話になっております。
キー取得の挙動で不具合が出るので原因がわかりましたら教えて頂けないでしょうか?
下記のプログラムでファンクションキーのF1〜F12を押すとリアルタイムに
それぞれに対応した四角が白くなるようになっているはずなのですが、
何故かF10だけ動作がおかしくなります。
反応はするのですが何故かトグルでON/OFFになるようでキーを離したことが検知されていないようです。
他のキーは大丈夫なので何故F10だけがそうなるのか原因がわかりません。
よろしくお願い致します。
以下プログラムです。
--------------------
#include <stdio.h>
#include <stdlib.h>
#include "DxLib.h"
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
ChangeWindowMode( TRUE ) ; // ウィンドウモードで起動
SetGraphMode( 640 , 480 , GetColorBitDepth() ) ; // 画面モードの変更
DxLib_Init(); // DXライブラリ初期化処理
SetDrawScreen( DX_SCREEN_BACK ) ; // グラフィックの描画先を裏画面にセット
int i,x;
char Buf[ 256 ] ;
// システムメインループ
while(!ProcessMessage()) { // Windowsの裏処理用
ClearDrawScreen() ;
GetHitKeyStateAll(Buf) ;
x=10;
if(Buf[KEY_INPUT_F1]) i=TRUE; else i=FALSE;
DrawBox(10+x,215,10+x+50,265, GetColor( 255 , 255 , 255 ) , i) ; // 四角形を描画
x+=50;
if(Buf[KEY_INPUT_F2]) i=TRUE; else i=FALSE;
DrawBox(10+x,215,10+x+50,265, GetColor( 255 , 255 , 255 ) , i) ; // 四角形を描画
x+=50;
if(Buf[KEY_INPUT_F3]) i=TRUE; else i=FALSE;
DrawBox(10+x,215,10+x+50,265, GetColor( 255 , 255 , 255 ) , i) ; // 四角形を描画
x+=50;
if(Buf[KEY_INPUT_F4]) i=TRUE; else i=FALSE;
DrawBox(10+x,215,10+x+50,265, GetColor( 255 , 255 , 255 ) , i) ; // 四角形を描画
x+=50;
if(Buf[KEY_INPUT_F5]) i=TRUE; else i=FALSE;
DrawBox(10+x,215,10+x+50,265, GetColor( 255 , 255 , 255 ) , i) ; // 四角形を描画
x+=50;
if(Buf[KEY_INPUT_F6]) i=TRUE; else i=FALSE;
DrawBox(10+x,215,10+x+50,265, GetColor( 255 , 255 , 255 ) , i) ; // 四角形を描画
x+=50;
if(Buf[KEY_INPUT_F7]) i=TRUE; else i=FALSE;
DrawBox(10+x,215,10+x+50,265, GetColor( 255 , 255 , 255 ) , i) ; // 四角形を描画
x+=50;
if(Buf[KEY_INPUT_F8]) i=TRUE; else i=FALSE;
DrawBox(10+x,215,10+x+50,265, GetColor( 255 , 255 , 255 ) , i) ; // 四角形を描画
x+=50;
if(Buf[KEY_INPUT_F9]) i=TRUE; else i=FALSE;
DrawBox(10+x,215,10+x+50,265, GetColor( 255 , 255 , 255 ) , i) ; // 四角形を描画
x+=50;
if(Buf[KEY_INPUT_F10]) i=TRUE; else i=FALSE;
DrawBox(10+x,215,10+x+50,265, GetColor( 255 , 255 , 255 ) , i) ; // 四角形を描画
x+=50;
if(Buf[KEY_INPUT_F11]) i=TRUE; else i=FALSE;
DrawBox(10+x,215,10+x+50,265, GetColor( 255 , 255 , 255 ) , i) ; // 四角形を描画
x+=50;
if(Buf[KEY_INPUT_F12]) i=TRUE; else i=FALSE;
DrawBox(10+x,215,10+x+50,265, GetColor( 255 , 255 , 255 ) , i) ; // 四角形を描画
x+=50;
ScreenFlip() ;
}
DxLib_End() ; // DXライブラリ使用の終了処理
exit(0); // ソフトの終了
}