- 1、本文档共19页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
共分为4个.h文件和5个.cpp文件
keyListener.h,keyListener.cpp
map.h,map.cpp
texture.h,texture.cpp
textview.h,textview.cpp
Main.cpp
Main.cpp
#include GL/glut.h
#include GL/glu.h
#include GL/gl.h
#include string.h
#include stdio.h
#include map.h
#include Texture.h
#include keyListener.h
#include textview.h
#pragma comment(linker,/subsystem:\Windows\ /entry:\mainCRTStartup\)
Texture texture; // 文理加载类
Map map; // 地图加载类
KeyListener keylistener; //键盘监听事件类
TextView textview;
int* image;
int **mp;
int window; //窗口
int is_pass = 0; // 是否过关标志
int *pass = is_pass;
int level = 1; // 关卡
int *lv = level;
int pre_lv = 1;
//颜色的RGB值
int black[3] = {0 , 0 , 0};
int white[3] = {255 , 255 , 255};
int orange[3] = {255, 128, 0};
//窗口大小变化时调用的函数
void ChangeSize(GLsizei w, GLsizei h)
{
if(h == 0) {
h = 1;
}
glViewport(0, 0, w, h); //定义视口大小,宽高一致
int width = 550;
int height = 550;
glMatrixMode(GL_PROJECTION); //重置坐标系统,使投影变换复位
glLoadIdentity(); //将当前的用户坐标系的原点移到了屏幕中心
GLfloat aspect;
if(w = h)
{
aspect = (GLfloat) h / w;
glOrtho(0, width, 0, height * aspect, 0, height);
}
else if(w h)
{
aspect = (GLfloat) w / h;
glOrtho(0, width * aspect, 0, height, 0, width);
}
}
void display_text()
{
glColor3ub(orange[0],orange[1],orange[2]);
glRasterPos2i(250, 570); //起始位置
textview.drawString(推箱子); //输出的字符串
glRasterPos2i(400, 570);
char c[10] = 第;
char d[5] ;
sprintf(d, %d关, level);
strcat(c, d);
textview.drawString(c);
glRasterPos2i(120, 80);
textview.drawString(1、ESC键退出游戏);
glRasterPos2i(120, 60);
textview.drawString(2、BackSpace后退);
glRasterPos2i(120, 40);
textview.drawString(3、PageUp、PageDown切换关卡);
glRasterPos2i(120, 20);
textview.drawString(4、键盘上、下、左、右键控制方向);
}
//画长方形
void draw_rect(int leftX, int leftY)
{
glBegin(GL_POLYGON);
glColor3ub(black[0],black[1],black[2]);
glVertex2d(leftX,leftY);
您可能关注的文档
- OA应用的一些实例讲述.pptx
- OA系统建设要求讲述.doc
- OA表单填写规范注意事项培训讲述.pptx
- NV8新生儿小儿双水平正压通气治疗机-1讲述.pptx
- NT6000V3A操作手册讲述.doc
- Office2007办公自动化讲述.pptx
- Office2010练习题(答案)讲述.docx
- office2007及日常应用培训讲述.pptx
- Novatec清洗工艺及其设备操作指导讲述.doc
- office2013内存或磁盘空间不足解决讲述.pptx
- 外研版选择性必修第三册 Unit 3 War and peace Starting Out & Understanding Ideas课件(共37张PPT).pptx
- 第14课 第一次世界大战与战后国际秩序 授课课件(共31张PPT).pptx
- 第18课 科技文化成就 课件(共19张PPT).pptx
- 人教版(2025) 必修第三册 Unit 2 Morals and Virtues Listening and Speaking课件(共22张).pptx
- 第20课 狼 课件(共35张PPT).pptx
- 外研版选择性必修 第三册Unit 2 A life’s work Starting out课件(共17张PPT).pptx
- 北师大版(2025) 必修第三册 Unit 8 Green Living Lesson 1 Roots and Shoots Lesson1课件(共23张PPT).pptx
- 北师大版(2025)必修第一册Unit 1 Life Choices Topic Talk 课件(共14张).pptx
- 人教版(2025) 必修第一册 Unit 1 Teenage Life Reading and Thinking 课件(共14张PPT).pptx
- 人教版(2025) 必修第一册 Unit 2 Travelling Around Listening and Talking课件(共16张PPT).pptx
最近下载
- 大数据数据分析项目实践报告.doc
- Unit 6 Electricity everywhere 第4课时 Writing 教学设计 沪教版英语七年级下册.docx
- 防爆电气设备安装与检验考核试卷.docx
- 情态动词-专题课件(共28张课件).ppt VIP
- 《GB 50318-2017城市排水工程规划规范 》最新解读.pptx
- 河南水投集团所属公司招聘笔试真题2024 .pdf
- Unit 2 Travelling Around 大单元整体教学设计-高中英语人教版必修第一册.docx
- 义务教育生物学课程标准(2022年版).docx
- 新人教版一年级数学下册应用题练习带答案(全套).pdf
- 汉字与服饰文化(文字学).ppt VIP
文档评论(0)