GetHitKeyStateAll()の仕組みがよくわかりません。
Posted: 2016年6月30日(木) 18:51
#include "DxLib.h"
int Key[256];
int gpUpdateKey(){
char tmpKey[256];
GetHitKeyStateAll( tmpKey );
for( int i=0; i<256; i++ ){
if( tmpKey[i] != 0 ){
Key[i]++;
} else {
Key[i] = 0;
}
}
return 0;
}
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int){
ChangeWindowMode(TRUE), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK );
int x=0;
while( ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0 && gpUpdateKey()==0 ){
DrawFormatString( x, 0, GetColor(255,255,255), "?!" );
if( Key[KEY_INPUT_RIGHT] == 1 ){ //ここ!!
x = x + 50;
}
}
DxLib_End();
return 0;
}
具体的にいうと
①tmpKey[0]には何が格納されているのでしょうか?右シフトキーの状態?バックスペースの状態?
②ソースコードの中にもコメント"//ここ!!"をいれたのですが、なぜ配列で0~256としているのに数字でもない"KEY_INPUT_RIGHT"が来るのでしょうか?
どなたかよろしく解説お願いします。