Exemplo n.º 1
0
        void OnMouseDragged(object sender, MouseEventArgs e)
        {
            var delta       = e.Position - dragStartPosition;
            var deltaInView = ContinuousViewportCoordinates.FromPixels(GameRendering.TileSize, delta.X, delta.Y);

            GameRendering.CenterPoint = viewportPosition - deltaInView;
        }
Exemplo n.º 2
0
        void OnMouseDragFinished(object sender, MouseEventArgs e)
        {
            var delta       = e.Position - dragStartPosition;
            var deltaInView = ContinuousViewportCoordinates.FromPixels(GameRendering.TileSize, delta.X, delta.Y);

            Debug.WriteLine("Finished move: " +
                            delta +
                            " - " +
                            (GameRendering.CenterPoint - deltaInView));
        }
Exemplo n.º 3
0
        void OnMouseMoved(object sender, MouseEventArgs e)
        {
            var pointedPosition    = MouseRelativeToCenter(e.Position);
            var mouseInScreenScale =
                ContinuousViewportCoordinates.FromPixels(GameRendering.TileSize, pointedPosition.X, pointedPosition.Y);
            var posInScreenOrigin = GameRendering.CenterPoint + mouseInScreenScale;

            var mc = GameRendering.ScreenPositionToMapCoordinate(posInScreenOrigin.ToViewCoordinate());

            GameRendering.MapNavigator.NavigateTo(GridDirection.None, mc, out mc);
            TileUnderMouseCursor = mc;
        }