コード例 #1
0
 public void GenerateFrameRate(FrameRate fr = null)
 {
     if (fr == null)
     {
         fr = new FrameRate();
     }
     FrameRate = fr;
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
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);
        }
コード例 #5
0
ファイル: GameLoop.cs プロジェクト: alex-polosky/EntityEngine
        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();
        }
コード例 #6
0
 public void GenerateFrameRate(FrameRate fr = null)
 {
     if (fr == null)
         fr = new FrameRate();
     FrameRate = fr;
 }