龍神録の4章を応用してプログラムを書いたのですが(応用とはいっても持ち合わせの画像に合わせただけでやっていることはほとんど同じですが)表示されるはずの画像が表示されません。一体どこがダメなのでしょうか?
プログラムの中身
struct.h
typedef struct{
int num; //残機数
int score; //スコア
int mutekicnt; //無敵状態とカウント
int img; //画像
double x,y; //座標
}ch_t;
#include "../ヘッダー/GV.h"
extern int img[12];
void load(){
LoadDivGraph("../画像/キャラグラ/自機.png",12,3,4,38,41,img);
}
#include "../ヘッダー/GV.h"
extern ch_t ch;
extern int img[12];
void graph_ch(){
DrawGraph(ch.x,424,img[0],TRUE);
}//graph_ch()の中にimgの0番(自機の上向き画像)の作画作業を入れる
void graph_main(){
graph_ch();
}//graph_main()の中にgraph_ch()を入れる
#define GLOBAL_INSTANCE
#include "../ヘッダー/GV.h"
//現在のキー入力処理を行う
extern int GetHitKeyStateAll_2();
//受け取ったキー番号の現在の入力状態を返す
extern int CheckStateKey(unsigned char Handle);
//load.cppを実行する
extern void load();
//graph.cppの中のgraph_main()を実行する
extern void graph_main();
int img[12]; //キャラクタ画像
ch_t ch; //キャラクタデータ
//ループで必ず行う3大処理
int ProcessLoop(){
if(ProcessMessage()!=0)return -1;//プロセス処理がエラーなら-1を返す
if(ClearDrawScreen()!=0)return -1;//画面クリア処理がエラーなら-1を返す
GetHitKeyStateAll_2();//現在のキー入力処理を行う
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;//初期化と裏画面化
load();//load.cppを実行する
while(ProcessLoop()==0){//ProcessLoopの内容を行う
graph_main();//graph.cppの中のgraph_main()を実行する
if(CheckStateKey(KEY_INPUT_ESCAPE)==1)break;//エスケープが入力されたらブレイク
//ココ!!
ScreenFlip();
}
DxLib_End();
return 0;
}
#include "../ヘッダー/GV.h"
unsigned int stateKey[256];
int GetHitKeyStateAll_2(){
char GetHitKeyStateAll_Key[256];
GetHitKeyStateAll( GetHitKeyStateAll_Key );
for(int i=0;i<256;i++){
if(GetHitKeyStateAll_Key[i]==1) stateKey[i]++;
else stateKey[i]=0;
}
return 0;
}
int CheckStateKey(unsigned char Handle){
return stateKey[Handle];
}