実行できない
Posted: 2012年3月27日(火) 17:09
//main.cpp
#include "main.h"
#define GLOBAL_INSTANCE
//ループで必ず行う3大処理
int ProcessLoop(){
//実体化
Key *pkey;
Key key;
pkey = &key;
if(ProcessMessage()!=0){
return -1;//プロセス処理がエラーなら-1を返す
}
if(ClearDrawScreen()!=0){
return -1;//画面クリア処理がエラーなら-1を返す
}
pkey->GetHitKeyStateAll_2();//現在のキー入力処理を行う
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
//実体化
Key *pkey;
Key key;
pkey = &key;
Graph *pgraph;
Graph graph;
pgraph = &graph;
Load *pload;
Load load;
pload = &load;
ChangeWindowMode(TRUE);//ウィンドウモード
if(DxLib_Init() == -1 || SetDrawScreen( DX_SCREEN_BACK )!=0){
return -1;//初期化と裏画面化
}
pload->load();//データのロード
while(ProcessLoop()==0){//メインループ
pgraph->graph_main();//描画メイン
if(pkey->CheckStateKey(KEY_INPUT_ESCAPE)==1){
break;//エスケープが入力されたらブレイク
}
ScreenFlip();//裏画面反映
}
DxLib_End();//DXライブラリ終了処理
return 0;
}
//main.h
#ifndef INCLUDE_MAIN_H
#define INCLUDE_MAIN_H
#include "DxLib.h"
#include "key.h"
#include "character.h"
#include "graph.h"
#endif
//character.cpp
#include "character.h"
//character.h
#ifndef INCLUDE_CHARACTER_H
#define INCLUDE_CHARACTER_H
#include "DxLib.h"
class Character{
public:
int flag; //フラグ
int cnt; //カウンタ
int power; //パワー
int point; //ポイント
int score; //スコア
int num; //残機数
int mutekicnt; //無敵状態とカウント
int shot_mode; //ショットモード
int money; //お金
int img; //画像
int slow; //スローかどうか
double x,y; //座標
};
#endif
//load.cpp 読み込み
#include "load.h"
void Load::load(){
LoadDivGraph( "dat/img/char/0.png" , 12 , 4 , 3 , 73 , 73 , img_ch[0] ) ;
}
//load.h
#ifndef INCLUDE_LOAD_H
#define INCLUDe_LOAD_H
#include "DxLib.h"
class Load{
public:
int img_ch[2][12];//キャラ画像読み込み用
void load();//画像ロード関数
};
#endif
//graph.cpp 画像処理
#include "graph.h"
void Graph::graph_ch(){
Character *pch;
Character ch;
pch = &ch;
Load *pload;
Load load;
pload = &load;
DrawRotaGraphF(ch.x,ch.y,1.0f,0.0f,pload->img_ch[0][ch.img],TRUE);
}
void Graph::graph_main(){
graph_ch();
}
//graph.h
#ifndef INCLUDE_GRAPH_H
#define INCLUDE_GRAPH_H
#include "DxLib.h"
#include "character.h"
#include "load.h"
class Graph{
public:
void graph_ch();//キャラ画像描画
void graph_main();//画像処理メイン
};
#endif
Visual C++ 2010 Expless
クラスについてあまりに理解できていないと思い、参考書を買って勉強して再度挑戦しているのですが、
実行できませんでした。
龍神のキャラ描画をやりたいのですが、描画されるどころか実行できません。
コンパイルエラーは発生していません。
どなたか理由のわかる方よろしくお願いいたします。