Esempio n. 1
1
        public TileCanvas(TileLayer tileLayer)
        {
            TileLayer = tileLayer;

            //Init the textures array
            Size texSize = new Size(MAX_TEXTURE_SIZE - (MAX_TEXTURE_SIZE % TileLayer.Definition.Grid.Width), MAX_TEXTURE_SIZE - (MAX_TEXTURE_SIZE % TileLayer.Definition.Grid.Height));

            Size maxSize = new Size(TileLayer.Definition.Grid.Width * TileLayer.TileCellsX, TileLayer.Definition.Grid.Height * TileLayer.TileCellsY);

            // TODO: Clip the dimensions of the tiles that draw over the edges of the level.
            Textures = new List<TextureInfo>();
            for (int i = 0; i < maxSize.Width; i += texSize.Width)
            {
                for (int j = 0; j < maxSize.Height; j += texSize.Height)
                {
                    RenderTarget2D tex = new RenderTarget2D(
                        Ogmo.EditorDraw.GraphicsDevice,
                        Math.Min(maxSize.Width - i, texSize.Width),
                        Math.Min(maxSize.Height - j, texSize.Height));
                    Textures.Add(new TextureInfo(tex, new Point(i, j)));
                }
            }

            RefreshAll();
        }
Esempio n. 2
0
        public TileDrawAreaAction(TileLayer tileLayer, Point at, Size size, int[] setTo)
            : base(tileLayer)
        {
            this.size = size;
            this.setTo = setTo;

            this.CalculateForLocation(at);
        }
        public TilePasteSelectionAction(TileLayer tileLayer, Rectangle area, int[,] data)
            : base(tileLayer)
        {
            newData = data;
            this.area = area;

            this.area.X = Math.Min(area.X, tileLayer.TileCellsX - area.Width);
            this.area.Y = Math.Min(area.Y, tileLayer.TileCellsY - area.Height);
        }
Esempio n. 4
0
        public TileClipboardItem(Rectangle area, TileLayer layer)
            : base()
        {
            Area = area;

            Data = new int[Area.Width, Area.Height];
            for (int i = 0; i < Area.Width; i++)
                for (int j = 0; j < Area.Height; j++)
                    Data[i, j] = layer.Tiles[i + Area.X, j + Area.Y];
        }
Esempio n. 5
0
        public TileDrawAction(TileLayer tileLayer, Point at, int setTo)
            : base(tileLayer)
        {
            this.setTo = setTo;

            draw = new List<Point>();
            draw.Add(at);

            was = new List<int>();
        }
Esempio n. 6
0
        public TileSelection(TileLayer layer, Rectangle area)
        {
            Layer = layer;
            Area = area;

            Under = new int[Math.Max(area.Width, 0), Math.Max(area.Height, 0)];
            for (int i = 0; i < area.Width; i++)
                for (int j = 0; j < area.Height; j++)
                    Under[i, j] = -1;
        }
Esempio n. 7
0
 public TileSelectAction(TileLayer tileLayer, Rectangle selectArea)
     : base(tileLayer)
 {
     this.selectArea = selectArea;
 }
 public TileMoveSelectionAction(TileLayer tileLayer, Point move)
     : base(tileLayer)
 {
     this.move = move;
 }
Esempio n. 9
0
 public TileFloodAction(TileLayer tileLayer, Point cell, int setTo)
     : base(tileLayer)
 {
     this.cell = cell;
     this.setTo = setTo;
 }
Esempio n. 10
0
 public TileRectangleAction(TileLayer tileLayer, Rectangle rect, int setTo)
     : base(tileLayer)
 {
     this.rect = rect;
     this.setTo = setTo;
 }
 public TileClearSelectionAction(TileLayer tileLayer)
     : base(tileLayer)
 {
 }
Esempio n. 12
0
 public TileAction(TileLayer tileLayer)
 {
     TileLayer = tileLayer;
 }
Esempio n. 13
0
 public TileSetTilesetAction(TileLayer tileLayer, Tileset setTo)
     : base(tileLayer)
 {
     this.setTo = setTo;
 }
 public TileDeleteSelectionAction(TileLayer tileLayer)
     : base(tileLayer)
 {
 }
Esempio n. 15
0
 public TileLayerEditor(LevelEditor levelEditor, TileLayer layer)
     : base(levelEditor, layer)
 {
     Layer = layer;
 }