opengl3d迷宫c实现源代码

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

#include ""

#include <>

#include <>

#include

#include <>

#include

using namespace std;

void drawwalls(void);

void drawtop(void);

void drawball(void);

#define IDM_APPLICATION_EXIT (101) #define IDM_APPLICATION_TEXTURE (102) #define IDM_APPLICATION_BANK (103) #define MAZE_HEIGHT (16)

#define MAZE_WIDTH (16)

#define STARTING_POINT_X ;

#define STARTING_POINT_Y ;

#define STARTING_HEADING ;

float player_x = STARTING_POINT_X ;

float player_y = STARTING_POINT_Y ;

float player_h = STARTING_HEADING ; // player's heading float player_s = ; // forward speed of the player

float player_m = ; // speed multiplier of the player

float player_t = ; // player's turning (change in heading) float player_b = ; // viewpoint bank (roll)

static float texcoordX=;

int walllist=0;

int mazelist=0;

int balllist=0;

int status=1;

bool searchroute=false;

bool keystate[4]={false,false,false,false};

char mazedata[MAZE_HEIGHT][MAZE_WIDTH] = {

{'H','H','H','H','H','H','H','H','H','H','H','H','H','H', 'H','H'},

{'H',' ',' ',' ',' ',' ',' ',' ','H',' ',' ',' ',' ',' ',' ','H'},

{'H',' ','H',' ','H','H','H',' ','H',' ','H',' ',' ',' ',' ','H'},

{'H',' ','H','H',' ',' ','H',' ','H','H',' ','H',' ','H',' ','H'},

{'H',' ',' ',' ',' ',' ','H',' ',' ',' ',' ',' ',' ','H',' ','H'},

{'H',' ','H','H','H','H','H','H','H','H',' ','H','H','H',' ','H'},

{'H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','H',' ',' ','H'},

{'H',' ','H','H','H','H','H',' ','H','H','H',' ','H','H','H','H'},

{'H',' ','H',' ',' ',' ','H',' ',' ',' ','H',' ',' ',' ',' ','H'},

{'H',' ',' ',' ','H','H','H','H','H','H','H',' ',' ',' ',' ','H'},

{'H',' ','H',' ',' ',' ','H',' ',' ',' ','H',' ',' ','H',' ','H'},

{'H',' ','H','H','H','H','H',' ','H','H','H','H',' ','H',' ','H'},

{'H',' ',' ',' ',' ',' ','H',' ',' ',' ',' ',' ',' ','H',' ','H'},

{'H',' ',' ','H','H',' ','H','H','H','H',' ','H','H','H',' ','H'},

{'H',' ',' ',' ','H',' ','H',' ',' ',' ',' ','H',' ',' ',' ','H'},

{'H','H','H','H','H','H','H','H','H','H','H','H','H',' ','H','H'},

};

void myinit()

{

glClearColor, , , ;

glColor3f,,;

glEnable(GL_DEPTH_TEST);

glEnable(GL_TEXTURE_2D);

walllist=glGenLists(2);

mazelist=walllist+1;

balllist=walllist+2;

glNewList(walllist,GL_COMPILE);

drawwalls();

glEndList();

glNewList(mazelist,GL_COMPILE);

相关文档
最新文档