コード例 #1
0
        protected override void Update(GameTime gameTime)
        {
            var currentUpdate = DateTime.Now;
            var delta         = (currentUpdate - previousUpdate).TotalSeconds;

            if (delta > 0.25)
            {
                delta = 0.25;
            }
            previousUpdate = currentUpdate;

            accumulator = accumulator + delta;


            Touches.Clear();
            var mouse = Mouse.GetState();

            if (mouse.LeftButton == ButtonState.Pressed)
            {
                Touches.Add(Camera.GetWorldPosition(mouse.Position.ToVector2()));
            }

            if (accumulator >= dt)
            {
                base.Update(gameTime);
                accumulator = accumulator - dt;
            }
            else
            {
                SuppressDraw();
            }

            FrameCounter.Update(accumulator);
        }
コード例 #2
0
 protected override void Draw(GameTime gameTime)
 {
     FrameCounter.Update(gameTime.ElapsedGameTime.TotalSeconds);
     base.Draw(gameTime);
 }