Hi,
I'm porting Artemis:
gamadu.com/artemis/ to C++ and I am pretty sure I have some leaks left that I'm trying to debug. I decided to make a test game with Artemis and SFML. But I've noticed something strange that comes from SFML:
This is my while loop:
while (window.isOpen()) {
//dt = deltaClock.restart();
sf::Event event;
while (window.pollEvent(event)) {
// Close window : exit
if (event.type == sf::Event::Closed)
window.close();
}
world.loopStart();
world.setDelta(deltaClock.restart().asSeconds());
playerJoy.process();
movsys.process();
collider.process();
// Clear screen
window.clear();
//updateSpriteSystem
spritesys.process();
// Update the window
window.display();
}
I look into my taskmanager and notice that my applications memory keeps rising. At first I thought I did something completely wrong with my library. So I took out my stuff leaving the SFML stuff in my test run. At this point memory was still going up.
Now I tried the reverse. And I left out:
sf::Event event;
while (window.pollEvent(event)) {
// Close window : exit
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.display();
}
( yes the while (window.isOpen()) is still present at this point)
And my memory stagnates at 27.30 kb. It doesn't go up or down. It stays exactly the same.
Unfortunately I can't give you any debug data. I simply observed the taskmanager.
It only goes up when using the windows method for pollEvent and clear (or display). I have no idea if other methods of the RenderWindow cause the same .
I hope someone can clarify this.
Edit:
I think there is something with the PollEvent. If I leave out that complete while loop for event polling memory goes up until a certain point and then stagnates. But if I put that while loop back memory continues to go up.
Also I'm using a gamepad to control certain entities. And sometimes my application lags because of it. I test my game for a while. Unplug my controller. Start my application again. And it stutters. Also using a lot of CPU cycles. While the controller is unplugged, I'm still checking with sf::joystick if a button is pressed.
Is this my doing or is there a flaw in the SFML implementation for gamepads/joysticks?
~Sidar