#include "DxLib.h"
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){
ChangeWindowMode(TRUE);
if( DxLib_Init() == -1 ){
return 0;
}
int teki;
int mode=0;
int color=GetColor(255,255,255);
int haikei=LoadGraph("画像/背景.png");
int px=320,py=240;
int y_tmp=0,y_prev=0;
bool p_flag=true;
char Key[256];
int player;
player=LoadGraph("画像/キャラクタ01.png");
haikei=LoadGraph("画像/背景.png");
float speed=1.0f;
int xcount=0,ycount=0;
int ix=0,iy=0,result=0;
while(ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0 && GetHitKeyStateAll(Key)==0){
DrawGraph(0,0,haikei,TRUE);
DrawString(320,300,"ゲーム:G",color);
DrawString(320,320,"コンフィグ:c",color);
DrawString(320,340,"終了:esc",color);
if(Key[KEY_INPUT_G]==1)
mode==0;
if(Key[KEY_INPUT_C]==1)
mode==1;
if(mode==0){
ClearDrawScreen();
if(Key[KEY_INPUT_LEFT]==1||Key[KEY_INPUT_RIGHT==1]){
if(Key[KEY_INPUT_UP]==1||Key[KEY_INPUT_DOWN]){
speed=0.71f;
}else{
speed=1.0f;
}
}else if(Key[KEY_INPUT_UP]==1||Key[KEY_INPUT_DOWN]==1){
speed=1.0f;
}
if(Key[KEY_INPUT_LEFT]!=1){
px-=(int)4*speed;
}
if(Key[KEY_INPUT_RIGHT]!=1){
px+=(int)4*speed;
}
if(p_flag==true){
y_tmp=py;
py+=(py-y_prev)+1;
y_prev=y_tmp;
if(py==360)
p_flag==false;
}
if(Key[KEY_INPUT_SPACE]==1&&p_flag==false){
p_flag=1;
y_prev=py;
py=py-20;
}
if(Key[KEY_INPUT_LEFT]==1){
if(xcount>0)
xcount=0;
xcount--;
}
if(Key[KEY_INPUT_RIGHT]){
if(xcount<0)
xcount=0;
xcount++;
}
ix=abs(xcount)%30/10;
iy=abs(ycount)%30/10;
if(xcount>0){
ix+=3;
result=ix;
}else
if(xcount<0){
ix+=9;
result=ix;
}
DrawGraph(px,py,player,TRUE);
if(Key[KEY_INPUT_LEFT]!=1&&Key[KEY_INPUT_RIGHT]!=1){
xcount=0;
}
}
if(Key[KEY_INPUT_ESCAPE]==1)
break;
}
DxLib_End();
return 0;
}
実行してみると、文字は出力されるんですが、Gキーを押してもキャラが描画されません。
何が原因かわかりません。教えていただいてもよろしいでしょうか