したらばTOP ■掲示板に戻る■ 全部 1-100 最新50 | |

P203までの「main.h」

1AF:2013/05/08(水) 14:53:02
#include <DxLib.h>
#include <Box2D/Box2D.h>
#ifdef _DEBUG
#pragma comment(lib, "Box2D_d.lib")
#endif
#ifndef _DEBUG
#pragma comment(lib, "Box2D.lib")
#endif
#include "_dxdebugdraw.h"

//定数
#define B2D_DEBUG_DRAW
const int VELOCITYITE = 6; //速度計算精度
const int POSITIONITE = 2; //位置計算精度
const float GRAVITY_Y = 10.0f; //重力加速度
const float WLDSC = 50.0f; //世界倍率
const float SCREENAREA = 300.0f;//スクリーン範囲

//画像読み込み用構造体
struct Images{
int back[2]; //背景画像
int logo[3]; //ロゴ(タイトル、オーバー、クリア)
int titleback;
int hero[6]; //主人公キャラクター
int wall[4]; //壁・床
};
//音声読み込み用構造体
struct Sounds{
};
//ゲームステート
enum GameState{
GAME_TITLE, GAME_MAIN, GAME_OVER, GAME_CLEAR
};


//キャラクター構造体
struct Character{
b2Body *body; //ボディ
bool used; //使用中フラグ
int type; //種類
int ID; //細かい種類
};
const int MAXMAPCHARA = 1024; //地形の最大数



//ゲームデータ記録用構造体
struct StageInfo{
int timerstart; //待機タイマーの開始時刻
int gamestarttime; //ゲームの開始時間
int gametime; //ゲーム開始からの経過ミリ秒
float mapsize_w, mapsize_h; //マップサイズ
int screen_x, screen_y; //表示原点(スクロール用)


Character wall[MAXMAPCHARA]; //床壁
int num_mapchara; //読み込んだ地形の数
//b2Body *wall; //床壁
b2Body *hero; //主人公
bool isheroleft; //主人公の向き
bool isontheground; //乗っている?
};
//HEROステート(アニメーション表示に使う列挙体)
enum HeroState{
//立つ、走る、ジャンプ
HERO_STANDING, HERO_RUNNING, HERO_JUMP
};

//WALL
enum WallID{
WALL_48, WALL_192, WALL_284, WALL_568, GOAL_FLAG
};




//関数プロトタイプ宣言


int LoadFiles();
void initGame();
void InitStage();
int LoadMapData(TCHAR *filepath);
void DeleteAllBody();
void MyMain();
void GoGameTitle();
void DrawGameTitle();
void GoGameMain();
void DrawGameMain();
void GoGameClear();
void DrawGameClear();
void GoGameOver();
void DrawGameOver();
b2Body* CreateDynamicBall(float x, float y, float radius);
b2Body* CreateBox(float x, float y, float w, float h,float angle, bool dynamic);
void Collision();

//ユーティリティ関数
bool IsAKeyTrigger(int key);
bool IsBKeyTrigger(int key);
bool IsCKeyTrigger(int key);
void DeleteAllBody();
int VIWX(float v);
int VIWY(float v);
float PHS(float v);
bool IsOutScreen(float x, float y);

//グローバル変数のエクスターン宣言
extern int g_lasttime;
extern float g_frametime;
extern bool g_exitflag;
extern b2World g_world;
#ifdef B2D_DEBUG_DRAW
extern DxDebugDraw g_debugdraw;
#endif
extern int g_middlefont;
extern StageInfo g_stage;


新着レスの表示


名前: E-mail(省略可)

※書き込む際の注意事項はこちら

※画像アップローダーはこちら

(画像を表示できるのは「画像リンクのサムネイル表示」がオンの掲示板に限ります)

掲示板管理者へ連絡 無料レンタル掲示板