/// <summary> /// Draws the brush onto the given screen at the given tile location. /// Returns an "undo brush" - a brush of all tiles that were overwritten. /// Returns null if no tiles were changed. /// </summary> public ITileBrush DrawOn(ScreenDocument screen, int tile_x, int tile_y) { TileBrush undo = new TileBrush(Width, Height); bool changed = false; foreach (TileBrushCell[] col in cells) { foreach (TileBrushCell cell in col) { var old = screen.TileAt(cell.x + tile_x, cell.y + tile_y); if (old == null) { continue; } undo.AddTile(old, cell.x, cell.y); if (old.Id != cell.tile.Id) { changed = true; screen.ChangeTile(cell.x + tile_x, cell.y + tile_y, cell.tile.Id); } } } if (changed) { return(undo); } return(null); }
private void ScreenRenamed(string oldName, string newName) { if (!screens.ContainsKey(oldName)) { return; } ScreenDocument doc = screens[oldName]; screens.Remove(oldName); screens.Add(newName, doc); if (map.StartScreen == oldName) { map.StartScreen = newName; } foreach (var join in Joins) { if (join.screenOne == oldName) { join.screenOne = newName; } if (join.screenTwo == oldName) { join.screenTwo = newName; } } Dirty = true; }
public void AddScreen(string name, int tile_width, int tile_height) { var screen = new MegaMan.Common.ScreenInfo(name, Tileset); int[][] tiles = new int[tile_height][]; for (int y = 0; y < tile_height; y++) { tiles[y] = new int[tile_width]; } screen.Layers.Add(new ScreenLayerInfo(name, new TileLayer(tiles, Tileset, 0, 0), new List <EntityPlacement>(), new List <ScreenLayerKeyframe>())); map.Screens.Add(name, screen); if (StartScreen == null) { StartScreen = map.Screens.Keys.First(); } ScreenDocument doc = WrapScreen(screen); // now I can do things like fire an event... how useful! if (ScreenAdded != null) { ScreenAdded(doc); } Save(); }
private ScreenDocument WrapScreen(MegaMan.Common.ScreenInfo screen) { ScreenDocument doc = new ScreenDocument(screen, this); screens.Add(screen.Name, doc); doc.Renamed += ScreenRenamed; doc.TileChanged += () => Dirty = true; return(doc); }
// this implies editing a screen private ScreenProp(ScreenDocument screen) { InitializeComponent(); this.screen = screen; stage = screen.Stage; textName.Text = screen.Name; widthField.Value = screen.Width; heightField.Value = screen.Height; }
// this implies editing a screen private ScreenProp(ScreenDocument screen) { InitializeComponent(); this.screen = screen; stage = screen.Stage; textName.Text = screen.Name; widthField.Value = screen.Width; heightField.Value = screen.Height; }
private ScreenDrawingSurface CreateScreenSurface(ScreenDocument screen) { var surface = new ScreenDrawingSurface(screen); surfaces.Add(screen.Name, surface); screen.Renamed += this.RenameSurface; screen.Resized += (w, h) => this.AlignScreenSurfaces(); surface.Edited += new EventHandler <ScreenEditEventArgs>(surface_Edited); surface.Activated += () => { ActiveSurface = surface; }; this.Controls.Add(surface); joinOverlay.Add(surface); return(surface); }
public void RunTestFromStage(ScreenDocument screen, Point location) { if (enginePath == null || !File.Exists(enginePath)) { loadEnginePath(); } string args = String.Format("\"{0}\" \"Stage\\{1}\" \"{2}\" \"{3},{4}\"", activeProject.Project.GameFile, screen.Stage.Name, screen.Name, location.X.ToString(), location.Y.ToString()); Process.Start(enginePath, args); }
public virtual ITileBrush DrawOn(ScreenDocument screen, int tile_x, int tile_y) { var old = screen.TileAt(tile_x, tile_y); if (old == null) { return(null); } if (old.Id == tile.Id) { return(null); } screen.ChangeTile(tile_x, tile_y, tile.Id); return(new SingleTileBrush(old)); }
public ScreenDrawingSurface(ScreenDocument screen) { Screen = screen; SizeMode = PictureBoxSizeMode.StretchImage; BackColor = SystemColors.Control; BackgroundImageLayout = ImageLayout.None; BuildLayers(); Screen.Resized += (w, h) => ResizeLayers(); Program.AnimateTick += Animate; Program.FrameTick += SelectionAnimate; RedrawJoins(); ReDrawAll(); MainForm.Instance.DrawOptionToggled += ReDrawMaster; selectionPen = new Pen(Color.LimeGreen, 2); selectionPen.DashPattern = new float[] { 3, 2 }; }
public ScreenDrawingSurface(ScreenDocument screen) { Screen = screen; SizeMode = PictureBoxSizeMode.StretchImage; BackColor = SystemColors.Control; BackgroundImageLayout = ImageLayout.None; BuildLayers(); Screen.Resized += (w, h) => ResizeLayers(); Program.AnimateTick += Animate; Program.FrameTick += SelectionAnimate; RedrawJoins(); ReDrawAll(); MainForm.Instance.DrawOptionToggled += ReDrawMaster; selectionPen = new Pen(Color.LimeGreen, 2); selectionPen.DashPattern = new float[] { 3, 2 }; }
public void RunTestFromStage(ScreenDocument screen, Point location) { if (enginePath == null || !File.Exists(enginePath)) { loadEnginePath(); } string args = String.Format("\"{0}\" \"Stage\\{1}\" \"{2}\" \"{3},{4}\"", activeProject.Project.GameFile, screen.Stage.Name, screen.Name, location.X.ToString(), location.Y.ToString()); Process.Start(enginePath, args); }
private ScreenDrawingSurface CreateScreenSurface(ScreenDocument screen) { var surface = new ScreenDrawingSurface(screen); surfaces.Add(screen.Name, surface); screen.Renamed += this.RenameSurface; screen.Resized += (w, h) => this.AlignScreenSurfaces(); surface.Edited += new EventHandler<ScreenEditEventArgs>(surface_Edited); surface.Activated += () => { ActiveSurface = surface; }; this.Controls.Add(surface); joinOverlay.Add(surface); return surface; }
/// <summary> /// Draws the brush onto the given screen at the given tile location. /// Returns an "undo brush" - a brush of all tiles that were overwritten. /// Returns null if no tiles were changed. /// </summary> public ITileBrush DrawOn(ScreenDocument screen, int tile_x, int tile_y) { TileBrush undo = new TileBrush(Width, Height); bool changed = false; foreach (TileBrushCell[] col in cells) { foreach (TileBrushCell cell in col) { var old = screen.TileAt(cell.x + tile_x, cell.y + tile_y); if (old == null) continue; undo.AddTile(old, cell.x, cell.y); if (old.Id != cell.tile.Id) { changed = true; screen.ChangeTile(cell.x + tile_x, cell.y + tile_y, cell.tile.Id); } } } if (changed) return undo; return null; }
public virtual ITileBrush DrawOn(ScreenDocument screen, int tile_x, int tile_y) { var old = screen.TileAt(tile_x, tile_y); if (old == null) { return null; } if (old.Id == tile.Id) { return null; } screen.ChangeTile(tile_x, tile_y, tile.Id); return new SingleTileBrush(old); }
private ScreenDocument WrapScreen(MegaMan.Common.Screen screen) { ScreenDocument doc = new ScreenDocument(screen, this); screens.Add(screen.Name, doc); doc.Renamed += ScreenRenamed; doc.TileChanged += () => Dirty = true; return doc; }
public static void EditScreen(ScreenDocument screen) { new ScreenProp(screen).Show(); }
public ScreenNodeHandler(ProjectEditor project, TreeNode node, ScreenDocument screen) : base(project, node) { this.screen = screen; }
public ScreenNodeHandler(ProjectEditor project, TreeNode node, ScreenDocument screen) : base(project, node) { this.screen = screen; }
public static void EditScreen(ScreenDocument screen) { new ScreenProp(screen).Show(); }