Exemplo n.º 1
0
        public void OnMouseDown(PointF screenLocation)
        {
            switch (CreateObjectState)
            {
            case CreateObjectState.None:
                break;

            case CreateObjectState.CreateRectangle:
                _mouseMoving.Active       = true;
                _mouseMoving.FirstCorner  = GetPointByUnit(_convertWorldView.GetWorldPointF(screenLocation));
                _mouseMoving.SecondCorner = _mouseMoving.FirstCorner;
                _mouseMoving.SizingValue  = PointSizeValueHelper.FromHV(1, 1);
                CreateRectangleObject();
                break;

            case CreateObjectState.CreateObjectFocused:
                GameObject gameObject = new GameObject();
                gameObject.ObjectCategory = @interface.FocusedObjectCategory;
                gameObject.Location       = @interface.FocusedObjectCategoryLocation.ToPoint();
                gameObject.Size           = @interface.FocusedObjectCategory.ObjectCategoryImage.Size;
                gameObject.HasImage       = true;
                gameObject.Resizeable     = true;
                gameObject.Movable        = true;
                gameObject.ObjectImage    = @interface.FocusedObjectCategory.ObjectCategoryImage;
                @interface.AddGameObject(gameObject);
                break;
            }
        }
        public void OnMouseDown(Point screenLocation)
        {
            var pt       = _convertWorldView.GetWorldPointF(screenLocation).ToPoint();
            int rowIndex = pt.Y / @interface.TileHeight;
            int colIndex = pt.X / @interface.TileWidth;

            int tileIndex = @interface.TilesModel.Matrix[rowIndex, colIndex];

            int rowTilesheetIndex = tileIndex / @interface.TilesModel.TilesheetColumns;
            int colTilesheetIndex = tileIndex % @interface.TilesModel.TilesheetColumns;

            @interface.SelectTile(rowTilesheetIndex, colTilesheetIndex);
        }
Exemplo n.º 3
0
        public static Point GetWorldPoint(this IConvertWorldView t, PointF viewLocation)
        {
            PointF p = t.GetWorldPointF(viewLocation);

            return(new Point((int)p.X, (int)p.Y));
        }