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); }
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); }
/// <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); } } }
public void AddTouches(Center center) { Touches.Add(center); }
public void Update(PTouch updatePoint) { BaseShape.AddUpdatePoint(updatePoint.Position); Touches.Add(updatePoint); }
public virtual void Initialize(PTouch initPoint) { BaseShape.AddStartPoint(initPoint.Position); Touches.Add(initPoint); }