Пример #1
0
        /// <summary>
        /// Stop frame measurement.
        /// </summary>
        public void StopFrame()
        {
            StopwatchFrame.Stop();

            // add elapsed time of this frame
            Elapsed += StopwatchFrame.Elapsed;

            // increment frame count to respectively keep ratio
            FrameCount++;

            // check if we need to do average measurement
            var updateElapsed = StopwatchUpdate.Elapsed;

            if (updateElapsed >= UpdateRate)
            {
                // calc averages
                FpsRender = FrameCount / Elapsed.TotalSeconds;
                FpsGlobal = FrameCount / updateElapsed.TotalSeconds;

                // reset
                StopwatchUpdate.Restart();
                Elapsed    = TimeSpan.Zero;
                FrameCount = 0;
            }
        }
Пример #2
0
        //---------------------------------------------------------------------
        async Task _update()
        {
            float tm = (float)StopwatchUpdate.Elapsed.TotalSeconds;

            StopwatchUpdate.Restart();

            if (EtPlayer != null)
            {
                EtPlayer.update(tm);

                if (CouchbaseQue != null)
                {
                    Tm4CouchbaseQue += tm;
                    if (Tm4CouchbaseQue > 1f)
                    {
                        Tm4CouchbaseQue = 0f;
                        await CouchbaseQue.queryThenCacheAllData();
                    }

                    if (CouchbaseQue.Count > 0)
                    {
                        var que_data = await CouchbaseQue.popData();

                        if (que_data.type > 0)
                        {
                            var co_player = EtPlayer.getComponent <CellPlayer <DefPlayer> >();
                            await co_player.recvCouchbaseQueData(que_data);
                        }
                    }
                }
            }
        }
Пример #3
0
        /// <inheritdoc />
        public void Dispose()
        {
            StopwatchUpdate.Stop();
            StopwatchUpdate = default;

            StopwatchFrame.Stop();
            StopwatchFrame = default;
        }
Пример #4
0
 private void DisposeStopwatchUpdate()
 {
     if (StopwatchUpdate == null)
     {
         throw new NullReferenceException("StopwatchUpdate in Engine\\Render\\FramesPerSecondCounter is NULL");
     }
     StopwatchUpdate.Stop();
     StopwatchUpdate = default;
 }
Пример #5
0
        //---------------------------------------------------------------------
        async Task _update()
        {
            float tm = (float)StopwatchUpdate.Elapsed.TotalSeconds;

            StopwatchUpdate.Restart();

            if (EtPlayer != null)
            {
                EtPlayer.update(tm);
            }
        }
Пример #6
0
        public void StopFrame()
        {
            StopwatchFrame.Stop();
            Elapsed += StopwatchFrame.Elapsed;
            FrameCount++;

            var updateElapsed = StopwatchUpdate.Elapsed;

            if (updateElapsed >= UpdateRate)
            {
                FramesPerSecondForRender = FrameCount / Elapsed.TotalSeconds;
                FramesPerSecondForGlobal = FrameCount / updateElapsed.TotalSeconds;

                StopwatchUpdate.Restart();
                Elapsed    = TimeSpan.Zero;
                FrameCount = 0;
            }
        }
Пример #7
0
 public void AddStopwatchUpdateListener(StopwatchUpdate stopwatchUpdate)
 {
     stopwatchUpdateListeners += stopwatchUpdate;
 }