示例#1
0
文件: snake.c 项目: cbasix/fhk-work
void draw() {
    drawField();
    drawWalls();
    drawFruits();
    drawInhabitants();
    refreshNcurses();
}
示例#2
0
void display (void) {
	glClearDepth (1);
    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();  
	gluLookAt(120.0, 20.0, 140.0,		
              0.0, 0.0, 0.0,		
              0.0, 5.0, 0.0);		
	float pos[]={10.0,90.0,-110.0,1.0};        //set the position
	glLightfv(GL_LIGHT0,GL_POSITION,pos);
	glEnable(GL_COLOR_MATERIAL);
	
	camera();
	glPushMatrix();
	
	glTranslatef(0, -30, 0);
	//glScalef(10,10,10);
	//glCallList(cube);
	glPopMatrix();
	drawGrid();
	//createHabitat();
	drawWalls();
	drawHabitat();
	drawFood();
	drawObject();
	drawPredator();

	//saveToDisk();
    glutSwapBuffers();
}
示例#3
0
文件: TileGraphic.cpp 项目: Joe4/mms
void TileGraphic::draw(){

    int tileX = m_tile->getX();
    int tileY = m_tile->getY();

    int tileLength = UNITS_PER_TILE * PIXELS_PER_UNIT;

    // Lower left corner
    float c1X = tileLength * tileX;
    float c1Y = tileLength * tileY;
    
    // Upper right corner
    float c2X = tileLength * (tileX+1);
    float c2Y = tileLength * (tileY+1);

    // Update the color to reflect the number of passes
    if (m_tile->getPasses() > 0){
        GLfloat intensity = (float)(.1*m_tile->getPasses());
        GLfloat COLOR[3] = {0, intensity, intensity};
        m_color = COLOR;
    }

    drawRect(c1X, c1Y, c2X, c2Y, m_color);
    drawCorners(c1X, c1Y, c2X, c2Y);
    drawWalls(c1X, c1Y, c2X, c2Y);
}
示例#4
0
文件: Game.cpp 项目: SimonLarsen/pac
/*
 * Translates screen to player position
 * and draws all 3D objects in world, including billboard sprites.
 */
void Game::draw(){
	glLoadIdentity();
	// Rotate view
	glRotatef(pl.ydirdeg,1,0,0);
	glRotatef(pl.xdirdeg,0,1,0);

	// Translate according to player coords,
	// draw shadow in between translating y axis
	glTranslatef(0,-pl.y,0);
	glCallList(shadow);
	glTranslatef(-pl.x,0,-pl.z);

	// Draw walls/tiles
	drawWalls();

	// Draw dots
	for(int i = 0; i < dots.size(); ++i) {
		dots.at(i).draw(pl.xdirdeg);
	}
	// Draw ghosts
	for(git = ghosts.begin(); git < ghosts.end(); ++git){
		git->draw(pl.xdirdeg);
	}

	// Draw particles
	for(pit = particles.begin(); pit < particles.end(); ++pit) {
		pit->draw(pl.xdirdeg);
	}
}
示例#5
0
文件: maze.c 项目: AndrewWUw/cs9021
void drawMaze() {

    printf("\\documentclass[10pt]{article}\n");
    printf("\\usepackage{tikz}\n");
    printf("\\usetikzlibrary{shapes.misc}\n");
    printf("\\usepackage[margin=0cm]{geometry}\n");
    printf("\\pagestyle{empty}\n");
    printf("\\tikzstyle{every node}=[cross out, draw, red]\n");
    printf("\n");
    printf("\\begin{document}\n");
    printf("\n");
    printf("\\vspace*{\\fill}\n");
    printf("\\begin{center}\n");
    printf("\\begin{tikzpicture}[x=0.5cm, y=-0.5cm, ultra thick, blue]\n");
    printf("% Walls\n");
    drawWalls();

    printf("% Pillars\n");
    drawPillars();

    printf("% Inner points in accessible cul-de-sacs\n");
    drawInnerPoints();

    printf("% Entry-exit paths without intersections\n");

    printf("\\end{tikzpicture}\n");
    printf("\\end{center}\n");
    printf("\\vspace*{\\fill}\n");
    printf("\n");
    printf("\\end{document}\n");
}
示例#6
0
        void drawMap(){

            drawGround();

            drawWalls();
            drawGlass();

        }
示例#7
0
void labyrinth::render(){
    //TODO Draw boxes around
    globalLight.apply();
    drawWalls();
    if(lost) glTranslatef(0.01*((rand()%10)-5), 0.01*((rand()%10)-5), 0.01*((rand()%10)-5));
    currentSnake.render();

}
void drawWorld(int player) {
	int i;

	nebu_Video_CheckErrors("before world");

	setupLights(eWorld);

	if (gSettingsCache.show_recognizer &&
		game->player[player].data->speed != SPEED_GONE) {
		drawRecognizer();
	}

	if (gSettingsCache.show_wall == 1) {
		glColor3f(1,1,1);
		drawWalls();
	}

	setupLights(eCycles);

	drawPlayers(player);

	setupLights(eWorld);

	{
		TrailMesh mesh;
		mesh.pVertices = (vec3*) malloc(1000 * sizeof(vec3));
		mesh.pNormals = (vec3*) malloc(1000 * sizeof(vec3));
		mesh.pColors = (unsigned char*) malloc(1000 * 4 * sizeof(float));
		mesh.pTexCoords = (vec2*) malloc(1000 * sizeof(vec2));
		mesh.pIndices = (unsigned short*) malloc(1000 * 2);

		for(i = 0; i < game->players; i++) {
			if (game->player[i].data->trail_height > 0 ) {
				int vOffset = 0;
				int iOffset = 0;
				mesh.iUsed = 0;
				trailGeometry(game->player + i, gPlayerVisuals + i,
					&mesh, &vOffset, &iOffset);
				bowGeometry(game->player + i, gPlayerVisuals + i,
					&mesh, &vOffset, &iOffset);
				trailStatesNormal(game->player + i, gScreen->textures[TEX_DECAL]);
				trailRender(&mesh);
				trailStatesRestore();
			}
		}
		free(mesh.pVertices);
		free(mesh.pNormals);
		free(mesh.pColors);
		free(mesh.pTexCoords);
		free(mesh.pIndices);
	}

	for(i = 0; i < game->players; i++)
		if (game->player[i].data->trail_height > 0 )
			drawTrailLines(game->player + i, gPlayerVisuals + i);

	nebu_Video_CheckErrors("after world");
}
示例#9
0
文件: rcv.cpp 项目: romalik/rl3d
void newRenderAt(cv::Mat & render, EdgeMap & map, cv::Mat & bgImage, float fov, int nBeams, Texpack & texpack, std::vector<Sprite> & sprites, float x, float y, float angle) {
    render = cv::Scalar(255,255,255);

    cv::Mat zBuffer = cv::Mat(render.rows, render.cols, CV_32FC1, cv::Scalar(10000));

	drawBgSolid(render);
	//drawBgImage(render, bgImage, angle, fov, nBeams);
    //drawSprites(render, zBuffer, sprites, fov, nBeams, texpack, x, y, angle);
    drawWalls(render, zBuffer, map, fov, nBeams, texpack, x, y, angle);
}
示例#10
0
文件: anim.cpp 项目: llevar/uoft
void display(void) {
  
  glLoadIdentity();
  glClearColor(0.0f,0.0f,0.0f,1.0f);   //set the background colour 
  // OK, now clear the screen with the background colour 
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
  
	
	/* Place the camera in various positions in the secene */
	
	if(curTime >= 0 && curTime <= 3){ 
		gluLookAt(-12,5,30,0,5,0,0,1,0);
	}
	else if(curTime > 3 && curTime <= 6){
		gluLookAt(-12,5, 10, 0, 7, 0, 0, 1, 0);
	}
	else if(curTime > 6 && curTime <= 10.75){
		gluLookAt(0, 5, 30, 0, 5, 0, 0, 1, 0);
	}
	else if(curTime > 10.75 && curTime <= 11.5){
		gluLookAt(-12, 7, -8, 0, 4, -2, 0, 1, 0);
	
	}
	else if(curTime > 11.5 && curTime <= 12){
	
		gluLookAt(11, 25, -30, -2,5, 0, 0, 1, 0);
	}
	else {
		gluLookAt(-12,5, 10, 0, 7, 0, 0, 1, 0);
	}	
	
	drawWalls();
	drawColumnSet();
	drawStairs();
	drawCube();
	drawSphere();
	drawPlatform();
	drawPyramid();
 	
	glPushMatrix();
	drawMan();
 	glPopMatrix();
	
	
	drawHammer();
	glFlush();

  glutSwapBuffers();

  if (recording) {
    int frame = (int)(curTime / tStep + 0.5);
    save_image(frame);
  }      
}
void GlobalScene::draw()
{

    drawSkybox();
    drawGround();
    drawWalls();
    drawPillarsAndTorches();
    glRotatef(90, 1, 0, 0);
    glTranslatef(15, 5, -15);
    dragon->draw();

}
示例#12
0
void display(){
	clearDisplay();
	setupCamera();
	displayLighting();
	//code here
	drawWalls();
	drawRoof();
	drawBase();
	drawDomes();
	drawFloors();
	glPushMatrix();
	{
		glTranslatef(0,4500,0);
		drawSmallBuilding();
		glTranslatef(0,-8200,0);
		glRotatef(180,0,0,1);
		drawSmallBuilding();
	}glPopMatrix();
	drawMainBuildingBigPillers();
	//drawGrid(GRID_SIZE,CAMERA_DISTANCE,canDrawGrid);
	glutSwapBuffers();
}
示例#13
0
void	Display::play()
{
  Map	*map	= _game->getMap();
  Snake	*snake	= _game->getSnake();

  Shader	colorShader("Shaders/couleur2D.vert", "Shaders/couleur2D.frag");

  colorShader.load();
  
  glClear(GL_COLOR_BUFFER_BIT);
  
  glUseProgram(colorShader.getProgramID());

  drawBackground();
  drawWalls();
  drawFruit(*map);
  
  drawSnake(*snake);

  glUseProgram(0);
  
  SDL_GL_SwapWindow(_window);
}
示例#14
0
文件: main.c 项目: obrown/Raycaster
int main(int argc, char* args[])
{
    initDisplay();
    
    struct Player player = {128, 128, (PI / 180) * 60};
    struct Input input = {false, false, false, false, false};
    

    while (!input.exit) {
        pollInput(&input);

        if (input.forward) {
            player.x += cos(player.a) * MOVE_SPEED;
            player.y -= sin(player.a) * MOVE_SPEED; 
        }
        if (input.left) {
            player.a -= TURN_SPEED;
            wrap(&player.a);
        }
        if (input.back) {
            player.x -= cos(player.a) * MOVE_SPEED;
            player.y += sin(player.a) * MOVE_SPEED; 
        }
        if (input.right) {
            player.a += TURN_SPEED;
            wrap(&player.a);
        }

        clearDisplay(); 
        drawWalls(&player);
        flipDisplay();
    }

    closeDisplay(); 

    return 0;
}
示例#15
0
文件: main.cpp 项目: chunkyan/DirectX
void 
display(void)
{
	glClearColor(1,1,1,1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );

	convertToView();

	glMatrixMode(GL_MODELVIEW);
    glLoadMatrixf( modelViewMatrix );
	glColor4f(1,1,1,1);
	drawFloor(textures[FLOORID]);
	drawWalls(textures[WALLID]);


	//draw the items on the screen
    glRotatef(angle,0,1,0); //rotate the square

	//draw the snowman
	snowman.display();
	snowman2.display();
	snowman3.display();

	//draw the car

	vehicle.display(translateToThirdPerson,
					textures[SIRENID],
					textures[VEHICLEID],
					firstPersonView,
					overheadView);


	

//scoreboard
	sb.setMsg2(msgDamage);

	//draw the Snowdift
	snowcave.display(textures[FLOORID]);
	snowcave2.display(textures[FLOORID]);

	//pond display
	pond.display(textures[PONDID],textures[WATERID]);

	//gifts
	//for (int i=0; i<giftCount;i++)
	//	gifts[i].display();
	glPushMatrix();
	for (int i=0; i<giftCount;i++)
		gifts[i].display();
	glPopMatrix();

	// Tractor Beam Function
	pullInObject();

	glPopMatrix();


	//ScoreBoard()
	glPushMatrix();
	glLoadIdentity();
	if(!overheadView)
		glTranslatef(sbOrigin.x,sbOrigin.y,sbOrigin.z);
	else
		glTranslatef(0,0,-40);

	sb.display(overheadView);
	glPopMatrix();

	drawCieling();


	npc.display(textures[FLOORID]);

	//draw the snowballs in flight
	displayProjectiles();

	glFlush();
    glutSwapBuffers();
}
示例#16
0
/*
    Redraws window contents
 */
void glutWidget::render()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);     //clears color and depth bits of framebuffer
    
    //Convenience variables
    float t = (float) ((int) (((float) clock()) * 50.0 / CLOCKS_PER_SEC) % 30) / 30.0;
    int t2 = ((int) (((float) clock()) * 50.0 / CLOCKS_PER_SEC) % 240) / 30;
    float t3 = (float) clock() * 5.0 / CLOCKS_PER_SEC;
    
    //These are the control points for the bezier curves
    GLfloat curves[8][4][3] =
    {
        {
            {-8, 0, -8.5},
            {-7, 0, -8.5},
            {-5, 0, -8.5},
            {-4, 0, -8.5}
        },
        {
            {-4, 0, -8.5},
            {-3.5, 0, -8.5},
            {-3.5, 0, -8.5},
            {-3.5, 0, -8}
        },
        {
            {-3.5, 0, -8},
            {-3.5, 0, -7},
            {-3.5, 0, -5},
            {-3.5, 0, -4}
        },
        {
            {-3.5, 0, -4},
            {-3.5, 0, -3.5},
            {-3.5, 0, -3.5},
            {-4, 0, -3.5}
        },
        {
            {-4, 0, -3.5},
            {-5, 0, -3.5},
            {-7, 0, -3.5},
            {-8, 0, -3.5}
        },
        {
            {-8, 0, -3.5},
            {-8.5, 0, -3.5},
            {-8.5, 0, -3.5},
            {-8.5, 0, -4}
        },
        {
            {-8.5, 0, -4},
            {-8.5, 0, -5},
            {-8.5, 0, -7},
            {-8.5, 0, -8}
        },
        {
            {-8.5, 0, -8},
            {-8.5, 0, -8.5},
            {-8.5, 0, -8.5},
            {-8, 0, -8.5}
        }
    };
    
    
    //Manually evaluate the bezier curves
    float s = 1 - t;
    float AB[2] = {curves[t2][0][0]*s + curves[t2][1][0]*t, curves[t2][0][2]*s + curves[t2][1][2]*t};
    float BC[2] = {curves[t2][1][0]*s + curves[t2][2][0]*t, curves[t2][1][2]*s + curves[t2][2][2]*t};
    float CD[2] = {curves[t2][2][0]*s + curves[t2][3][0]*t, curves[t2][2][2]*s + curves[t2][3][2]*t};
    float ABC[2] = {AB[0]*s + BC[0]*t, AB[1]*s + BC[1]*t};
    float BCD[2] = {BC[0]*s + CD[0]*t, BC[1]*s + CD[1]*t};
    float pos[2] = {ABC[0]*s + BCD[0]*t, ABC[1]*s + BCD[1]*t};
    float slope = (ABC[1] - BCD[1]) / (ABC[0] - BCD[0]);
    float theta = atan(slope);
    
    //Rotation/translation matrix
    float matrix[4][4] = 
    {
        {cos(theta), 0, -sin(theta), 0},
        {0, 1, 0, 0},
        {sin(theta), 0, cos(theta), 0},
        {pos[0], 0.01, pos[1], 1}
    };
    
    //Keep the texture pointing in the right direction throughout the loop
    if((ABC[0] - BCD[0]) < 0)
    {
        matrix[0][2] = -(matrix[0][2]);
        matrix[2][0] = -(matrix[2][0]);
    }
    else if((ABC[0] - BCD[0]) > 0)
    {
        matrix[0][0] = -(matrix[0][0]);
        matrix[2][2] = -(matrix[2][2]);
    }
    
    
    
    //Draw streets
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, street_texture);
    glUseProgram(m_program);
    glBegin(GL_TRIANGLE_STRIP);
    
    glTexCoord2f(0,1);
    glNormal3f(0,1,0);
    glVertex3f(-10,0,-10);
    
    glTexCoord2f(0,0);
    glNormal3f(0,1,0);
    glVertex3f(-10,0,10);
    
    glTexCoord2f(1,1);
    glNormal3f(0,1,0);
    glVertex3f(10,0,-10);
    
    glTexCoord2f(1,0);
    glNormal3f(0,1,0);
    glVertex3f(10,0,10);
    
    glEnd();
    glUseProgram(0);
    glDisable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, 0);
    //
    
    //Draw cars
    for (int i = 0; i < 9; i++) {
        matrix[3][0] = pos[0] + ((i % 3) * 6);
        matrix[3][2] = pos[1] + ((i / 3) * 6);
        glMatrixMode(GL_MODELVIEW);
        glPushMatrix();
        glMultMatrixf(matrix[0]);
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, car_texture);
        glUseProgram(m_program);

        drawCar();

        glUseProgram(0);
        glDisable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, 0);
        glPopMatrix();
        
        if (i+1 == camera) {
            glMatrixMode(GL_MODELVIEW);
            glLoadIdentity();
            gluLookAt(matrix[3][0],0.5,matrix[3][2],sin(roty)+matrix[3][0],sin(rotx)+0.2,-cos(roty)+matrix[3][2],0,1,0); //Camera rotation/translation is done here
        }
    }
    //
    
    //Draw structures
    for (int i = 0; i < 9; i++) {
        glMatrixMode(GL_MODELVIEW);
        glPushMatrix();
        glTranslatef((i % 3) * 6, 0, (i / 3) * 6);
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, structure_texture);
        glUseProgram(m_program);
        
        drawStructure();
        
        glUseProgram(0);
        glDisable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, 0);
        glPopMatrix();
    }
    //
    
    //Draw skybox
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, skybox_texture);
    glUseProgram(m_program);
    
    drawSkybox();
    
    glUseProgram(0);
    glDisable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, 0);
    //
    
    //Draw walls
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, wall_texture);
    glUseProgram(m_program);
    
    drawWalls();
    
    glUseProgram(0);
    glDisable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, 0);
    //
    
    if (!camera) {
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        gluLookAt(cposx,0.25,cposz,sin(roty)+cposx,sin(rotx)+cposy,-cos(roty)+cposz,0,1,0); //Camera rotation/translation is done here
    }
    
    glutSwapBuffers();  //swaps front and back buffer for double buffering
}
示例#17
0
void Board::draw() {
    drawTowers();
    drawWalls();
}
示例#18
0
void main()
{
	int choiceMM = 0, choicePM = 0, choiceOM = 0, choiceBM = 0, choicePPM = 0, choiceLoss = 0;
	float tempSpeed;
	bool first = true;
	bool mm = true;
	bool dPress = false, aPress = false, wPress = false, sPress = false, spacePress = false;
	bool playTennis = false, playSingle = false, playMulti = false;
	bool ballOffScreen = false;
	bool ballOp = false, playOp = false;

	curCX = 250;
	curCY = 250;

	/*cout << "Please choose game mode:\n\n" 
		 << "Tennis: 1\n" 
		 << "Single Player: 2\n" 
		 << "Multiplayer: 3\n";
	cin >> choice;*/

	initContext(SCREEN_X, SCREEN_Y, "Pong");

	while (stepContext())
	{
		// The main Menu
		if(mm)
		{
			cout << "Main; ";

			//This if chunk makes one key = one press on MM
			if (getKey('D') && !dPress)
			{
				choiceMM++;
				dPress = true;
			}
			else if (getKey('A') && !aPress)
			{
				choiceMM--;
				aPress = true;
			}

			if (choiceMM <= -1) { choiceMM = 2; }
			else if (choiceMM >= 3) { choiceMM = 0; }

			if (getKey(' ') && !spacePress) 
			{ 
				mm = false;
				spacePress = true;
			}

			cout << choiceMM << "(1); ";

			menuMain(choiceMM);
		}
		//All other menus
		else if (!mm && !playTennis && !playSingle && !playMulti)
		{
			cout << "Other menu; ";
			//Play menu
			if (choiceMM == 0)
			{
				cout << "Play Menu; ";
				cout << choicePM << "(1); ";

				if (getKey('D') && !dPress)
				{
					switch (choicePM)
					{
					case 0:
						choicePM = 1;
						break;
					case 1:
						choicePM = 0;
						break;
					case 2:
						choicePM = 3;
						break;
					case 3:
						choicePM = 2;
						break;
					}

					dPress = true;
				}
				else if (getKey('A') && !aPress)
				{
					switch (choicePM)
					{
					case 0:
						choicePM = 1;
						break;
					case 1:
						choicePM = 0;
						break;
					case 2:
						choicePM = 3;
						break;
					case 3:
						choicePM = 2;
						break;
					}

					aPress = true;
				}
				else if (getKey('W') && !wPress)
				{  
					switch (choicePM)
					{
					case 0:
						choicePM = 2;
						break;
					case 1:
						choicePM = 3;
						break;
					case 2:
						choicePM = 0;
						break;
					case 3:
						choicePM = 1;
						break;
					}

					wPress = true;
				}
				else if (getKey('S') && !sPress)
				{
					switch (choicePM)
					{
					case 0:
						choicePM = 2;
						break;
					case 1:
						choicePM = 3;
						break;
					case 2:
						choicePM = 0;
						break;
					case 3:
						choicePM = 1;
						break;
					}

					sPress = true;
				}

				if (choicePM == -1) { choicePM = 3; }
				else if (choicePM == 4) { choicePM = 0; }

				if (getKey(' ') && !spacePress)
				{
					if (choicePM == 0)
					{
						playSingle = true;
					}
					else if (choicePM == 1)
					{
						playMulti = true;
					}
					else if (choicePM == 2)
					{
						choicePM = 0;
						choiceMM = 0;
						mm = true;
					}
					else
					{
						playTennis = true;
					}

					spacePress = true;
				}

				menuPlay(choicePM);
			}
			//Options menu
			else if (choiceMM == 1)
			{
				cout << "Op Menu; ";
				
				if (getKey('W') && !wPress)
				{
					choiceOM--;
					wPress = true;
				}
				else if (getKey('S') && !sPress)
				{
					choiceOM++;
					sPress = true;
				}

				if (choiceOM == -1) { choiceOM = 2; }
				else if (choiceOM == 3) { choiceOM = 0; }

				if (ballOp)
				{
					cout << "Ball menu; ";

					if (getKey('A')) { choiceBM--; }
					else if (getKey('D')) { choiceBM++; }
					if (choiceBM < 0) { choiceBM = 0; }
					else if(choiceBM > 1) {choiceBM = 1; }

					menuBallOp(choiceBM);

					if (getKey(' ') && !spacePress)
					{
						if (!choiceBM)
						{
							ballOp = false;
							menuBallOp(3);
						}
						else
						{
							menuBallOp(3);
						}

						spacePress = true;
					}

					cout << choiceBM << "(4); ";
				}
				else if (playOp)
				{
					cout << "Play  mmenu; ";

					if (getKey('A')) { choicePPM--; }
					else if (getKey('D')) { choicePPM++; }
					if (choicePPM < 0) { choicePPM = 0; }
					else if (choicePPM > 1) { choicePPM = 1; }

					menuBallOp(choicePPM);

					if (getKey(' ') && !spacePress)
					{
						if (!choicePPM)
						{
							playOp = false;
							menuPlayOp(3);
						}
						else
						{
							menuPlayOp(3);
						}

						spacePress = true;
					}

					cout << choicePPM << "(4); ";
				}
				else if(getKey(' ') && !spacePress)
				{
					switch (choiceOM)
					{
					case 0:
						ballOp = true;
						break;
					case 1:
						playOp = true;
						break;
					case 2:
						choiceOM = 0;
						choiceMM = 0;
						mm = true;
						break;
					}

					spacePress = true;
				}
				else
				{
					menuOpt(choiceOM);
				}

				cout << choiceOM << "(1); ";
			}
			else if (choiceMM == 2) { termContext(); }
		}
		else if (playTennis)
		{
			if (first)
			{
				moveBall(true, true);
				first = false;
			}

			if (!ballOffScreen)
			{
				movePlayers();
				moveBall(false, true);
			}
			else
			{
				if (getKey('W') && !wPress) { choiceLoss--, wPress = true; }
				else if (getKey('S') && !sPress) { choiceLoss++, sPress = true;  }
				if (choiceLoss < 0) { choiceLoss = 2; }
				else if (choiceLoss > 2) { choiceLoss = 0; }

				menuLoss(choiceLoss);

				if (getKey(' ') && !spacePress)
				{
					switch (choiceLoss)
					{
					case 0:
						curCX = xSpace(1, 2);
						curCY = ySpace(1, 2);
						first = true;
						cSPEED_Y = 0;
						ballOffScreen = false;
						break;
					case 1:
						choicePM = 0;
						choiceMM = 0;
						choiceLoss = 0;
						mm = true;
						playTennis = false;
						curCX = xSpace(1, 2);
						curCY = ySpace(1, 2);
						first = true;
						cSPEED_Y = 0;
						ballOffScreen = false;
						break;
					case 2:
						termContext();
						break;
					}
				}

				spacePress = true;
			}

			cout << choiceLoss << "(4); ";

			drawPlayer(PLAYER1);
			drawCircle(curCX, curCY, R);
			drawWalls(true);

			if (curCX > SCREEN_X || curCX < 0)
			{
				ballOffScreen = true;
			}
		}
		else if (playSingle)
		{
			if (first)
			{
				moveBall(true, false);
				first = false;
			}

			if (!ballOffScreen)
			{
				movePlayers();
				moveBall(false, true);
				moveAI();
			}
			else
			{
				if (getKey('W') && !wPress) { choiceLoss--, wPress = true; }
				else if (getKey('S') && !sPress) { choiceLoss++, sPress = true; }
				if (choiceLoss < 0) { choiceLoss = 2; }
				else if (choiceLoss > 2) { choiceLoss = 0; }

				menuLoss(choiceLoss);

				if (getKey(' ') && !spacePress)
				{
					switch (choiceLoss)
					{
					case 0:
						curCX = xSpace(1, 2);
						curCY = ySpace(1, 2);
						first = true;
						cSPEED_Y = 0;
						ballOffScreen = false;
						break;
					case 1:
						choicePM = 0;
						choiceMM = 0;
						choiceLoss = 0;
						mm = true;
						playSingle = false;
						curCX = xSpace(1, 2);
						curCY = ySpace(1, 2);
						first = true;
						cSPEED_Y = 0;
						ballOffScreen = false;
						break;
					case 2:
						termContext();
						break;
					}
				}

				spacePress = true;
			}

			cout << choiceLoss << "(4); ";

			drawPlayer(PLAYER1);
			drawPlayer(AI);
			drawCircle(curCX, curCY, R);
			drawWalls(false);

			if (curCX > SCREEN_X || curCX < 0)
			{
				ballOffScreen = true;
			}
		}
		else if (playMulti)
		{
			if (first)
			{
				moveBall(true, false);
				first = false;
			}

			if (!ballOffScreen)
			{
				movePlayers();
				moveBall(false, true);
			}
			else
			{
				if (getKey('W') && !wPress) { choiceLoss--, wPress = true; }
				else if (getKey('S') && !sPress) { choiceLoss++, sPress = true; }
				if (choiceLoss < 0) { choiceLoss = 2; }
				else if (choiceLoss > 2) { choiceLoss = 0; }

				menuLoss(choiceLoss);

				if (getKey(' ') && !spacePress)
				{
					switch (choiceLoss)
					{
					case 0:
						curCX = xSpace(1, 2);
						curCY = ySpace(1, 2);
						first = true;
						cSPEED_Y = 0;
						ballOffScreen = false;
						break;
					case 1:
						choicePM = 0;
						choiceMM = 0;
						choiceLoss = 0;
						mm = true;
						playMulti = false;
						curCX = xSpace(1, 2);
						curCY = ySpace(1, 2);
						first = true;
						cSPEED_Y = 0;
						ballOffScreen = false;
						break;
					case 2:
						termContext();
						break;
					}
				}

				cout << choiceLoss << "(4); ";
				spacePress = true;
			}

			drawPlayer(PLAYER1);
			drawPlayer(PLAYER2);
			drawCircle(curCX, curCY, R);
			drawWalls(false);

			if (curCX > SCREEN_X || curCX < 0)
			{
				ballOffScreen = true;
			}
		}

		if (!getKey('W') && wPress) { wPress = false; }
		if (!getKey('A') && aPress) { aPress = false; }
		if (!getKey('S') && sPress) { sPress = false; }
		if (!getKey('D') && dPress) { dPress = false; }
		if (!getKey(' ') && spacePress) { spacePress = false; }

		cout << endl;
	}
}