资源简介

这是一个用opengl做的非常简单的直升飞机游戏。它可以向左右转和向前飞,直升机必须落在着陆区,否则就会爆炸!

资源截图

代码片段和文件信息

#include “StdAfx.h“
#include “Environment.h“
#include 
using namespace std;


Environment::Environment(void){}
Environment::~Environment(void){}
void Environment::Draw(void)
{
int i=42;
float x_coy_coz_co;
int angle;
x_co=0.0f;
y_co=0.0f;
z_co=0.0f;
angle =0;

x_co=-heli.getX();
y_co=-heli.getY();
z_co=-heli.getZ();
angle=heli.getAngle();
stringstream xyza;
glTranslatef(0.0f0.01f0);
glTranslatef(x_coy_coz_co);

if(x_co<= 0){x_co=-x_co;}
if(y_co<= 0){y_co=-y_co;}
if(z_co<= 0){z_co=-z_co;}
x << “X : “ << x_co;
text(x130);
y << “Y : “ << y_co;
text(y100);
z << “Z : “ << z_co;
text(z70);
a <<“Angle : “ << angle;
text(a40);
glPushMatrix();
landingArea();
ground();
sky();
glPopMatrix();
}

void Environment::ground(void)
{
float r=40;
glPushMatrix();
glTranslatef(0.0f0.0f0.45f);
glColor3f(0.427f0.886f0.0f);
glBegin(GL_QUADS);

glVertex3f(r0r);
glVertex3f(r0-r);
glVertex3f(-r0-r);
glVertex3f(-r0r);
glEnd();
glPopMatrix();
}

void Environment::sky(void)
{
float width=40.0f;
float height=40.0f;
glPushMatrix();
glColor3f(0.0f0.5176f1.0f);
glBegin(GL_QUADS);

glVertex3f(-widthheightheight);
glVertex3f(-width-heightheight);
glVertex3f(-width-height-height);
glVertex3f(-widthheight-height);

glVertex3f(widthheightheight);
glVertex3f(width-heightheight);
glVertex3f(width-height-height);
glVertex3f(widthheight-height);

glVertex3f(widthheightheight);
glVertex3f(width-heightheight);
glVertex3f(-width-heightheight);
glVertex3f(-widthheightheight);

glVertex3f(widthheight-height);
glVertex3f(width-height-height);
glVertex3f(-width-height-height);
glVertex3f(-widthheight-height);

glVertex3f(widthheightheight);
glVertex3f(widthheight-height);
glVertex3f(-widthheight-height);
glVertex3f(-widthheightheight);

glVertex3f(width-heightheight);
glVertex3f(width-height-height);
glVertex3f(-width-height-height);
glVertex3f(-width-heightheight);
glEnd();
glPopMatrix();
}
void Environment::landingArea(void)
{
float r=3;
glPushMatrix();
glColor3f(1.0f1.0f0.0f);

glTranslatef(0.0f0.025f0.45f);

glBegin(GL_QUADS);

glVertex3f(r0r);
glVertex3f(r0-r);
glVertex3f(-r0-r);
glVertex3f(-r0r);
glEnd();
glRotated(90010);
glPushMatrix();
glColor3f(1.0f1.0f1.0f);
glTranslatef(1.0f0.0f0.0f);
glBegin(GL_QUADS);
glVertex3f(0.2502);
glVertex3f(0.250-2);
glVertex3f(-0.250-2);
glVertex3f(-0.2502);
glEnd();
glPopMatrix();

glPushMatrix();
glColor3f(1.0f1.0f1.0f);
glTranslatef(-1.0f0.0f0.0f);
glBegin(GL_QUADS);
glVertex3f(0.2502);
glVertex3f(0.250-2);
glVertex3f(-0.250-2);
glVertex3f(-0.2502);
glEnd();
glPopMatrix();

glBegin(GL_QUADS);
glVertex3f(1.0f0.0f0.25f);
glVertex3f(1.0f0-0.25f);
glVertex3f(-1.0f0-0.25f);
glV

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    8088576  2010-01-13 14:13  Project\3DOpenGLStarter.ncb

    .......       895  2009-11-10 14:50  Project\3DOpenGLStarter.sln

    .......       886  2007-06-07 13:43  Project\3DOpenGLStarter.sln.old

    ..A..H.    118272  2010-01-13 14:12  Project\3DOpenGLStarter.suo

    .....H.    107520  2008-11-12 15:17  Project\3DOpenGLStarter.suo.old

    .......    142848  2010-01-12 15:03  Project\debug\3DOpenGLStarter.exe

    .......    762780  2010-01-12 15:03  Project\debug\3DOpenGLStarter.ilk

    .......   1182720  2010-01-12 15:03  Project\debug\3DOpenGLStarter.pdb

    .......      2373  2009-11-10 14:50  Project\UpgradeLog.xml

    .......       663  2010-01-05 10:54  Project\win32_1\Debug\3DOpenGLStarter.exe.embed.manifest

    .......       728  2010-01-05 10:54  Project\win32_1\Debug\3DOpenGLStarter.exe.embed.manifest.res

    .......       621  2010-01-12 15:03  Project\win32_1\Debug\3DOpenGLStarter.exe.intermediate.manifest

    .......  13107200  2010-01-05 16:16  Project\win32_1\Debug\3DOpenGLStarter.pch

    .......      7556  2010-01-12 15:03  Project\win32_1\Debug\BuildLog.htm

    .......     44874  2010-01-12 15:03  Project\win32_1\Debug\Environment.obj

    .......     13921  2010-01-12 14:57  Project\win32_1\Debug\Game.obj

    .......     86715  2010-01-12 14:51  Project\win32_1\Debug\Helicopter.obj

    .......      2048  2010-01-05 16:15  Project\win32_1\Debug\HelicopterProject.exe.embed.manifest

    .......    566102  2010-01-05 16:15  Project\win32_1\Debug\HelicopterProject.pch

    .......     20198  2010-01-12 14:57  Project\win32_1\Debug\main.obj

    .......        69  2010-01-12 15:03  Project\win32_1\Debug\mt.dep

    .......     15806  2010-01-12 14:57  Project\win32_1\Debug\opengl.obj

    .......       400  2010-01-05 16:14  Project\win32_1\Debug\RSP00040833241004.rsp

    .......    131381  2010-01-05 16:16  Project\win32_1\Debug\stdafx.obj

    .......     12144  2010-01-05 16:17  Project\win32_1\Debug\Texture.obj

    .......      7156  2010-01-05 16:17  Project\win32_1\Debug\Timer.obj

    .......    461824  2010-01-12 15:03  Project\win32_1\Debug\vc90.idb

    .......    569344  2010-01-12 15:03  Project\win32_1\Debug\vc90.pdb

    .......      6045  2010-01-05 16:17  Project\win32_1\Debug\Vector.obj

    .......     48216  2010-01-05 10:54  Project\win32_1\Debug\win32_1.res

............此处省略43个文件信息

评论

共有 条评论