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


// Ship.cpp: implementation of the CShip class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#include "stdafx.h" 
#include "MyGame.h" 
#include "Ship.h" 
#include "GameObjTimed.h" 
 
 
#ifdef _DEBUG 
#undef THIS_FILE 
static char THIS_FILE[]=__FILE__; 
#define new DEBUG_NEW 
#endif 
 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
 
CShip::CShip() 
{ 
	a=Point3f(0,0,0); 
	thrust=false; 
	lthrust=false; 
	rthrust=false; 
	ActiveBullet=0; 
} 
 
CShip::~CShip() 
{ 
 
} 
 
int CShip::Draw() 
{ 
	glPushMatrix(); 
	glDisable(GL_LIGHTING); 
	glTranslate(p); 
	glRotatef(angle,0,0,1); 
	glBegin(GL_LINE_LOOP); 
	glColor3f((GLfloat).8,(GLfloat).8,(GLfloat).8); 
	glVertex3f(-3,-2,0); 
	glVertex3f( 4,0,0); 
	glVertex3f(-3,2,0); 
	glEnd(); 
	if(thrust) 
	{ 
		glColor3f((GLfloat).8,(GLfloat).4,(GLfloat).1); 
		glBegin(GL_LINE_STRIP); 
		glVertex3f(-2,-1,0); 
		glVertex3f(-4,0,0); 
		glVertex3f(-2,1,0); 
		glEnd(); 
	} 
	glEnable(GL_LIGHTING); 
	glPopMatrix(); 
	return 3; 
}