Example #1
0
        public void Update()
        {
            lastTime    = currentTime;
            currentTime = stopwatch.ElapsedMilliseconds;
            deltaTime   = (currentTime - lastTime) / 1000.0f;
            timer      += deltaTime;
            if (timer >= 1)
            {
                fps    = frames;
                frames = 0;
                timer -= 1;
            }
            frames++;
            CollisionManager.CheckCollision();
            m_level.Update(deltaTime);
            m_level.UpdateTransforms();

            //Update game objects here
        }
Example #2
0
        public void Update()
        {
            #region DeltaTime
            lastTime    = currentTime;
            currentTime = stopwatch.ElapsedMilliseconds;
            deltaTime   = (currentTime - lastTime) / 1000.0f;
            timer      += deltaTime;
            if (timer >= 1)
            {
                fps    = frames;
                frames = 0;
                timer -= 1;
            }
            frames++;
            #endregion

            //Update game objects here

            m_Level.Update(deltaTime);
            m_Level.UpdateTransforms();

            //Check collision after all objects have been updated
            CollisionManager.CheckCollision();
        }