Пример #1
0
        public static void UpdateTiming()
        {
            uint oldTime = App.Timing.Timer;

            App.Timing.Timer = Agk.GetMilliseconds();
            App.Timing.Delta = App.Timing.Timer - oldTime;

            int oldPause = App.Timing.PauseState;

            if (App.Timing.PauseHold == 0)
            {
                App.Timing.PauseState = 0;
            }
            else
            {
                App.Timing.PauseState = 1;
                if (oldPause == 0)
                {
                    App.Timing.PauseMark = App.Timing.Timer;
                }
                else
                {
                    App.Timing.PauseElapsed = (uint)Agk.Abs(App.Timing.Timer - App.Timing.PauseMark);
                }
            }

            if (App.Timing.PauseState == 2)
            {
                //pause ended and elapsed time has been applied, clear down
                App.Timing.PauseState   = 0;
                App.Timing.PauseMark    = 0;
                App.Timing.PauseElapsed = 0;
            }

            if (App.Timing.PauseState == 0 && oldPause == 1)
            {
                //pause ended, resume all updates but keep the elapsed time available for paused updates to adjust against elapsed times.
                App.Timing.PauseState = 2;
                Hardware.Mouse.MoveX  = 0.0f;
                Hardware.Mouse.MoveY  = 0.0f;
                Hardware.Mouse.MoveZ  = 0.0f;
            }
        }