private void fillStroke(CanvasStroke <bool> stroke) { if (!Collision.InBounds(ZoneManager.Instance.CurrentGround.TexWidth, ZoneManager.Instance.CurrentGround.TexHeight, stroke.CoveredRect.Start)) { return; } uint tile = ZoneManager.Instance.CurrentGround.GetObstacle(stroke.CoveredRect.Start.X, stroke.CoveredRect.Start.Y); bool blocked = stroke.GetBrush(stroke.CoveredRect.Start); Dictionary <Loc, uint> brush = new Dictionary <Loc, uint>(); Grid.FloodFill(new Rect(0, 0, ZoneManager.Instance.CurrentGround.TexWidth, ZoneManager.Instance.CurrentGround.TexHeight), (Loc testLoc) => { if (brush.ContainsKey(testLoc)) { return(true); } return(tile != ZoneManager.Instance.CurrentGround.GetObstacle(testLoc.X, testLoc.Y)); }, (Loc testLoc) => { return(true); }, (Loc testLoc) => { brush[testLoc] = blocked ? 1u : 0u; }, stroke.CoveredRect.Start); DiagManager.Instance.DevEditor.GroundEditor.Edits.Apply(new DrawBlockUndo(brush)); }
private void fillStroke(CanvasStroke <EffectTile> stroke) { if (!Collision.InBounds(ZoneManager.Instance.CurrentMap.Width, ZoneManager.Instance.CurrentMap.Height, stroke.CoveredRect.Start)) { return; } EffectTile tile = ZoneManager.Instance.CurrentMap.Tiles[stroke.CoveredRect.Start.X][stroke.CoveredRect.Start.Y].Effect; Dictionary <Loc, EffectTile> brush = new Dictionary <Loc, EffectTile>(); EffectTile brushTile = stroke.GetBrush(stroke.CoveredRect.Start); RogueElements.Grid.FloodFill(new Rect(0, 0, ZoneManager.Instance.CurrentMap.Width, ZoneManager.Instance.CurrentMap.Height), (Loc testLoc) => { if (brush.ContainsKey(testLoc)) { return(true); } return(tile.ID != ZoneManager.Instance.CurrentMap.Tiles[testLoc.X][testLoc.Y].Effect.ID); }, (Loc testLoc) => { return(true); }, (Loc testLoc) => { brush[testLoc] = new EffectTile(brushTile, testLoc); }, stroke.CoveredRect.Start); DiagManager.Instance.DevEditor.MapEditor.Edits.Apply(new DrawTileUndo(brush)); }
private void paintStroke(CanvasStroke <bool> stroke) { Dictionary <Loc, uint> brush = new Dictionary <Loc, uint>(); foreach (Loc loc in stroke.GetLocs()) { if (!Collision.InBounds(ZoneManager.Instance.CurrentGround.TexWidth, ZoneManager.Instance.CurrentGround.TexHeight, loc)) { continue; } brush[loc] = stroke.GetBrush(loc) ? 1u : 0u; } DiagManager.Instance.DevEditor.GroundEditor.Edits.Apply(new DrawBlockUndo(brush)); }
public void ProcessInput(InputManager input) { bool inWindow = Collision.InBounds(GraphicsManager.WindowWidth, GraphicsManager.WindowHeight, input.MouseLoc); Loc tileCoords = DungeonEditScene.Instance.ScreenCoordsToMapCoords(input.MouseLoc); switch (TileMode) { case TileEditMode.Draw: { EffectTile brush = getBrush(); CanvasStroke <EffectTile> .ProcessCanvasInput(input, tileCoords, inWindow, () => new DrawStroke <EffectTile>(tileCoords, brush), () => new DrawStroke <EffectTile>(tileCoords, new EffectTile()), paintStroke, ref DungeonEditScene.Instance.TileInProgress); } break; case TileEditMode.Rectangle: { EffectTile brush = getBrush(); CanvasStroke <EffectTile> .ProcessCanvasInput(input, tileCoords, inWindow, () => new RectStroke <EffectTile>(tileCoords, brush), () => new RectStroke <EffectTile>(tileCoords, new EffectTile()), paintStroke, ref DungeonEditScene.Instance.TileInProgress); } break; case TileEditMode.Fill: { EffectTile brush = getBrush(); CanvasStroke <EffectTile> .ProcessCanvasInput(input, tileCoords, inWindow, () => new FillStroke <EffectTile>(tileCoords, brush), () => new FillStroke <EffectTile>(tileCoords, new EffectTile()), fillStroke, ref DungeonEditScene.Instance.TileInProgress); } break; case TileEditMode.Eyedrop: { if (input[FrameInput.InputType.LeftMouse]) { eyedropTile(tileCoords); } } break; } }
private void paintStroke(CanvasStroke <EffectTile> stroke) { Dictionary <Loc, EffectTile> brush = new Dictionary <Loc, EffectTile>(); foreach (Loc loc in stroke.GetLocs()) { if (!Collision.InBounds(ZoneManager.Instance.CurrentMap.Width, ZoneManager.Instance.CurrentMap.Height, loc)) { continue; } brush[loc] = new EffectTile(stroke.GetBrush(loc), loc); } DiagManager.Instance.DevEditor.MapEditor.Edits.Apply(new DrawTileUndo(brush)); }
public void ProcessInput(InputManager input) { bool inWindow = Collision.InBounds(GraphicsManager.WindowWidth, GraphicsManager.WindowHeight, input.MouseLoc); Loc tileCoords = GroundEditScene.Instance.ScreenCoordsToBlockCoords(input.MouseLoc); switch (BlockMode) { case TileEditMode.Draw: { CanvasStroke <bool> .ProcessCanvasInput(input, tileCoords, inWindow, () => new DrawStroke <bool>(tileCoords, true), () => new DrawStroke <bool>(tileCoords, false), paintStroke, ref GroundEditScene.Instance.BlockInProgress); } break; case TileEditMode.Rectangle: { CanvasStroke <bool> .ProcessCanvasInput(input, tileCoords, inWindow, () => new RectStroke <bool>(tileCoords, true), () => new RectStroke <bool>(tileCoords, false), paintStroke, ref GroundEditScene.Instance.BlockInProgress); } break; case TileEditMode.Fill: { CanvasStroke <bool> .ProcessCanvasInput(input, tileCoords, inWindow, () => new FillStroke <bool>(tileCoords, true), () => new FillStroke <bool>(tileCoords, false), fillStroke, ref GroundEditScene.Instance.BlockInProgress); } break; } }