Ejemplo n.º 1
0
void CGame::PlayTurn() {

	int x,y;

	scare_mouse();
	DrawBoard();
	DrawPlayer();
	DrawScores();
	DrawCursor();

	blit(background, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
	unscare_mouse();

	while (!players[currplayer].Done()) {

		if (mouse_b & 1) {

			x = mouse_x;
			y = mouse_y;
			players[currplayer].HandleMouse(x,y);
			rest (200); //rest for a bit so it doesnt keep catching mouse clicks
			
			scare_mouse();
			DrawBoard();
			DrawScores(); //shouldnt have to redraw this, but i dont have time to do a decent redraw management system
			if (!players[currplayer].Done())
				DrawPlayer(); //only redraw if not at end of turn
			DrawCursor();
	
			blit(background, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
			unscare_mouse();
		}

		
	}//end while

	players[currplayer].ResetTurnComplete();
		

	//update currplayer

	int oldcurrplayer;
	oldcurrplayer = currplayer;

	do {
		if (currplayer == (numplayers-1)) {  //if currplayer is last in line
			currplayer = 0;
		}
		else {
			currplayer++;
		}

	//stop increment currplayer if the curr isnt playing AND we have gone through the whole list already
	} while (!players[currplayer].stillplaying && currplayer != oldcurrplayer);


}
Ejemplo n.º 2
0
void Render() 
{ 
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();

	SetCamera();
	DrawBall(GL_FALSE);		
	DrawLifes();
	DrawScores();
	DrawCubes();
	DrawRoom();

	projection.Init(ROOM_HALF_LENGTH - 0.01, X, Y, -ROOM_LENGTH*10);
	glPushMatrix();
		glMultMatrixf((GLfloat*)projection.shadowMat);
		DrawBall(GL_TRUE);
	glPopMatrix();

	DrawReflector();
	RoomCollision();
	CubesCollision();

	glClearColor(0.3, 0.3, 0.3, 0);
    glutSwapBuffers();
}