プログラミングのうまい人から見て、このコードをもっと簡単に書くことができる、無駄な部分はありますか?
#include "DxLib.h"
int Key[256];
int GetHitKeyStateAll_2(int GetHitKeyStateAll_InputKey[]){
char GetHitKeyStateAll_Key[256];
GetHitKeyStateAll( GetHitKeyStateAll_Key );
for(int i=0;i<256;i++){
if(GetHitKeyStateAll_Key[i]==1) GetHitKeyStateAll_InputKey[i]++;
else GetHitKeyStateAll_InputKey[i]=0;
}
return 0;
}
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){
ChangeWindowMode(TRUE);//ウィンドウモード
if(DxLib_Init() == -1 || SetDrawScreen( DX_SCREEN_BACK )!=0) return -1;//初期化と裏画面化
while(ProcessMessage()==0 && ClearDrawScreen()==0 && GetHitKeyStateAll_2(Key)==0 && Key[KEY_INPUT_ESCAPE]==0){
//↑メッセージ処理 ↑画面をクリア ↑入力状態を保存 ↑ESCが押されていない
//ココ!!
LoadGraphScreen( 0 , 0 , "top.jpg" , TRUE ) ;
int White;
White = GetColor( 100 , 255 , 0) ; //
SetFontSize( 40 ) ; //サイズを20に変更
SetFontThickness( 1 ) ; //太さを1に変更
ChangeFont( "HGS創英角ポップ体" ) ; //HGS創英角ポップ体に変更
ChangeFontType( DX_FONTTYPE_ANTIALIASING_EDGE );//アンチエイリアス&エッジ付きフォントに変更
DrawFormatString(100,100, White , "なんとかゲーム" );//文字列表示
SetFontThickness( 10 ) ;
DrawFormatString(100,200, White , "Zキーでゲーム開始!" );
DrawFormatString(100,260, White , "Xキーで終了" );
White = GetColor( 255 , 0 , 0) ;
if(!0){
if(Key[KEY_INPUT_Z] >= 1 ) //ボタンが押されたら
DrawFormatString(220,300, White , "スタート" );
if(Key[KEY_INPUT_X] == 1 ) //ボタンが押されたら
exit(0);
;
;
}
ScreenFlip();
}
DxLib_End();
return 0;
}