예제 #1
0
void Game::update(float interval)
{
	updateEnvironment(interval);
	switch (mGameState) {
		case STATE_MENU:
			break;
		case STATE_WAITING:
			updateBall(sgoBall, interval);

			if ((sgoBall.pos() - sgLookat).len() < 1.0f)
			{
				mCounter = 0.0f;
				mGameState = STATE_COUNTDOWN;
			}
			break;
		case STATE_COUNTDOWN:
			mCounter += interval;
			if (mCounter > COUNTDOWN_TIME)
			{
				enableBall();
				mGameState = STATE_RUNNING;
			}
		case STATE_RUNNING:
		if (wasKeyPressed(KEY_ESC))
		{
			Main::pushState(gScreenMain2);
		}

		/* manually switch features */
		if (wasFunctionPressed(1))
		{
			setBallShadow(!useBallShadow());
		}

		if (wasFunctionPressed(2))
		{
			setReflection(!useReflection());
		}

		if (wasFunctionPressed(5))
		{
			suspend();
			toggleMouseControl();
			resume();
		}

		updateBall(sgoBall, interval);
			break;
	}

	updateGameField(sgoBall);
}
예제 #2
0
파일: match.cpp 프로젝트: walsh06/grifball
//================================
//MOVE
//================================
void Match::moveUp(Player *p)
{
   // cout << " Moves Forward" << endl;

    if(p->getStatus() == p->BALL_WITH_OPP)
    {
        dodge(p);
    }
    else
    {
        int team = p->getTeam();
        if(team == 1)
        {
            p->setPosX(p->getPosX() + 1);
        }
        else if(team == 2)
        {
            p->setPosX(p->getPosX() - 1);
        }
        checkBall(p);
        if(p->getNumber() == ball->getPlayer())
        {
            updateBall(p);
            screen->updateMove(p, p->MOVE_UP);
        }
    }

    checkWin(p);
}
예제 #3
0
void RegularBattleScene::updatePoke(int spot)
{
    int player = data()->player(spot);
    int slot = data()->slotNum(spot);

    auto &poke = *data()->team(player).poke(slot);

    if (!poke.isKoed()) {
        //zone->switchTo(poke, spot, info()->sub[spot], info()->specialSprite[spot]);
        gui.nick[spot]->setText(nick(spot));
        gui.level[spot]->setText(tr("Lv. %1").arg(poke.level()));
        updateHp(spot);
        gui.gender[spot]->setPixmap(gui.theme->battleGenderPicture(poke.gender()));
        int status = poke.status();
        gui.status[spot]->setPixmap(gui.theme->battleStatusIcon(status));
    }  else {
        //zone->switchToNaught(spot);
        gui.nick[spot]->setText("");
        gui.status[spot]->setPixmap(gui.theme->battleStatusIcon(Pokemon::Fine));
        gui.gender[spot]->setPixmap(QPixmap());
        gui.bars[spot]->setValue(0);
        gui.level[spot]->setText("");
    }
    gui.fullBars[player]->update(); //needed because qt5 doesn't do its job properly

    updateBall(player, slot);
}
예제 #4
0
파일: match.cpp 프로젝트: walsh06/grifball
//====================================
//PASS
//======================================
void Match::pass(Player *p)
{
    int randRating = Player::maxRating + 1;
    //cout << " Pass ";
    int passRoll =(rand()%randRating + 1) + p->getPass();
    Player* target = getTeammate(p);

    if(passRoll > 21)
    {
        //cout << "To " << target->getName() << endl;

        screen->updatePass(p, target);
        updateBall(target);
        setPlayerStatus(target);
        setPlayerStatus(p);
    }
    else
    {
        stringstream message ;
        message << p->getName() << " missed with a bad pass to " << target->getName();
        screen->updateMissPass(p, target);
        //cout << "Misses pass to " << target->getName() << " , Loose Ball!!" << endl;
        ball->drop();
        setMissPass(target->getPosX(), target->getPosY());
        setAllStatus();
    }
}
예제 #5
0
파일: ballv.c 프로젝트: sara-02/code_dump
void display()
{
        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
        
        glClearColor(0,0,1,0);
        
        glPushMatrix();
        
        glBegin(GL_POLYGON);
            glColor3f(1,0,0);
            
            glVertex3f(-0.25,0,-1);

            glVertex3f(0.25,0,-1);

            glVertex3f(0,0.25,-1);
        glEnd();
        glPopMatrix();
   

        glPushMatrix();
            glColor3f(0,1,1);
            glTranslatef(ball_x,ball_y,ball_z);
            glutSolidSphere(0.1,23,23);
        glPopMatrix();

        //update functin, will be called after every microsecond
        updateBall();


        glutSwapBuffers();
}
예제 #6
0
파일: match.cpp 프로젝트: walsh06/grifball
//=======================
//BALL
//=======================
void Match::checkBall(Player *p)
{
    int x = ball->getPosX(), y =  ball->getPosY(), px = p->getPosX(), py = p->getPosY();
    if(py == y && px == x && ball->getTeam() == -1)
    {
       updateBall(p);
       screen->updatePickup(p);
    }
}
예제 #7
0
void display()
{
        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);  
        glClearColor(0,0,0,0);
        glPushMatrix();
        glColor3f(1,0,0);
        glTranslatef(ball_x,ball_y,ball_z);
        glutSolidSphere(0.2,30,30);
        glPopMatrix();
        updateBall();
        glutSwapBuffers();
}
예제 #8
0
void Editor::update(float interval)
{
	switch (mState)
	{
	case STATE_TESTING:
		if (wasKeyPressed(KEY_ESC))
		{
			disableTestMode();
		}

		updateBall(mBall, interval);
		break;
	case STATE_EDITING:
	{
		Vector3 markerPos;

		if (wasKeyPressed(KEY_ESC))
		{
			Main::pushState(mScreenEditorMain);
		}

		if (wasKeyPressed(KEY_ENTER))
		{
			enableTestMode();
		}

		Vector3 min(gCurStart.x + 0.5f, gCurStart.y + 0.5f, 0.0f);
		Vector3 max(gCurEnd.x + 0.5f, gCurEnd.y + 0.5f, 0.0f);
		KdRangeTraverse iter(*sgLevel.kdLevelTree, min, max);
		KdList list(iter);

		markerPos.x = (gCurStart.x + gCurEnd.x) / 2.0f + 0.5f;
		markerPos.y = (gCurStart.y + gCurEnd.y) / 2.0f + 0.5f;

		if (list.next())
		{
			markerPos.z = (float) sgLevel.blocks[*list].z / HEIGHT_STEPS;
		}
		else
		{
			markerPos.z = (float) 0.0f;
		}

		updateEditorCamera(interval, add(markerPos, sgLevel.origin));
		animateEditor(interval);
		break;
	}
	default:
		break;
	}
}
예제 #9
0
void Game::timer (int val)
{
    //cout << "val: " << val << endl;
    stringstream ss("");
    ss << "Ablockalypse v0.1 Score: " << score << " Balls Left: " << lives;
    glutSetWindowTitle(ss.str().c_str());

    if (!paused){
        updateBall(ball);
    }

    glutPostRedisplay();
    glutTimerFunc (40, timerWrapper, 0);
}
예제 #10
0
void update(int value) {

   // input handling
   keyboard();

// update ball
   updateBall();

   // Call update() again in 'interval' milliseconds
   glutTimerFunc(interval, update, 0);

   // Redisplay frame
   glutPostRedisplay();
}
예제 #11
0
파일: match.cpp 프로젝트: walsh06/grifball
void Match::dodge(Player *p)
{
    int randRating = Player::maxRating + 1;
    //cout << " Jumps";
    int team = p->getTeam(), oppTeam;
    Player *opp;
    if(team == 1)
    {
        oppTeam = 2;
        opp = teamTwo->getPlayer(checkSquare(p, 1));
    }
    else if(team == 2)
    {
        oppTeam = 1;
        opp = teamOne->getPlayer(checkSquare(p, 2));
    }
    int attackRoll = (rand()%randRating) + opp->getAttack();
    int dodgeRoll = (rand()%randRating) + p->getJump();

    if(attackRoll > dodgeRoll)
    {
        //cout << " but is killed by Kills " << opp->getName() << endl;
        p->kill();
        playersToMove.erase(playersToMove.begin()+ findPlayer(p));
        ball->drop();
        screen->updateKill(opp, p);
        screen->updateKillFeed(opp, p);
    }
    else
    {
        screen->updateDodge(opp, p);
        //cout << " and gets past" << opp->getName() << endl;
        if(team == 1)
        {
            p->setPosX(p->getPosX() + 1);
        }
        else if(team == 2)
        {
            p->setPosX(p->getPosX() - 1);
        }
        if(p->getNumber() == ball->getPlayer())
        {
            updateBall(p);
        }
    }

}
	//MAIN DISPLAY FUNCTION
	void display()
	{
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		
		//BackGround Color set korsi
		glClearColor(0, 0,0, 0);


		//BALL draw korsi
		glPushMatrix();
			glColor3f(1, 0, 0);
			glTranslatef(ball_x, ball_y, ball_z);
			glutSolidSphere(0.1, 23, 23);
		glPopMatrix();

		//update call hobe after every millisecond
		updateBall();

		glutSwapBuffers();
	}
예제 #13
0
파일: match.cpp 프로젝트: walsh06/grifball
void Match::moveRight(Player *p)
{
    //cout << " Moves Right" << endl;

    int team = p->getTeam();

    if(team == 1)
    {
        p->setPosY(p->getPosY() - 1);
    }
    else if(team == 2)
    {
        p->setPosY(p->getPosY() + 1);
    }
    checkBall(p);
    if(p->getNumber() == ball->getPlayer())
    {
        updateBall(p);
        screen->updateMove(p, p->MOVE_RIGHT);
    }
}
예제 #14
0
파일: match.cpp 프로젝트: walsh06/grifball
void Match::moveBack(Player *p)
{
    //cout << " Moves Backward" << endl;

    int team = p->getTeam();

    if(team == 1)
    {
        p->setPosX(p->getPosX() - 1);
    }
    else if(team == 2)
    {
        p->setPosX(p->getPosX() + 1);
    }
    checkBall(p);
    if(p->getNumber() == ball->getPlayer())
    {
        updateBall(p);
        screen->updateMove(p, p->MOVE_DOWN);
    }
}
예제 #15
0
void main() 
{
	init_uart(_UART0,_DEFFREQ,_DEFBAUD); // set-up UART0 to 57600, 8n1
	
	timer2000();	//Starts the internal timer 
	LEDinit();		//Activates the LED displays
	LEDsetString("//Reflex Ball\\\\");	

	//Initialization of variables used during the game
	gamedata.ballspeed = 100;
	gamedata.strikerspeed = 20;
	gamedata.wigglecount = 0;
	gamedata.ballcount = 0;
	gamedata.strikercount = 0;
	gamedata.randAngle = 64;
	gamedata.ball2 = 0;
	
	//This loop resets game data and starts a new game
	while(1){
		//Menu 1 evaluates to true when player hits 'play' and selects no. of balls
		if(menu1()){ 
		
			//Ball, striker and block declarations
			Ball_t ball1;
			Ball_t ball2;
			Striker_t striker;
			Block_t block;

			//Ball, striker and block initializations
			ball1.angle = 64;
			gamedata.score = 0;
			gamedata.blocksleft = 0;
			if(gamedata.ball2) ball2.angle = 32;	//Only sets 2nd ball angle if user selects 2 balls
			striker.lives = 3;
			initBall(&ball1,ball1.angle,20,20); 
			if(gamedata.ball2) initBall(&ball2,ball2.angle,30,20);	//Only initializes 2nd ball if user selects it
			initStriker(&striker,62,77,38);

			clrscr();
			initBlocks(&block);		//Creates and draws the blocks on the map
			drawBox();				//Draws the borders of the map

			//Draws striker and various game data
			gotoxy(62,39);
			printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",219,219,219,219,219,219,219,219,219,219,219,219,219,219,219);
			gotoxy(160,10);
			printf("Lives remaining: %d",striker.lives);
			gotoxy(160,12);
			printf("Score: %d",gamedata.score);
			gotoxy(160, 14);
			printf("Blocks left: %d",gamedata.blocksleft);
			window(158,8,180,16,"Stats",2);
			LEDsetString("Lives: 3");

			//This loop starts the actual game
			while(1) {

				//Quits current game and goes to menu if user hits all three buttons
				if(readkey() == 7){
					break;
				}

				//If all blocks are gone: celebrate with a lady and go back to menu
				if(gamedata.blocksleft == 0)
				{
					clrscr();
					lady();
					wiggleLady();
					break;
				}
				
				if(striker.lives > 0)
				{
					
					if(gamedata.strikerUpdate)  //Only runs when flag is high (controlled by timer)
					{ 
						updateStriker(&striker);
						gamedata.strikerUpdate = 0;

						
						if(striker.drawEnable)	//Only draws striker if it has moved and the flag is high
						{ 
							gotoxy((striker.x1_prev >> FIX14_SHIFT),39);
							printf("               ");			//Deletes 'old' striker
							gotoxy((striker.x1 >> FIX14_SHIFT),39);
							printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",219,219,219,219,219,219,219,219,219,219,219,219,219,219,219); //Draws 'new' striker
						}
					}

					if(gamedata.ballUpdate) //Only runs when flag is high (controlled by timer)
					{ 
						gotoxy((ball1.xpos >> FIX14_SHIFT),(ball1.ypos >> FIX14_SHIFT));
						printf(" ");		//Deletes 'old' ball
						checkBallpos(&ball1,&striker);	//Checks if ball hits borders of map or striker and changes direction accordingly
						checkBlock(&block,&ball1);		//Checks if ball hits a block and takes actions accordingly
						if(ball1.xspeed == 0 && ball1.yspeed == 0) ball1.xpos = striker.x1 + (striker.x2 - striker.x1)/3;  //Places ball on top of striker if it just died
						updateBall(&ball1, &striker);	//Moves ball according to its vector
						gotoxy((ball1.xpos >> FIX14_SHIFT),(ball1.ypos >> FIX14_SHIFT));
						printf("%c",223);	//Draws 'new' ball

						if(gamedata.ball2) //If 2nd ball is in use, do the same to it as to the first ball above
						{
							gotoxy((ball2.xpos >> FIX14_SHIFT),(ball2.ypos >> FIX14_SHIFT));
							printf(" ");
							checkBallpos(&ball2,&striker);
							checkBlock(&block,&ball2);
							if(ball2.xspeed == 0 && ball2.yspeed == 0) ball2.xpos = striker.x1 + (striker.x2 - striker.x1)/3 + (striker.x2 - striker.x1)/2 ;
							updateBall(&ball2, &striker);
							gotoxy((ball2.xpos >> FIX14_SHIFT),(ball2.ypos >> FIX14_SHIFT));
							printf("%c",223);
						}
						gamedata.ballUpdate = 0;
					}
				} 
예제 #16
0
파일: main.cpp 프로젝트: sz830/pong
int main(int argc, char *argv[])
{
	SDL_Init(SDL_INIT_VIDEO);
	displayWindow = SDL_CreateWindow("Simon Project 1", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, SDL_WINDOW_OPENGL); // SDL Window, title, position,position,width,height, type of graphics?
	SDL_GLContext context = SDL_GL_CreateContext(displayWindow);
	SDL_GL_MakeCurrent(displayWindow, context);

	glClearColor(0.5, 0.5, 0.0, .9);//Green-color

	//Setup
	glViewport(0, 0, 800, 600);
	glMatrixMode(GL_PROJECTION);
	glOrtho(-1.33, 1.33, -1.0, 1.0, -1.0, 1.0);
	glMatrixMode(GL_MODELVIEW);
	glOrtho(-1.33, 1.33, -1.0, 1.0, -1.0, 1.0);

	//LoadTextures
	GLuint paddleID = LoadTexture("pngs/paddle.png");
	GLuint ballID = LoadTexture("pngs/ball.png");
	GLuint leftwinID = LoadTexture24("pngs/leftwin.png");
	GLuint rightwinID = LoadTexture24("pngs/rightwin.png");
	//Init Entities
	initBall(ballID);
	initPaddleLeft(paddleID);
	initPaddleRight(paddleID);
	initRightwin(rightwinID);
	initLeftwin(leftwinID);

	//Time
	float lastFrameTicks = 0.0;
	
	SDL_Event event;
	bool done = false;
	while (!done) {
		glClear(GL_COLOR_BUFFER_BIT);
		float ticks = (float)SDL_GetTicks() / 1000.0f;
		float elapsed = ticks - lastFrameTicks;
		lastFrameTicks = ticks;

		//Read Input and Update World
		while (SDL_PollEvent(&event)) { // a lot of events could cue up, no?, could also get all keyboard states and check for those. I think I like that better. - specially for pong
			if (event.type == SDL_QUIT || event.type == SDL_WINDOWEVENT_CLOSE) {
				done = true;
			}
		}
		const Uint8 *keys = SDL_GetKeyboardState(NULL);
		if (keys[SDL_SCANCODE_UP]) {
			paddleright.y += elapsed*paddleright.velocity_y;
			if (paddleright.y > (1 - .2)){ paddleright.y = 1 - .2; }
		}
		else if (keys[SDL_SCANCODE_DOWN]) {
			paddleright.y -= elapsed*paddleright.velocity_y;
			if (paddleright.y < (-1 + .2)){ paddleright.y = -1 + .2; }
		}
		if (keys[SDL_SCANCODE_W]) {
			paddleleft.y += elapsed*paddleleft.velocity_y;
			if (paddleleft.y >(1 - .2)){ paddleleft.y = 1 - .2; }
		}
		else if (keys[SDL_SCANCODE_S]) {
			paddleleft.y -= elapsed*paddleleft.velocity_y;
			if (paddleleft.y < (-1 + .2)){ paddleleft.y = -1 + .2; }
		}

		updateBall(elapsed);
		isWin();

		//Render World
		ball.Draw();
		paddleleft.Draw();
		paddleright.Draw();
		if (rightwin)
		{
			endGame();
			rightwinE.Draw();
		}
		if (leftwin)
		{
			endGame();
			leftwinE.Draw();
		}

		SDL_GL_SwapWindow(displayWindow);//Swaps old modelview with new one?
	}

	SDL_Quit();
	return 0;
}
예제 #17
0
int main(void)
{
    //Enable background 2 and set mode to MODE_4
	setMode(MODE_4 | OBJ_MAP_1D | BG2_ENABLE);
	
	showGameIntro();
	WaitForStart();
	EraseScreen();

	initGameBasicParameters();
	
    //game loop
    while(1)
    {
	    if(score1 != MAX_POINTS_TO_WIN && score2 != MAX_POINTS_TO_WIN){
		    waitRetrace();
        
	        eraseBall();
	        erasePaddle1();
	        erasePaddle2();
	
	        updatePaddle1();
	        updatePaddle2();
	        updateBall();
	
	        drawPaddle1();
	        drawPaddle2();
	
	        checkCollisions();
	        drawBall();
	
	        printScores();
	    }else{
		    if(score1 == MAX_POINTS_TO_WIN && state ==  0){ // PLAYER-CHINA
			    score1 = 0;
			    score2 = 0;
			    
			    //Enable background 2 and set mode to MODE_4
				setMode(MODE_4 | OBJ_MAP_1D | BG2_ENABLE);
			    showChinaEnding();
			    EraseScreen();
		    }
		    if(score1 == MAX_POINTS_TO_WIN && state ==  1){ // PLAYER-USA
				score1 = 0;
			    score2 = 0;
			    
			    //Enable background 2 and set mode to MODE_4
				setMode(MODE_4 | OBJ_MAP_1D | BG2_ENABLE);
			    showUSAEnding();
			    EraseScreen();
		    }
		    if(score2 == MAX_POINTS_TO_WIN && state ==  0){ // CPU-CHINA
			    score2 = 0;
			    score1 = 0;
			    
			    //Enable background 2 and set mode to MODE_4
				setMode(MODE_4 | OBJ_MAP_1D | BG2_ENABLE);
			    //showChinaEnding();
				showPlayerDefeatedByEEUU();
			    EraseScreen();
		    }
		    if(score2 == MAX_POINTS_TO_WIN && state ==  1){ // CPU-USA
			    score2 = 0;
			    score1 = 0;
			    
			    //Enable background 2 and set mode to MODE_4
				setMode(MODE_4 | OBJ_MAP_1D | BG2_ENABLE);
			    //showUSAEnding();
				showPlayerDefeatedByChina();
			    EraseScreen();
		    }   
		    
		    initGameBasicParameters();
	    }
    }

    return 0;
}
예제 #18
0
파일: main.cpp 프로젝트: phamminh91/Pong
int main()
{
    bool done = false;
    bool redraw = true;
    bool is_game_over = false;
    ALLEGRO_DISPLAY *display = NULL;
    ALLEGRO_EVENT_QUEUE *events = NULL;
    ALLEGRO_TIMER *timer = NULL;
    ALLEGRO_FONT *font20 = NULL;
    ALLEGRO_FONT *font40 = NULL;

    if (!al_init())
        return 1;
    display = al_create_display(DISPLAY_WIDTH, DISPLAY_HEIGHT);
    if (!display)
        return 1;    

    // Initialize add-ons
    al_init_primitives_addon();
    al_install_keyboard();
    al_init_font_addon();
    al_init_ttf_addon();

    timer = al_create_timer(1.0 / FPS);
    events = al_create_event_queue();
    al_register_event_source(events, al_get_keyboard_event_source());
    al_register_event_source(events, al_get_timer_event_source(timer));

    font20 = al_load_font("arial.ttf", 20, 0);
    font40 = al_load_font("arial.ttf", 40, 0);

    al_start_timer(timer);
    while (!done)
    {        
        // Events handling
        ALLEGRO_EVENT ev;
        al_wait_for_event(events, &ev);

        if (ev.type == ALLEGRO_EVENT_KEY_UP)
        {
            switch (ev.keyboard.keycode)
            {
                case ALLEGRO_KEY_J:
                    keys[J] = false;
                    break;
                case ALLEGRO_KEY_K:
                    keys[K] = false;
                    break;
                case ALLEGRO_KEY_S:
                    keys[S] = false;
                    break;
                case ALLEGRO_KEY_D:
                    keys[D] = false;
                    break;
                case ALLEGRO_KEY_ESCAPE:
                    done = true;
                    break;
            }
        }
        else if (ev.type == ALLEGRO_EVENT_TIMER)
        {
            redraw = true;

            if (!is_game_over)
            {
                updateBall(*ball);
                updateLeftBar(*bar1);
                updateRightBar(*bar2);
                handleCollision(*bar1, *bar2, *ball);

                if (score1 == WINNING_SCORE || score2 == WINNING_SCORE)
                    is_game_over = true;
            }
        }
        else if (ev.type == ALLEGRO_EVENT_KEY_DOWN)
        {
            switch (ev.keyboard.keycode)
            {
                case ALLEGRO_KEY_J:
                    keys[J] = true;
                    break;
                case ALLEGRO_KEY_K:
                    keys[K] = true;
                    break;
                case ALLEGRO_KEY_S:
                    keys[S] = true;
                    break;
                case ALLEGRO_KEY_D:
                    keys[D] = true;
                    break;
            }
        }
        
        if (redraw && al_is_event_queue_empty(events))
        {
            redraw = false;
            if (!is_game_over)
            {
                // Rendering
                al_clear_to_color(al_map_rgb(0, 0, 0));
                ball->render();
                bar1->render();
                bar2->render();
                al_draw_textf(font20, al_map_rgb(255, 255, 255), DISPLAY_WIDTH/2, DISPLAY_HEIGHT - 40, ALLEGRO_ALIGN_CENTRE, "%d : %d", score1, score2);
                al_flip_display();
            }
            else
            {
                al_clear_to_color(al_map_rgb(0, 0, 0));
                if (score1 == WINNING_SCORE)
                    al_draw_text(font40, al_map_rgb(255, 255, 255), DISPLAY_WIDTH/2, DISPLAY_HEIGHT/2 - 20, ALLEGRO_ALIGN_CENTRE, "PLAYER 1 WON");
                else if (score2 == WINNING_SCORE)
                    al_draw_text(font40, al_map_rgb(255, 255, 255), DISPLAY_WIDTH/2, DISPLAY_HEIGHT/2 - 20, ALLEGRO_ALIGN_CENTRE, "PLAYER 2 WON");
                al_draw_text(font20, al_map_rgb(255, 255, 255), DISPLAY_WIDTH/2, DISPLAY_HEIGHT/2 + 40, ALLEGRO_ALIGN_CENTRE, "Press 'r' to start a new game");
                al_flip_display();
            }
            
        }
    }

    // House cleaning
    delete ball;
    delete bar1;
    delete bar2;
    al_destroy_font(font20);
    al_destroy_font(font40);
    al_destroy_display(display);
    al_destroy_event_queue(events);

    return 0;
}