资源描述:
《opengl 3D迷宫 C 实现 源代码.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、#include"stdafx.h"#include#include#include#include#includeusingnamespacestd;voiddrawwalls(void);voiddrawtop(void);voiddrawball(void);#defineIDM_APPLICATION_EXIT(101)#defineIDM_APPLICATION_TEXTURE(102)#defineIDM_AP
2、PLICATION_BANK(103)#defineMAZE_HEIGHT(16)#defineMAZE_WIDTH(16)#defineSTARTING_POINT_X(13.5f);#defineSTARTING_POINT_Y(1.5f);#defineSTARTING_HEADING(90.0f);floatplayer_x=STARTING_POINT_X;floatplayer_y=STARTING_POINT_Y;floatplayer_h=STARTING_HEADING;//player'shead
3、ingfloatplayer_s=0.0f;//forwardspeedoftheplayerfloatplayer_m=1.0f;//speedmultiplieroftheplayerfloatplayer_t=0.0f;//player'sturning(changeinheading)floatplayer_b=0.0f;//viewpointbank(roll)staticfloattexcoordX=0.0f;intwalllist=0;intmazelist=0;intballlist=0;intsta
4、tus=1;boolsearchroute=false;boolkeystate[4]={false,false,false,false};charmazedata[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'
5、,'','H','','','','','H'},{'H','','H','H','','','H','','H','H','','H','','H','','H'},{'H','','','','','','H','','','','','','','H','','H'},最新可编辑word文档{'H','','H','H','H','H','H','H','H','H','','H','H','H','','H'},{'H','','','','','','','','','','','','H','','','
6、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',
7、'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',
8、'','H','H'},};voidmyinit(){glClearColor(0.5f,0.5f,0.5f,0.0f);glColor3f(1.0,1.0,1.0);glEnable(GL_DEPTH_TEST);glEnable(GL_TEXTURE_2D);walllist=glGenLists(2);mazelist=walllist+