gameobj.cpp
来自「基于引擎基础上开发的三维游戏实例“恐怖之战”游戏者可以自爱三维地形上漫游」· C++ 代码 · 共 72 行
CPP
72 行
// GameObj.cpp: implementation of the CGameObj class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MyGame.h"
#include "GameObj.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CGameObj::CGameObj()
{
p=Point3f(0,0,0);
v=Point3f(0,0,0);
angle=0;
av=0;
axis=Point3f(0,0,1);
active=true;
B.r=1;
}
CGameObj::CGameObj(const Point3f &_p, const float _angle)
{
B.r=1;
p=_p;
v=Point3f(0,0,0);
angle=_angle;
av=0;
axis=Point3f(0,0,1);
active=true;
}
CGameObj::CGameObj(const Point3f &_p, const float _angle, const Point3f &_v)
{
B.r=1;
p=_p;
v=_v;
angle=_angle;
av=0;
axis=Point3f(0,0,1);
active=true;
}
CGameObj::~CGameObj()
{
}
bool CGameObj::Collide(CGameObj *o)
{
B.c=p;
o->B.c=o->p;
return B.Intersect(o->B);
}
void CGameObj::DrawBound()
{
glPushMatrix();
glTranslate(p);
glutWireSphere(B.r,8,5);
glPopMatrix();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?