예제 #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);
        }
예제 #3
0
 /// <summary>
 /// <see cref="ISingleTouchObserver.OnTouchMoved" />
 /// </summary>
 public void OnTouchMoved(Touch touch)
 {
     if (Touches.Contains(touch))
     {
         if (Surface != null && Tool != null)
         {
             Tool.OnTouchMoved(Surface, touch);
         }
     }
     else if (IsAllowedToDrawWithTouch == null || IsAllowedToDrawWithTouch(touch))
     {
         if (Surface != null && Tool != null)
         {
             Touches.Add(touch);
             if (Touches.Count == 1 && DrawingBegan != null)
             {
                 DrawingBegan(this);
             }
             Tool.OnTouchBegan(Surface, touch);
         }
     }
 }
예제 #4
0
 public void AddTouches(Center center)
 {
     Touches.Add(center);
 }
예제 #5
0
 public void Update(PTouch updatePoint)
 {
     BaseShape.AddUpdatePoint(updatePoint.Position);
     Touches.Add(updatePoint);
 }
예제 #6
0
 public virtual void Initialize(PTouch initPoint)
 {
     BaseShape.AddStartPoint(initPoint.Position);
     Touches.Add(initPoint);
 }