Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

std::cout... statement being skipped

$
0
0
Hello coders, first post and more to come! :)/>

So I'm completely stumped. To start, here is the code:


Graphics::Graphics(void)
{
	window = new sf::RenderWindow(sf::VideoMode(800,600,32), "Map Editor");
	loadImages();
	loadSprites();
	clock.Reset();
	elapsedTime = 0.f;
}

void Graphics::run()
{
	if(clock.GetElapsedTime() >= elapsedTime + 1.f)
	{
		clear();
		draw();
		display();
		std::cout << "test";
		elapsedTime += 1.f;
	}
	std::cout << elapsedTime << std::endl;
}




Quick note: run() is being executed in a never ending loop.

Problem: "test" should be output to the terminal once every second. It is not but the line below it is being executed. I know the line below it is being executed because the cout statement after the if statement is showing that elapsedTime is being incremented once every second. (at least it seems like it is being incremented once a second when watching the terminal) I'm assuming the lines above it are being executed too.

Question: Why isn't "test" output to the terminal?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>