📄 gameobj.cpp
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -