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
And the issue is still present on multiple machines... Don't really know where to go from here...
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();
}
}
}
{
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...