Beispiel #1
0
        protected virtual void InvokeNextFrame(int frame)
        {
            NextFrameEvent handler = OnNextFrame;

            if (handler != null)
            {
                handler.Invoke(frame);
            }
        }
        private void MainGameLoop()
        {
            //Clock clock = new Clock();
            _sfmlWindow.SetFramerateLimit(30);
            _sfmlWindow.SetVerticalSyncEnabled(false);

            var nextFrameEvent = new NextFrameEvent();

            while (_sfmlWindow.IsOpen && !exitGame)
            {
                //var timeElapsed = clock.ElapsedTime;
                DeleteMarkedEntities();
                _sfmlWindow.DispatchEvents();
                BroadcastEvent(nextFrameEvent);
            }
        }
Beispiel #3
0
 public void SendTimeSignal()
 {
     NextFrameEvent?.Invoke();
     Thread.Sleep(16); // 60 FPS
 }
Beispiel #4
0
 public void SendTimeSignal()
 {
     NextFrameEvent?.Invoke();
 }