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.


Messages - gualtyphone

Pages: [1]
1
DotNet / Re: .NET DispatchEvents problem
« on: December 09, 2018, 03:00:33 pm »
UPDATE:
To eliminate any and all confusion I made a new project and the most basic implementation of a game loop I could
namespace TestSFML
{
    class MainClass
    {
        private static RenderWindow _window;
        public static void Main(string[] args)
        {
            _window = new RenderWindow(new VideoMode(800, 600), "SFML window");
            _window.SetVisible(true);
            _window.Closed += new EventHandler(OnClosed);
            Clock clock = new Clock();
            float timePassed = 0f;
            float previousTimePassed = 0f;
            float dt = 0;
            while (_window.IsOpen)
            {
                timePassed = clock.ElapsedTime.AsSeconds();
                dt = timePassed - previousTimePassed;
                _window.DispatchEvents();
                _window.Clear(Color.Red);
                Debug.WriteLine((1.0f / dt).ToString());
                _window.Display();
                previousTimePassed = timePassed;
            }
        }

        private static void OnClosed(object sender, EventArgs e)
        {
            _window.Close();
        }
    }
}
 

And the issue is still present on multiple machines... Don't really know where to go from here...

2
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