Btw, I have trouble with animation and logic times, the animation plays too fast and when I set the clock time to more slowly, it breaks the logic times, and if I use two clocks one for logic one for drawing, it gets ugly and not smooth, what should I do?
void PacmanGame::run() {
sf::Clock drawClock;
sf::Time drawframeTime = sf::milliseconds(150);
sf::Clock logicClock;
sf::Time logicframeTime = sf::milliseconds(50);
while (window.isOpen()) {
sf::Time elapsedDraw = drawClock.getElapsedTime();
sf::Time elapsedLogic = logicClock.getElapsedTime();
if (elapsedLogic > logicframeTime) {
logic();
logicClock.restart();
}
if (elapsedDraw > drawframeTime) {
draw();
drawClock.restart();
}
}
}