示例#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 Update(GameTime gameTime)
        {
            var state = TouchPanel.GetState();

            Touches.Clear();
            for (int i = 0; i < state.Count; i++)
            {
                if (state[i].State > 0)
                {
                    Touches.Add(Camera.GetWorldPosition(state[i].Position));
                }
            }

            base.Update(gameTime);
        }