Esempio n. 1
0
        public void ResizeJustified(int width, int height, Dir8 anchorDir)
        {
            RogueElements.Grid.LocAction changeOp = (Loc effectLoc) => { };
            RogueElements.Grid.LocAction newOp    = (Loc effectLoc) => { Tiles[effectLoc.X][effectLoc.Y] = new AutoTile(); };

            Loc diff = RogueElements.Grid.ResizeJustified(ref Tiles,
                                                          width, height, anchorDir.Reverse(), changeOp, newOp);
        }
Esempio n. 2
0
        public void ResizeJustified(int width, int height, Dir8 anchorDir)
        {
            foreach (MapLayer layer in Layers)
            {
                layer.ResizeJustified(width, height, anchorDir);
            }

            int divSize = GraphicsManager.TEX_SIZE;

            RogueElements.Grid.LocAction blockChangeOp = (Loc effectLoc) => { obstacles[effectLoc.X][effectLoc.Y].Bounds = new Rect(effectLoc.X * divSize, effectLoc.Y * divSize, divSize, divSize); };
            RogueElements.Grid.LocAction blocknewOp    = (Loc effectLoc) => { obstacles[effectLoc.X][effectLoc.Y] = new GroundWall(effectLoc.X * divSize, effectLoc.Y * divSize, divSize, divSize); };

            Loc texDiff = RogueElements.Grid.ResizeJustified(ref obstacles,
                                                             width * TexSize, height * TexSize, anchorDir.Reverse(), blockChangeOp, blocknewOp);

            foreach (GroundChar character in ZoneManager.Instance.CurrentGround.IterateCharacters())
            {
                Loc newLoc = character.MapLoc + texDiff * divSize;
                if (newLoc.X < 0)
                {
                    newLoc.X = 0;
                }
                else if (newLoc.X >= width)
                {
                    newLoc.X = width - 1;
                }
                if (newLoc.Y < 0)
                {
                    newLoc.Y = 0;
                }
                else if (newLoc.Y >= height)
                {
                    newLoc.Y = height - 1;
                }

                character.SetMapLoc(newLoc);
                character.UpdateFrame();
            }

            this.grid = new AABB.Grid(width, height, GraphicsManager.TileSize);
        }
Esempio n. 3
0
        public void Retile(int texSize)
        {
            int newWidth  = (Width * TexSize - 1) / texSize + 1;
            int newHeight = (Height * TexSize - 1) / texSize + 1;

            TexSize = texSize;

            foreach (MapLayer layer in Layers)
            {
                layer.CreateNew(newWidth, newHeight);
            }

            int divSize = GraphicsManager.TEX_SIZE;

            RogueElements.Grid.LocAction blockChangeOp = (Loc effectLoc) => { obstacles[effectLoc.X][effectLoc.Y].Bounds = new Rect(effectLoc.X * divSize, effectLoc.Y * divSize, divSize, divSize); };
            RogueElements.Grid.LocAction blocknewOp    = (Loc effectLoc) => { obstacles[effectLoc.X][effectLoc.Y] = new GroundWall(effectLoc.X * divSize, effectLoc.Y * divSize, divSize, divSize); };

            RogueElements.Grid.ResizeJustified(ref obstacles,
                                               newWidth * TexSize, newHeight * TexSize, Dir8.DownRight, blockChangeOp, blocknewOp);

            this.grid = new AABB.Grid(newWidth, newHeight, GraphicsManager.TileSize);
        }
Esempio n. 4
0
        public void ResizeJustified(int width, int height, Dir8 anchorDir)
        {
            foreach (MapLayer layer in Layers)
            {
                layer.ResizeJustified(width, height, anchorDir);
            }

            int divSize = GraphicsManager.TEX_SIZE;

            RogueElements.Grid.LocAction blockChangeOp = (Loc effectLoc) => { obstacles[effectLoc.X][effectLoc.Y].Bounds = new Rect(effectLoc.X * divSize, effectLoc.Y * divSize, divSize, divSize); };
            RogueElements.Grid.LocAction blocknewOp    = (Loc effectLoc) => { obstacles[effectLoc.X][effectLoc.Y] = new GroundWall(effectLoc.X * divSize, effectLoc.Y * divSize, divSize, divSize); };

            Loc texDiff = RogueElements.Grid.ResizeJustified(ref obstacles,
                                                             width * TexSize, height * TexSize, anchorDir.Reverse(), blockChangeOp, blocknewOp);

            foreach (GroundChar character in IterateCharacters())
            {
                character.SetMapLoc(RogueElements.Collision.ClampToBounds(width * TileSize - character.Width, height * TileSize - character.Height, character.MapLoc + texDiff * divSize));
                character.UpdateFrame();
            }

            this.grid = new AABB.Grid(width, height, GraphicsManager.TileSize);
        }