So, I have this game that im currently working on
(link in spoiler:
the normal screen size for this game is 800 by 600.
it uses sf::view (400 by 300 pixels) and sf::window
it uses a flexible timestep
it runs fine using only 3-6& cpu and few %memory
but if i toggle fullscreen to true (or if i start in full screen) it slows down a lot.
but also, the animation gets slower still and thus out of sync.
(eg, walking becomes sliding)
toggeling fullscreen back off again solves the problem instantly...
I've tried running as administrator and searching with all my google'fu but no solution so far.
the toggleFullscreen code is:
void Window::ToggleFullScreen() {
m_isFullscreen = !m_isFullscreen;
Destroy();
Create();
}
if it has any interest the animation code is called right after the units have updated their current location and status.
void Agent::animate() {
_currentFrame+= (_speed / 160);
if (_aniAtt) {
if (_currentFrame > _attFrames) _currentFrame = 0;
_animation = 3;
}
else if (_aniJump) {
if (_yVel < 0) _currentFrame = 0;
else _currentFrame = 1;
_animation = 2;
}
else if (_aniWalk) {
if (_currentFrame > _walkFrames) _currentFrame = 0;
_animation = 1;
}
//standing
else{
if (_currentFrame > _standFrames) _currentFrame = 0;
_animation = 0;
}
if (_dirLeft) _animation += 6;
}
_animation corresponds to a specific row and _current frame to the column in a texture.
a sprite is set to the corresponding coordinates and then rendered to the window.
_speed is the movement speed of the characters.
again, the cpu, memory and gpu usage remains roughly the same, and never exceeds 12% but both the program in general slows down and the animation, the animation just more than the rest.
any suggestions?