Ejemplo n.º 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++;

            //Update game objects here
            world.UpdateTransforms();
            world.Update(deltaTime);
            collisionManager.Update();
        }
Ejemplo n.º 2
0
        public void Update()
        {
            //calculates delta time
            lastTime    = currentTime;
            currentTime = stopwatch.ElapsedMilliseconds;
            deltaTime   = (currentTime - lastTime) / 1000.0f;
            timer      += deltaTime;
            if (timer >= 1)
            {
                fps    = frames;
                frames = 0;
                timer -= 1;
            }
            frames++;

            //goes through the heirarchy and updates all the objects
            world.UpdateTransforms();
            world.Update(deltaTime);
            //checks all collisions
            collisionManager.Update();
        }