the program exit-thingy
int GameShutdown(){ if(lpDDSBackBuffer) lpDDSBackBuffer->Release(); if(lpDDSPrimary) lpDDSPrimary->Release(); if(lpDD) lpDD->Release(); delete Triangle; return 1;}
CPolygon constructor & destructor:
CPolygon::CPolygon(int NumOfVerts, int StartPosx, int StartPosy,int StartVelx, int StartVely, int InitState, DWORD InitColor,VERTEX2D *vList, RECT ClipTo){ NumVerts = NumOfVerts; xPos = StartPosx; yPos = StartPosy; xVel = StartVelx; yVel = StartVely; State = InitState; Color = InitColor; //init the ClipRect ClipRect.bottom = ClipTo.bottom; ClipRect.top = ClipTo.top; ClipRect.left = ClipTo.left; ClipRect.right = ClipTo.right; //init the verts. Verts = new VERTEX2D[NumVerts]; int Counter = 0; for(Counter = 0; Counter <= NumVerts; Counter++) { Verts[Counter].x = vList[Counter].x; Verts[Counter].y = vList[Counter].y; } //thats good...now... //...we're done!}CPolygon::~CPolygon(void){ delete [] Verts;}
init of Triangle in my program:
CPolygon *Triangle;...VERTEX2D VertList[3]; VertList[0].x = 0; VertList[0].y = 0; VertList[1].x = 5; VertList[1].y = 0; VertList[2].x = 0; VertList[2].y = 5; RECT CRect; CRect.bottom = SCREEN_HEIGHT; CRect.left = 0; CRect.right = SCREEN_WIDTH; CRect.top = 0; Triangle = new CPolygon(3,400,300,0,0,NULL, _RGB32BIT(0,255,255,255),VertList,CRect); return 1;
thanks for your help!
[edited by - MattS423 on January 9, 2003 10:11:30 PM][edited by - MattS423 on January 9, 2003 10:12:37 PM]