www.pudn.com > MyGame.rar > 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  
#include  
#include  
#include  
#include  
 
#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