title: Doing something after elapsed time C++ SFML 2
body: <p>I have a clock and timer in SFML and it measures seconds. I'm trying to make the next action happen after a certain amount of seconds elapsed ( specifically 4) Here's my code</p>
  
  <pre><code>    #include "stdafx.h"
  #include "SplashScreen1.h"
  
  using namespace std;
  
  void SplashScreen1::show(sf::RenderWindow &amp; renderWindow)
  {
      sf::Clock clock;
      sf::Time elapsed = clock.getElapsedTime();
  
      sf::Texture splash1;
      sf::SoundBuffer buffer;
      sf::Sound sound;
  
      if(!buffer.loadFromFile("sounds/splah1.wav"))
      {
          cout &lt;&lt; "Articx-ER-1C: Could not find sound splah1.wav" &lt;&lt; endl;
      }
  
      sound.setBuffer(buffer);
  
      if(!splash1.loadFromFile("textures/splash1.png"))
      {
          cout &lt;&lt; "Articx-ER-1C: Could not find texture splash1.png" &lt;&lt; endl;
      }
  
      sf::Sprite splashSprite1(splash1);
  
      sound.play();
      renderWindow.draw(splashSprite1);
      renderWindow.display();
  
      sf::Event event;
  
      while(true)
      {
          while(renderWindow.pollEvent(event))
          {
              //if(event.type == sf::Event::EventType::KeyPressed
              if(elapsed.asSeconds() &gt;= 4.0f)
              {
                  //|| event.type == sf::Event::EventType::MouseButtonPressed)
                  //|| event.type == sf::Event::EventType::Closed
                  return;
              }
  
              if(event.type == sf::Event::EventType::Closed)
                  renderWindow.close();
          }
      }
  }
  </code></pre>
  
  <p>It does nothing after 4 seconds. I believe I'm gathering the elapsed time incorrectly. I know my return is working because I tried it with mouse input and it worked fine.</p>