Ich versuche mich gerade an SFML.Net. Aber schon bei den Basics scheitert es. Der grundlegendste MainLoop sieht wie folgt aus
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
| using SFML.Graphics; using SFML.Window;
public class Program { RenderWindow window;
public static void Main() { window = new RenderWindow(new VideoMode(768, 1024), "Program"); window.Closed += Window_Closed;
while (window.isOpen) { window.DispatchEvents(); window.Clear(); window.Display(); } }
private void Window_Closed(object sender, System.EventArgs e) { window.Close(); } } |
Das Problem ist die Methode window.DispatchEvents(). Sie ist nämlich solange aktiv, wie Events beim Fenster ankommen. Das Bewegen des Fensters ist aber ein Event, dass über mehrere Frames oder Sekunden hinausgeht. Wenn also das Fenster bewegt wird, wird währenddessen nicht gerendert und die frameTime steigt ins "Unermessliche". Danach rattern die DrawCalls nur so durch egal auf welche FrameRate man abzielt.
Bei meiner Recherche hab ich nur die Idee gefunden, die Methode in einen anderen Thread auszulagern, aber wenn ich das versuche werden gar keine Events mehr erkannt.