Esempio n. 1
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();
        }
Esempio n. 2
0
        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);
        }