资源简介
OpenGL写的推箱子,window与linux都可以用。为与之前的TC_BOX地图兼容,部分代码冗余。
代码片段和文件信息
#include
#include
#include
#include
#include
#include
#define SIZE 25
#define SIZE_X 20
#define SIZE_Y 20
#define SIZE_GROUP SIZE_X*SIZE_Y
#define SIZE_STAGE (3*SIZE_GROUP+2)
#define X_I ((int) role_x )
#define Y_I ((int) role_y )
#define HEAVY_BOX 1
#define HEAVY_WALL 100
#define HEAVY_ROLE 250
#define HEAVY_DESITINATION 210
GLuint draw_wall draw_box draw_role draw_desitination draw_line ;
int heavy_read[SIZE_X][SIZE_Y];
int heavy[SIZE_X+2][SIZE_Y+2];
unsigned char desi_role[SIZE_X+2][SIZE_Y+2] = {0};
int role_x role_y;
char wall_point[SIZE_X][SIZE_Y];
char box_point[SIZE_X][SIZE_Y];
char destination_point[SIZE_X][SIZE_Y];
char file_name[20];
int stage_total ;
int stage_current = 1;
void init (void);
void win (void);
void read_stage(int map_s);
struct Role
{
int x;
int y;
int strength;
int heavyer;
}role;
/*
* heavy of wall 100
* heavy of box 1
* heavy of destination 210
*
*/
void draw(void)
{
GLfloat point[8][3] = {{000} {0.100} {00.10} {000.1} {0.10.10} {0.100.1} {00.10.1} {0.10.10.1}};
GLint face[6][4] = {{0142}{0263}{0351}{1574}{2476}{3675}};
GLfloat color[6][3] = {{100} {010} {001} {110} {101} {011}};
GLint i j;
draw_wall = glGenLists(1);
glNewList (draw_wall GL_COMPILE);
glBegin (GL_POLYGON);
for (i=0; i<6; i++)
for (j=0; j<4; j++)
{
glColor3fv (color[j]);
glVertex3fv (point[face[i][j]]);
}
glEnd();
glEndList ();
draw_box = glGenLists(1);
glNewList (draw_box GL_COMPILE);
glBegin (GL_POLYGON);
for (i=0; i<6; i++)
{
glColor3fv (color[i]);
for (j=0; j<4; j++)
glVertex3fv (point[face[i][j]]);
}
glEnd();
glEndList ();
draw_role = glGenLists (1);
glNewList (draw_role GL_COMPILE);
glBegin (GL_POLYGON);
glColor3f (0 1 0);
glVertex3f (0.05 0.1 0.05);
glVertex3f (0.1 0 0);
glVertex3f (0 0 0);
glEnd ();
glBegin (GL_POLYGON);
glColor3f (1 0 1);
glVertex3f (0.05 0.1 0.05);
glVertex3f (0.1 0 0);
glVertex3f (0.1 0 0.1);
glEnd ();
glBegin (GL_POLYGON);
glColor3f (1 1 0);
glVertex3f (0.05 0.1 0.05);
glVertex3f (0 0 0.1);
glVertex3f (0 0 0);
glEnd ();
glBegin (GL_POLYGON);
glColor3f (0 1 1);
glVertex3f (0.05 0.1 0.05);
glVertex3f (0.1 0 0.1);
glVertex3f (0 0 0.1);
glEnd ();
glEndList ();
draw_desitination = glGenLists (1);
glNewList (draw_desitination GL_COMPILE);
glBegin (GL_LINES);
glColor3f (0 0 1);
glVertex3f (0 0 0);
glVertex3f (0.1 0.1 0);
glVertex3f (0 0.1 0);
glVertex3f (0.1 0 0);
glVertex3f (0 0 0.1);
glVertex3f (0.1 0.1 0.1);
glVertex3f (0 0.1 0.1);
glVertex3f (0.1 0 0.1);
glEnd();
glEndList ();
draw_line = glGenLists (1);
glNewList (draw_line GL_COMPILE);
glColor3f (0 0 1);
glBegin (GL_LINE_LOOP);
glVertex3f (0.1 0.1 0);
- 上一篇:飞思卡尔XS128
- 下一篇:ABB ACS800变频器资料
相关资源
- 绘制若干OpenGL基本体素三角形、三角
- OpenGL_射线选择初探
- OpenGL-- Shader 颜色 光照 5 多光源 基础
- win32简单推箱子游戏
- 通用扫描线填充算法OpenGL glut实现
- 泛滥填充种子填充算法OpenGl glut实现
- 单片机游戏-推箱子游戏
- glfw-3.2.1 OpenGL用
- OpenGL三维图形系统开发与实用技术 基
- vs配置opengl所需glut库
- OpenGl 飞机在蓝天飞行 纹理贴图 地形
- 3D世界的QT+opengl实现
- 编写推箱子游戏程序第三步——选择
- 中点画圆的算法
- opengl20面体
- opengl纹理贴图
- GLTools-Freeglut.zipopengl超级宝典V5
- VIEW3DS.exe
- freeimage库的一个小
- OpenGL动态小车
- vc OpenGL制作动态三维的雷达扫描效果
- error C1083: 无法打开包括文件: “glau
- OpenGLWindow.zip
- GLUT库下载69016
- OpenGL实现下雪的效果
- openGL兔子模型
- GLaux (OpenGL辅助库)
- qt_opengl_obj.zip
- glaux库包含glaux.h和glaux.lib
- opengl通过键盘对3d图像进行颜色,光照
评论
共有 条评论