示例#1
0
void SplashScreen::Show(sf::RenderWindow& renderWindow)
{
	sf::Texture image;
	if (!image.loadFromFile("media/images/rekt.png"))
	{
		return;
	}

	sf::Sprite sprite(image);

	renderWindow.draw(sprite);
	renderWindow.display();

	sf::Event event;
	while(true)
	{
		while(renderWindow.pollEvent(event))
	    {
        if(event.type == sf::Event::EventType::KeyPressed || event.type == sf::Event::EventType::MouseButtonPressed 
        	|| event.type == sf::Event::EventType::Closed )
       	{
        	return;
       	}
	}
}
}
示例#2
0
void DialogueMode::update(sf::RenderWindow &rw, sf::Clock &clock)
{
    float elapsed = clock.restart().asSeconds();
    rw.clear(sf::Color::White);                                     //should this be in highest loop?
    
    //handle all input
    sf::Event event;
    while (rw.pollEvent(event)) {
        if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Space) {
            current = current->getNext();
            if (current == nullptr) {
                deletionOrder = true;
                return;
            }
        }
        else current->handleInput(event);
    }
    current->update(elapsed);
    
    //put into drawAll function?
    rw.setView(mapView);
    
    currentMap->drawAllObjects(rw, playerSprite);
    
    rw.setView(HUD);
    rw.draw(messageBox);
    current->draw(rw);
    rw.display();
}
示例#3
0
void RenderEngine::WindowFunctions(sf::RenderWindow& window)
{	
	//create textures

	// run the program as long as the window is open
	while (window.isOpen())
	{
		// check all the window's events that were triggered since the last iteration of the loop
		sf::Event event;
		while (window.pollEvent(event))
		{
			// "close requested" event: we close the window
			if (event.type == sf::Event::Closed)
				window.close();
		}

		// clear the window with black color
		window.clear(sf::Color::Black);

		// draw everything here...
		//draws the stack of sprites
		for (unsigned int i = 0; i < stackOfSprites.size(); i++)
		{
			window.draw(stackOfSprites[i]);
		}

		// window.draw(...);

		// end the current frame
		window.display();
		return;
	}

}
示例#4
0
    MainMenu::MenuResult MainMenu::show( sf::RenderWindow &window )
    {
        // load menu image
        sf::Texture texture;
        texture.loadFromFile( "images/MainMenu.png" );
        sf::Sprite sprite( texture );

        /********************************
        * setup clickable regions
        *********************************/

        // Play menu item coordinates
        MenuItem playButton;
        playButton.rect.top = 0;
        playButton.rect.height = 290;
        playButton.rect.left = 0;
        playButton.rect.width = SCREEN_WIDTH - 1;
        playButton.action = PLAY;

        // Quit menu item coordinates
        MenuItem quitButton;
        quitButton.rect.top = 310;
        quitButton.rect.height = 599;
        quitButton.rect.left = 0;
        quitButton.rect.width = SCREEN_WIDTH - 1;
        quitButton.action = EXIT;

        _menuItems.push_back( playButton );
        _menuItems.push_back( quitButton );

        window.draw( sprite );
        window.display();

        return menuResponse( window );
    }
示例#5
0
        inline void run()
        {
            SSVU_ASSERT(gameEngine != nullptr);

            while(gameEngine->isRunning())
            {
                if(mustRecreate) recreateWindow();

                renderWindow.setActive(true);
                this->clear();

                gameEngine->refreshTimer();

                auto tempMs(HRClock::now());
                {
                    runEvents();
                    gameEngine->runUpdate();
                }
                msUpdate = std::chrono::duration_cast<FTDuration>(
                               HRClock::now() - tempMs)
                               .count();

                tempMs = HRClock::now();
                {
                    gameEngine->runDraw();
                    renderWindow.display();
                }
                msDraw = std::chrono::duration_cast<FTDuration>(
                             HRClock::now() - tempMs)
                             .count();

                gameEngine->runFPS();
            }
        }
示例#6
0
void drawBoids() {
    world.moveAllBoidsToNewPosition();

    for(int j = 0; j<5; j++) {
        window.clear(sf::Color::White);
        for(int i = 0; i<numberOfBoids; i++) {
            int x_velocity = world.Boids[i].velocity.x;
            int x = (sgn(x_velocity))*abs(x_velocity/5);

            int y_velocity = world.Boids[i].velocity.y;
            int y = (sgn(y_velocity))*abs(y_velocity/5);

            boidsShapes[i].setPosition(boidsShapes[i].getPosition().x+x, boidsShapes[i].getPosition().y+y);
            window.draw(boidsShapes[i]);
        }
        window.display();
    }
    /*


    window.clear(sf::Color::White);
    for(int i = 0; i<numberOfBoids; i++){
        boidsShapes[i].setPosition(world.Boids[i].position.x, world.Boids[i].position.y);
        window.draw(boidsShapes[i]);
    }
    window.display();
     */

}
示例#7
0
//fake loading screen for smooth transition purposes
int loading_screen(std::string filePath) {
	//std::cout << "load\n"; //debug

	sf::SoundBuffer buffer;
	if (!buffer.loadFromFile(filePath + ".ogg")) {
		std::cout << "Cannot load " << filePath << ".ogg"; //debug
	}
	sf::Sound sound;
	sound.setBuffer(buffer);
	sound.play();

	sf::Clock clock;

	/*
	while (clock.getElapsedTime().asMilliseconds() < 1000) {
		//window.clear(sf::Color(0, 0, 0));
		window.draw()
		window.display();
	}*/

	while (sound.getStatus() != 0) {
		window.clear(sf::Color(0, 0, 0));
		window.display();
	}

	return 0;
}
示例#8
0
MainMenu::MenuResult MainMenu::Show(sf::RenderWindow& window)
{ 
	//Load menu image from file
	sf::Texture image;
	image.loadFromFile("assets/images/mainMenu-background.png");
	sf::Sprite sprite(image);
 
	//Setup clickable regions
 
	//Play menu item coordinates
	MenuItem playButton;
	playButton.rect.top= 200;
	playButton.rect.height= 100;
	playButton.rect.left = 0;
	playButton.rect.width = 800;
	playButton.action = Play;
 
	//Exit menu item coordinates
	MenuItem exitButton;
	exitButton.rect.left = 0;
	exitButton.rect.width = 600;
	exitButton.rect.top = 400;
	exitButton.rect.height = 100;
	exitButton.action = Exit;
 
	_menuItems.push_back(playButton);
	_menuItems.push_back(exitButton);
 
	window.draw(sprite);
	window.display();
 
	return GetMenuResponse(window);
}
示例#9
0
void mainLoop() {
    //The first time you run TackFPS it will return a trash value, so get it out of the way now
    TackFPS(true);

    //Pre-emptively call the resize and draw functions to get the cycle going
    reshape(miWidth, miHeight);

    bool running = true;
    sf::Event event;
    while(running) {
        draw();
        while(window.pollEvent(event)) {
            switch(event.type) {
                case sf::Event::Closed: running = false; break;
                case sf::Event::Resized: reshape(event.size.width, event.size.height); break;
                case sf::Event::KeyPressed: keyDown(event.key.code); break;// TODO codes
                case sf::Event::MouseMoved: mouseDrag(event.mouseMove.x, event.mouseMove.y); break;
                case sf::Event::MouseButtonPressed: mousePress(event.mouseButton.button, 1, event.mouseButton.x, event.mouseButton.y); break;
                case sf::Event::MouseButtonReleased: mousePress(event.mouseButton.button, 0, event.mouseButton.x, event.mouseButton.y); break;
                case sf::Event::TextEntered: charTyped(event.text.unicode); break;
                default: cout << "unhandled event:" << event.type << endl; break;
            }
        }
        window.display();
    }
}
示例#10
0
void SplashScreen::show(sf::RenderWindow& window)
{
    sf::Image image;
    std::string imageFile = "/Users/ankithbti/Development/gameBasics/bin/pang.png";
    if (!image.loadFromFile(imageFile))
    {
        return;
    }
    sf::Texture texture;
    texture.loadFromImage(image);
    sf::Sprite sprite(texture);
    
    window.clear(sf::Color::Green);
    window.draw(sprite);
    window.display();

    sf::Event e;
    while (true)
    {
        while (window.pollEvent(e))
        {
            if (e.type == sf::Event::Closed ||
                    e.type == sf::Event::MouseButtonPressed ||
                    e.type == sf::Event::KeyPressed)
            {
                return;
            }
        }
    }
}
示例#11
0
// Represents the rules
void Rules::show(sf::RenderWindow &window)
{
	// Loads
	sf::Texture texture;
	if(texture.loadFromFile("images/Rules.png") != true) {
		return;
	}

	sf::Sprite sprite(texture);
	window.draw(sprite);
	window.display();

	sf::Event currentEvent;
	while(true)
	{
		while(window.pollEvent(currentEvent))
		{
			// Close the screen if close is clicked
			if(currentEvent.type == sf::Event::Closed) { 
				exit(0);
			}

			if(currentEvent.type == sf::Event::EventType::KeyPressed 
				|| currentEvent.type == sf::Event::EventType::Closed)
			{
				return;
			}
		}
	}
}
示例#12
0
文件: main.cpp 项目: camuschino/SFML
    void Game::render() {

        mWindow.clear();

        Game::generacion_mapa();
//
        while(!MapIsChecked){

            if(Game::mapa_valido(Game::mPlayer.getPosition().y / 50, Game::mPlayer.getPosition().x / 50)){

                this->MapIsChecked = true;

            }else{

                this->pasos_entre_objetos = 0;
                this->mIsMapGenerate = true;
                Game::generacion_mapa();
//                Game::cambiar_posicion_objectos();
            }
        }
//        mWindow.draw(mText);
//        mWindow.draw(mText2);
        mWindow.draw(mPlayer);
        mWindow.draw(mPlayerObj);
//        mWindow.draw(mPlayerObs);
        mWindow.display();

    }
示例#13
0
MainMenu::MenuResult MainMenu::Show(sf::RenderWindow & window) {
    sf::Texture texture;
    if (!texture.loadFromFile("img/mainMenu.png"))
        std::cout << "Error loading main menu image\n";
    sf::Sprite sprite(texture);

    // Play menu item coordinates
    MenuItem play_button;
    play_button.rect.top= 145;
    play_button.rect.height = 380;
    play_button.rect.left = 0;
    play_button.rect.width = 1023;
    play_button.action = Play;
    play_button.alt_key = sf::Keyboard::S;

    // Exit menu item coordinates
    MenuItem exit_button;
    exit_button.rect.left = 0;
    exit_button.rect.height = 1023;
    exit_button.rect.top = 383;
    exit_button.rect.width = 560;
    exit_button.action = Exit;
    exit_button.alt_key = sf::Keyboard::Escape;

    _menu_items.push_back(play_button);
    _menu_items.push_back(exit_button);

    window.clear();
    window.draw(sprite);
    window.display();

    return GetMenuResponse(window);
}
示例#14
0
void  cbEngine::runGame(sf::RenderWindow &window, sf::Event &event){
    stateManager sManager; //Create instance of stateManager class
    splashScreen splaScreen;


    while(window.isOpen()){
            if (runonce == true){
            std::cout << "Window open" << std::endl;
            }
            //---Do Only if Debugging---//
    // Check to see if runonce is true; if true output to console that game is starting. //
    while (debug == true){
        if (runonce != false){
            std::cout << "Starting game..." << std::endl;
            runonce = false;
        }
        break;
    }
    // End of Debug Section //

    // Loop Structure 1.Clear window (Color = black) 2. Call stateManager 3. Display window //
    eventLoop(window, e); // Call event loop Initialize it with window and Event object
    window.clear(sf::Color::White); //Clear window black
    sManager.selectState(window, event);
    window.display(); // Display everything to screen
    }
}
示例#15
0
void SplashScreen::show(sf::RenderWindow &window)
{

	sf::Texture image;
	if (image.loadFromFile("images/SplashScreen.png") != true)
		return;

	sf::Sprite sprite(image);

	window.draw(sprite);
	window.display();

	sf::Event event;
	while (true)
	{
		while (window.pollEvent(event))
		{
			if (event.type == sf::Event::EventType::KeyPressed || event.type == sf::Event::EventType::MouseButtonPressed)
				return;
			else if (event.type == sf::Event::EventType::Closed)
			{
				window.close();
				exit(0);
			}
		}
	}
}
示例#16
0
void System::pause(sf::RenderWindow &window, sf::Event event, sf::RectangleShape background) {
    std::cout << "Pause started." << std::endl;

    sf::Font font = loadFont();
    sf::Text pause("PAUSE", font, 75);
    pause.setColor(sf::Color(0, 0, 0, 200));
    pause.move(window.getSize().x / 2 - pause.getCharacterSize() * 1.5, window.getSize().y / 2 - pause.getCharacterSize());

    bool stop(false);
    while (window.waitEvent(event) && !stop) {
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::LControl) && sf::Keyboard::isKeyPressed(sf::Keyboard::Q)) {
            window.close();
        }
        switch (event.type) {
            case sf::Event::Closed:
                window.close();
                break;
            case sf::Event::KeyPressed:
                switch(event.key.code) {
                    case sf::Keyboard::Escape:
                        stop = true;
                        break;
                }
                break;
        }
        window.clear();
        window.draw(background);
        window.draw(pause);
        window.display();
    }
    std::cout << "Pause is finished." << std::endl;
}
示例#17
0
//This is the primary graphics loop
int graphicsLoop(const terrain* map) {
    image.create(map->h_map[0].size(), map->h_map.size());
    sf::Texture texture;
    texture.loadFromImage(image);
    sf::Sprite sprite(texture);
    Event event;
    bool drag = false;
    Vector2f refCrsrCoords(-1, -1);
    
    image = renderMap(map, image);
    texture.loadFromImage(image);
    
    while (window.isOpen()) {
            
        while (window.pollEvent(event)) {
            if (event.type == Event::Closed)
                return closeWindow();
            
            if (event.type == Event::KeyReleased && event.key.code == sf::Keyboard::Key::Q)
                return closeWindow();
                   
            if (event.type == Event::KeyReleased && event.key.code == sf::Keyboard::Key::Space)
                return 2;
            
            keyMove(event);
            mouseMove(event, drag, refCrsrCoords);
                      
        }

        window.clear(sf::Color::Black);
        window.draw(sprite);
        window.display();
    }
    return 0;
}
示例#18
0
文件: main.cpp 项目: strap8/SFML-Menu
void launchMenu(sf::RenderWindow &window)
{
	sf::Texture leaguePlay;
	if (!leaguePlay.loadFromFile("League Play.png"))
		window.close();


	sf::Sprite sprite_LeaguePlay(leaguePlay);

	while (window.isOpen())
	{
		sf::Event event;

		while (window.pollEvent(event))
		{
			sprite_LeaguePlay.setPosition(100, 250);

			if (checkForMouseTrigger(sprite_LeaguePlay, window))
				std::cout << "Play clicked!" << std::endl;

			switch (event.type)
			{
			case sf::Event::Closed:
				window.close();
				break;
			}

			window.clear();
			window.draw(sprite_LeaguePlay);
			window.display();
		}

	}
}
示例#19
0
MainMenu::MenuResult MainMenu::Show(sf::RenderWindow& window)
{
	//Load menu image from file
	//sf::Image image;
	//image.loadFromFile("images/mainmenu.png");
	sf::Texture texture;
	texture.loadFromFile("images/mainmenu.png");
	sf::Sprite sprite(texture);

	//Setup clickable regions

	//Play menu item coordinates
	MenuItem playButton;
	playButton.rect.top = 145;
	playButton.rect.left = 0;
	playButton.rect.height = 380 - playButton.rect.top;
	playButton.rect.width = 1023 - playButton.rect.left;
	playButton.action = Play;

	//Exit menu item coordinates
	MenuItem exitButton;
	exitButton.rect.top = 383;
	exitButton.rect.left = 0;
	exitButton.rect.height = 560 - exitButton.rect.top;
	exitButton.rect.width = 1023 - exitButton.rect.left;
	exitButton.action = Exit;

	_menuItems.push_back(playButton);
	_menuItems.push_back(exitButton);

	window.draw(sprite);
	window.display();

	return GetMenuResponse(window);
}
int main(){
	window.create(sf::VideoMode((unsigned int)windowWidth,(unsigned int)windowHeight),"MyWindow");
	window.setFramerateLimit(60);

	Setup();

	running=true;
	while(running){
		while(window.pollEvent(event)){
			if(event.type==sf::Event::Closed)
				running=false;
			else if(event.type==sf::Event::Resized)
				ReshapeWindow((float)event.size.width,(float)event.size.height);
		}
		if (currentState == MAIN)
		{
			cmain.HandleKeyboard();
			cmain.mouseControl();
		}
		else if (currentState == GAME)
		{
			cgame.HandleKeyboard();
			handleKeyboard();
		}
		Display();
		window.display();
	}
	return 0;
}
示例#21
0
	void run()
	{
		while (m_window.isOpen())
		{
			sf::Event event;
			while (m_window.pollEvent(event))
			{
				if (event.type == sf::Event::Closed)
					m_window.close();
			}

			// Update the position of the 'flashlight' to the current mouse position
			m_pos = static_cast<sf::Vector2f>(sf::Mouse::getPosition(m_window));
			m_flashlight.setPosition(m_pos);

			// Stance-out the 'flashlight' circle
			m_layer.clear();
			m_layer.draw(m_flashlight, sf::BlendMultiply);
			m_layer.display();

			m_window.clear(sf::Color::Blue);

			// Draw the layer sprite on top of the 'scene'
			m_window.draw(m_rect);
			m_window.draw(m_sprite);

			m_window.display();
		}
	}
bool SplashScreen::show(sf::RenderWindow & window)
{
	//declare variables
	sf::Texture sTexture; 
	sf::Sprite splashImage;

	//load the texture file
	if(!sTexture.loadFromFile("images//splash.png"))
		cout << "ERROR" << endl;

	//set the texture on the sprite
	splashImage.setTexture(sTexture);
	
	//deaw the background image
	window.draw(splashImage);
	window.display();

	//check if a button was clicked or if a key was pressed and if it was then return TRUE else FALSE
	sf::Event e;
	while(true)
		while(window.pollEvent(e))
		{
			if(e.type == sf::Event::KeyPressed || e.type == sf::Event::MouseButtonPressed)
				return true; //true when key pressed or mouse button pressed
			if(e.type == sf::Event::Closed)
				return false; //false when window closed
		}
}
示例#23
0
MainMenu::MenuResult MainMenu::Show(sf::RenderWindow& renderWindow)
{
	sf::Texture texture;
	texture.loadFromFile("images/menu.png");

	sf::Sprite sprite(texture);

	MenuItem playButton;
	playButton.rect.top = 145;
	playButton.rect.left = 0;
	playButton.rect.width = 1023;
	playButton.rect.height = 235;
	playButton.action = Play;

	MenuItem exitButton;
	playButton.rect.top = 383;
	playButton.rect.left = 0;
	playButton.rect.width = 1023;
	playButton.rect.height = 235;
	playButton.action = Exit;

	menuItems.push_back(playButton);
	menuItems.push_back(exitButton);

	renderWindow.draw(sprite);
	renderWindow.display();

	return GetMenuResponse(renderWindow);
}
示例#24
0
void SplashScreen::show(sf::RenderWindow& window)
{
	sf::Event event;
	while (true) {
		Game::resetDeltaTime();
		while (window.pollEvent(event))
		{
			if (event.type == sf::Event::EventType::KeyPressed || event.type == sf::Event::EventType::MouseButtonPressed) {
				Game::setGameState(Game::GameState::ShowingMenu);
				return;
			}

			if (event.type == sf::Event::Closed) {
				Game::setGameState(Game::GameState::Exiting);
				return;
			}
		}


		window.clear(sf::Color::White);

		// Draw splashscreen image
		Game::getGameObjectManager().get("splashscreen")->draw(window);
		Player* player = dynamic_cast<Player*>(Game::getGameObjectManager().get("player"));
		player->update(sf::seconds(0.0f));
		
		// Draw mouse
		player->draw(window);
		window.display();
	}
}
示例#25
0
int Screen_Editor::Run(sf::RenderWindow& App)
{
    bool running = true;
    m_editor.setBack(false);
    m_editor.setCenterCamera();
    m_editor.setSaving(false);

    while(running)
    {
       running =  m_editor.handleInput();
        if(m_editor.isBacked())
        {
            recenterCamera();
            running = false;
            return MENU;
        }
        m_editor.move();
        m_editor.save(m_link);
        m_editor.show();
        m_editor.draw();
        m_sfgui.Display(App);

        App.display();
    }
    return (SCREEN_EXIT);
}
void SplashScreen::Show(sf::RenderWindow & renderWindow)
{
	sf::Image image;
	image.loadFromFile("SplashScreen.png");
	sf::Texture texture;
	texture.loadFromImage(image);
	sf::Sprite sprite;
	sprite.setTexture(texture);
	renderWindow.draw(sprite);
	renderWindow.display();

	sf::Event event;
	while(true)
	{
		while(renderWindow.pollEvent(event))
		{
			if(event.type == sf::Event::EventType::KeyPressed 
				|| event.type == sf::Event::EventType::MouseButtonPressed
				|| event.type == sf::Event::EventType::Closed )
			{
				return;
			}
		}
	}
}
示例#27
0
int main(int argc, char ** argv)

{
    //while the window is open
    while(window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            // Close window: exit
            if (event.type == sf::Event::Closed) {
                window.close();
            }
            
            // Escape pressed: exit
            if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) {
                window.close();
            }
        }
        
        window.clear();
        drawTree(initX, initY, degree, length);
        window.display();
        
    }

    return 0;
 
}
示例#28
0
TitleMenu::MenuResult TitleMenu::Show(sf::RenderWindow &window)
{
  // Load menu items from an image
  sf::Texture title_image;
  title_image.loadFromFile(image_path);
  sf::Sprite title_sprite(title_image);

  // Set up click able regions

  // Play menu item coordinates
  MenuItem playButton;
  playButton.rect.left = 0;
  playButton.rect.width = 1023;
  playButton.rect.top = 130;
  playButton.rect.height = 220;
  playButton.action = ePlay;

  // Exit menu item coordinates
  MenuItem exitButton;
  exitButton.rect.left = 0;
  exitButton.rect.width = 1023;
  exitButton.rect.top = 350;
  exitButton.rect.height = 167;
  exitButton.action = eExit;

  _menuItems.push_back(playButton);
  _menuItems.push_back(exitButton);

  window.draw(title_sprite);
  window.display();

  return GetMenuResponse(window);
}
示例#29
0
void SplashScreen::Show(sf::RenderWindow& window, std::string& filepath , InputHandler &input)
{	
	splashTexture.loadFromFile(filepath);
	splashSprite.setTexture(splashTexture);
	splashSprite.setScale((float)window.getSize().x / splashSprite.getTexture()->getSize().x, (float)window.getSize().y / splashSprite.getTexture()->getSize().y);
	splashSprite.setColor(sf::Color(splashSprite.getColor().r, splashSprite.getColor().g, splashSprite.getColor().b,0));

	fadeIn = true;
	stopSplash = false;

	
	while(true)
	{
		if(input.clicked(window) || stopSplash)
		{
			break;
		}

		window.clear();
		
		if(fadeIn == true)
		{
			fadeSpriteIn(window, splashSprite);
		}else{
			fadeSpriteOut(window,splashSprite);
		}
		
		window.draw(splashSprite);
		window.display();
		
	}
}
示例#30
0
    // Il metodo `run` farà partire il game loop.
    void run()
    {
        while(true)
        {
            window.clear(sf::Color::Black);

            if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Escape)) break;

            // Il tasto `P` gestirà la pausa.
            if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::P))
            {
                // Prima di mettere/togliere la pausa, controlliamo
                // se il tasto era già stato pressato.
                if(!pausePressedLastFrame)
                {
                    if(state == State::Paused)
                        state = State::InProgress;
                    else if(state == State::InProgress)
                        state = State::Paused;
                }

                pausePressedLastFrame = true;
            }
            else
                pausePressedLastFrame = false;

            // Il tasto `R` farà ricominciare il gioco.
            if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::R)) restart();

            // Se il gioco è in pausa, non aggiorneremo i game
            // object.
            if(state != State::Paused)
            {
                ball.update();
                paddle.update();
                for(auto& brick : bricks)
                {
                    brick.update();
                    solveBrickBallCollision(brick, ball);
                }

                bricks.erase(
                    std::remove_if(std::begin(bricks), std::end(bricks),
                        [](const auto& mBrick)
                        {
                            return mBrick.destroyed;
                        }),
                    std::end(bricks));

                solvePaddleBallCollision(paddle, ball);
            }

            ball.draw(window);
            paddle.draw(window);
            for(auto& brick : bricks) brick.draw(window);

            window.display();
        }
    }