I am writing some code that will display a makeshift SplashScreen however the sf::Clock module doesnt appear to be working in the way that I had hoped.
I have run the following code:
sf::Event splashEvent;
int eventCount = 0;
sf::Clock timer;
while (true)
{
if (eventCount == 0)
{
window.clear(sf::Color::White);
window.draw(companyLogoSprite);
window.display();
}
else if (eventCount == 0 && timer.getElapsedTime().asMilliseconds() >= 10)
{
printf("Hello/n");
timer.restart();
window.clear(sf::Color::White);
window.draw(companyLogoSprite);
window.display();
}
if (eventCount == 1)
{
window.clear(sf::Color::White);
window.draw(gameLogoSprite);
window.display();
}
if (eventCount == 2)
return;
while (window.pollEvent(splashEvent))
{
if (splashEvent.type == sf::Event::EventType::KeyPressed
|| splashEvent.type == sf::Event::EventType::MouseButtonPressed)
eventCount++;
}
}
And yet at no point has the console said "Hello". What am I doing wrong? I would be glad of assistance.
(Note that any recommendations on how I have gone about writing this are also very much appreciated)