📄 bulletfireball.cpp
字号:
// BulletFireBall.cpp: implementation of the CBulletFireBall class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MyGame.h"
#include "BulletFireBall.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CBulletFireBall::CBulletFireBall()
{
ttl=3000;
}
CBulletFireBall::~CBulletFireBall()
{
}
int CBulletFireBall::Draw()
{
if(ttl>1000)
return CBullet::Draw();
else
{
glDisable(GL_LIGHTING);
glPushMatrix();
glTranslate(p);
float size=(1000-ttl)/50.0;
glScalef(size,size,size);
const int nbul=24;
glBegin(GL_LINES);
for(int i=0;i<=nbul;i++)
{
glColor3f((GLfloat)1., (GLfloat)1., (GLfloat).4);
glVertex3f(1.2*cos(float(i)*M_PI*2.0/nbul),1.1*sin(float(i)*M_PI*2.0/nbul),0.0);
glColor3f(0, 0, 0);
glVertex3f(cos(float(i)*M_PI*2.0/nbul),sin(float(i)*M_PI*2.0/nbul),0.0);
}
glEnd();
glEnable(GL_LIGHTING);
glPopMatrix();
return nbul;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -