public void GenerateFrameRate(FrameRate fr = null)
 {
     if (fr == null)
     {
         fr = new FrameRate();
     }
     FrameRate = fr;
 }
 public bool Stop()
 {
     if (running)
     {
         FrameRate.Stop();
         running = false;
         paused  = false;
         OnStopEvent(this, new Events.StopEventArgs {
         });
         return(true);
     }
     else
     {
         OnErrorEvent(this, new Events.ErrorEventArgs {
             errorLevel = Events.ErrorEventArgs.ErrorLevel.Warning,
             message    = "Tried to stop engine while engine was not running"
         });
         return(false);
     }
 }
 public bool Start()
 {
     if (!running)
     {
         running = true;
         paused  = false;
         FrameRate.Start();
         OnStartEvent(this, new Events.StartEventArgs {
         });
         return(true);
     }
     else
     {
         OnErrorEvent(this, new Events.ErrorEventArgs {
             errorLevel = Events.ErrorEventArgs.ErrorLevel.Warning,
             message    = "Tried to start engine while engine was already running"
         });
         return(false);
     }
 }
        private bool engineFrameTick()
        {
            if (!IsEngineReady)
            {
                ErrorEvent(this, new Events.ErrorEventArgs {
                    errorLevel = Events.ErrorEventArgs.ErrorLevel.Error,
                    message    = "Engine not in ready state"
                });
                return(false);
            }
            if (!FrameRate.IsRunning)
            {
                ErrorEvent(this, new Events.ErrorEventArgs {
                    errorLevel = Events.ErrorEventArgs.ErrorLevel.Error,
                    message    = "Engine's FrameRate object has not been started"
                });
                return(false);
            }

            OnEFTPreFrame(this, new Events.EFTPreFrameEventArgs {
            });
            FrameRate.StartFrame();

            OnEFTProcessFrame(this, new Events.EFTProcessFrameEventArgs {
            });
            //if (FrameSystemUpdate)
            //    OnETFSystemUpdate(sender, e);
            //if (FrameRenderPhysics)
            //    OnETFRenderPhysics(sender, e);
            //if (FrameRenderDraw)
            //    OnETFRenderDraw(sender, e);

            FrameRate.EndFrame();
            OnEFTPostFrame(this, new Events.EFTPostFrameEventArgs {
            });

            return(true);
        }
Beispiel #5
0
        public void RunLoop()
        {
            if (frameRate == null)
                frameRate = new FrameRate();

            frameRate.Start();
            while (NextWindowFrame())
            {
                frameRate.StartFrame();
                if (PreProcess != null)
                    PreProcess(this, new EventArgs());

                if (ProcessFrame != null)
                    ProcessFrame(this, new EventArgs());

                if (PostProcess != null)
                    PostProcess(this, new EventArgs());
                frameRate.EndFrame();
            }
            frameRate.Stop();
        }
 public void GenerateFrameRate(FrameRate fr = null)
 {
     if (fr == null)
         fr = new FrameRate();
     FrameRate = fr;
 }