Example #1
0
        public void Update(float tpf)
        {
            if (GameWindowState != WindowState.IN_GAME)
            {
                return;
            }

            totalTime += tpf;

            ShowStatistics(tpf);

            StateMgr.Update(tpf);

            if (!stopUpdating)
            {
                AddObjectsReadyToAdd();

                UpdateSceneObjects(tpf);
                RemoveObjectsMarkedForRemoval();

                CheckCollisions(tpf);
                RemoveObjectsMarkedForRemoval();

                UpdateGeomtricState();

                area.RunRender();
            }
        }
Example #2
0
    void Update()
    {
        ulong dtTime = TimeMgr.SinceTimeMs(mLastUpdateTime);

        mLastUpdateTime = TimeMgr.CurTimeMs;

        SocketMgr.Update();
        StateMgr.Update();
        ResMgr.Update();
        HttpMgr.Update();
        if (null != GameSceneMgr)
        {
            GameSceneMgr.Update(dtTime);
        }
        TimerManager.Instance.Update(dtTime);
    }
Example #3
0
        public void Run()
        {
            Stopwatch sw  = new Stopwatch();
            float     tpf = 0;

            sw.Start();

            long elapsedMs = 0;

            while (!shouldQuit)
            {
                tpf = sw.ElapsedMilliseconds / 1000.0f;

                sw.Restart();

                ProcessMessages();

                ProcessActionQueue();

                StateMgr.Update(tpf);

                if (tpf >= 0.001 && isInitialized)
                {
                    Update(tpf);
                }

                elapsedMs = sw.ElapsedMilliseconds;
                if (elapsedMs < SharedDef.MINIMUM_UPDATE_TIME)
                {
                    Thread.Sleep((int)(SharedDef.MINIMUM_UPDATE_TIME - elapsedMs));
                }

                Time += tpf;
            }

            sw.Stop();

            CleanUp();
        }