Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - gualtyphone

Pages: [1]
1
DotNet / [SOLVED] .NET DispatchEvents problem
« on: December 08, 2018, 07:32:27 pm »
SOLUTION:
Updated csfml libraries to 2.5. issue disappeared

Hey fellow Devs,
So I'm working on a project in SFML.NET and I did the standard sfml game loop:
       while (_renderer.Window.IsOpen)
            {
                totalTimeElapsed = clock.ElapsedTime.AsSeconds();
                deltaTime = totalTimeElapsed - previousTimeElapsed;

                totalTimeBeforeUpdate += deltaTime;

                if (totalTimeBeforeUpdate >= Renderer.TIME_TO_UPDATE)
                {
                    _renderer.Window.DispatchEvents();

                    _time.Update(totalTimeBeforeUpdate, clock.ElapsedTime.AsSeconds());

                    _renderer.Clear();

                    Update(_time);
                    Draw(_time);

                    fps.DisplayedString = (1.0f / totalTimeBeforeUpdate).ToString();
                    _renderer.Window.Draw(fps);

                    _renderer.EndDraw();

                    totalTimeBeforeUpdate = 0f;
                }

                previousTimeElapsed = totalTimeElapsed;
            }
 

but I'm getting some strange 'slower' frames, every second or so, Window.DispatchEvents() is taking much longer to run (0.1s vs the normal 0.01s) which causes the application to be jittery... I've tried removing all of my event bindings and this is still happening...
Does anyone know why it might be the case?

Pages: [1]
anything