资源描述:
《opengl 3D迷宫 C 实现 源代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、#include"stdafx.h"#include#include#include#include#includeusingnamespacestd;voiddrawwalls(void);voiddrawtop(void);voiddrawball(void);#defineIDM_APPLICATION_EXIT(101)#defineIDM_APPLICATION_TEXTURE(102)#defineIDM_APPLICATION_B
2、ANK(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'sheadingfloatplayer_s=0.0f;
3、//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;intstatus=1;boolsearchroute=false;boolk
4、eystate[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','','H','','','','','H'},{'H','','H','H','',
5、'','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'}
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','','','','','',
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'},};voidmyinit(){glClearColor(0.5f,0.5f,0.5f,0.0f);glColor3f(1.0,1.0,1.0);glEn
8、able(GL_DEPTH_TEST);glEnable(GL_TEXTURE_2D);walllist=glGenLists(2);mazelist=walllist+1;balllist=