Esempio n. 1
0
        internal PhysicsTime()
        {
            m_stopwatch = new Stopwatch();
            m_stopwatch.Start();

            m_deltaTime  = 0.0f;
            m_timePassed = 0.0f;

            m_lastPhysicsUpdateCheck = 0.0f;
            m_pupsCheck = 0.0f;
            m_frames    = 0;

            if (Instance == null)
            {
                Instance = this;
            }
        }
Esempio n. 2
0
        public PhysicsEngine(bool a_threaded)
        {
#if DEBUG_INFO
            Debug.Assert(Instance == null);
#endif
            Instance = this;

            m_threaded = a_threaded;

            m_shutDown = false;
            m_joinable = false;
            m_destroy  = false;

            m_inputQueue    = new ConcurrentQueue <IPObject>();
            m_disposalQueue = new ConcurrentQueue <IPObject>();

            m_collisionObjects = new List <CollisionObject>();

            m_time = new PhysicsTime();

            if (m_threaded)
            {
                m_thread = new Thread(Run)
                {
                    Name     = "Physics",
                    Priority = ThreadPriority.AboveNormal
                };
                m_thread.Start();
            }
            else
            {
                m_thread = null;

                StartUp();
            }
        }