www.pudn.com > MyGame.rar > Exp.cpp


// Exp.cpp: implementation of the CExp class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#include "stdafx.h" 
#include "MyGame.h" 
#include "Exp.h" 
 
#ifdef _DEBUG 
#undef THIS_FILE 
static char THIS_FILE[]=__FILE__; 
#define new DEBUG_NEW 
#endif 
 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
 
CExp::CExp() 
{ 
	ttl=1000; 
} 
 
CExp::~CExp() 
{ 
 
} 
 
CExp* CExp::LightOwner[3]; 
	 
int CExp::Draw() 
{ 
	const int nside=18; 
	glPushMatrix(); 
	glDisable(GL_LIGHTING); 
	glTranslate(p); 
	float size=(1000-ttl)/50.0; 
	glScalef(size,size,size); 
	glEnable(GL_BLEND); 
	glDisable(GL_DEPTH_TEST); 
	glBegin(GL_TRIANGLE_FAN); 
	glColor4f((GLfloat).5, (GLfloat).1, (GLfloat).1,0); 
	glVertex3f(0,0,0); 
	glColor4f((GLfloat).9,(GLfloat).9,(GLfloat).3,ttl/500.0f+.1f); 
	for(int i=0;i<=nside;i++) 
		glVertex3f(cos(float(i)*M_PI*2.0/nside),sin(float(i)*M_PI*2.0/nside),0.0); 
	glEnd(); 
	glDisable(GL_BLEND); 
	glEnable(GL_DEPTH_TEST); 
	glEnable(GL_LIGHTING); 
	glPopMatrix(); 
	return nside; 
}