资源简介
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参考手册
- Qt Creator opengl实现四元数鼠标控制轨迹
- 推箱子及人工智能寻路C 源代码
- OpenGL文档,api大全,可直接查询函数
- opengl轮廓字体源代码
- MFC读三维模型obj文件
- 利用OpenGL写毛笔字算法
- MFC中OpenGL面和体的绘制以及动画效果
- 基于OPENGL的光线跟踪源代码368758
- VC 实现三维旋转(源码)
- 自编用openGL实现3D分形树,分形山
- OpenGL球形贴图自旋程序
- OpenGL导入贴图的Texture类
- 计算机图形学(openGL)代码
- 用OpenGL开发的机械臂运动仿真程序(
- OpenGL-3D坦克模拟
- OPENGL实现世界上最小的3D游戏
- scratch 推箱子.sb2
- VS2012OpenGL配置所需要的全部libdllh文件
- 基于OpenGL的仿蝗虫机器人三维动态仿
- 图形学 - OpenGL实现3种三维茶壶显示源
- opengl程序-会跳舞的骷髅
- opengl实现三维网格光顺Laplacian算法
- opengl——爆炸
- OpenGL三维地形建模
- opengl游戏编程徐明亮版(含源码)
- 用OPENGL画的一个简单的直升飞机
- opengl完美天空盒
- 3D绘图程序设计:使用Direct3D 10/9和Ope
- OpenGL绘制可运动自行车源程序.zip
评论
共有 条评论