📄 gameobj.h
字号:
// GameObj.h: interface for the CGameObj class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_GAMEOBJ_H__8A92C113_DB4A_4228_B334_D7FF039627FC__INCLUDED_)
#define AFX_GAMEOBJ_H__8A92C113_DB4A_4228_B334_D7FF039627FC__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <math.h>
#include <vcg/Point3.h>
#include <vcg/Sphere3.h>
#include <vector>
#include <list>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
using namespace vcg;
using namespace std;
class CGameObj
{
public:
CGameObj();
CGameObj(const Point3f &_p, const float _angle);
CGameObj(const Point3f &_p, const float _angle, const Point3f &_v);
virtual ~CGameObj();
Point3f p;
Point3f axis;
float angle;
Point3f v;
float av;
bool active;
Sphere3f B;
virtual int Draw(){return 0;}
virtual void Update(int t)
{
p += (t/1000.0f*v);
angle += (t/1000.0f*av);
};
Point3f VDir()
{
return Point3f(cos(M_PI*angle/180.0),
sin(M_PI*angle/180.0),
0);
};
virtual bool Collide(CGameObj *o);
void DrawBound();
inline bool operator < ( CGameObj const & o ) const
{
return p<o.p;
}
inline bool operator == ( CGameObj const & o ) const
{
return (p==o.p && v==o.v);
}
};
#endif // !defined(AFX_GAMEOBJ_H__8A92C113_DB4A_4228_B334_D7FF039627FC__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -