private void RefreshViewport() { if (Frms.Count == 0) { return; } MapperMap map = EditorData.CurrentMap; if (map == null) { return; } DrawMap.InvalidateCache(); pnlRenderBitmap.Refresh(); if (frmDebugInfo != null && !frmDebugInfo.IsDisposed) { frmDebugInfo.setText("Objects rendered: " + DrawMap.GetNumCachedObjects()); frmDebugInfo.setText("Objects selected: " + (DrawMap.GetSelectedObjects().Count + DrawMap.GetSelectedTiles().Count)); } refreshSelectionForm(map); }
private void pnlRenderBitmap_MouseUp(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { mouseSelection.MouseUp(); EditorData.CurrentMap.MapSelect(DrawMap.GetSelectedTiles(), DrawMap.GetSelectedObjects()); RefreshViewport(); } else if (e.Button == System.Windows.Forms.MouseButtons.Right) { mouseSelection.isRightClickDown = false; } }
private void frmMain_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) { foreach (var obj in DrawMap.GetSelectedObjects()) { EditorData.CurrentMap.Objects.Remove(obj); } foreach (var tile in DrawMap.GetSelectedTiles()) { EditorData.CurrentMap.Tiles.Remove(tile); } RefreshViewport(); } else if (e.Control && e.KeyCode == Keys.C) { Selection selected = new Selection(); selected.Objects.AddRange(DrawMap.GetSelectedObjects().Clone().Select(a => { a.colorOverlay = 40; return(a); })); selected.Tiles.AddRange(DrawMap.GetSelectedTiles().Clone().Select(a => { a.colorOverlay = 40; return(a); })); EditorData.CurrentMap.Selection.Add(selected); RefreshViewport(); } else if (e.Control && e.KeyCode == Keys.B) // Clear last selection buffer { if (EditorData.CurrentMap.Selection.Count > 0) { EditorData.CurrentMap.Selection.Remove(EditorData.CurrentMap.Selection.Last()); } RefreshViewport(); } else if (e.Control && e.KeyCode == Keys.V) // Paste buffer { addSelectionsToCurrentMap(); } else if (e.Control && e.KeyCode == Keys.S) { EditorData.CurrentMap.Save(); } else if (e.KeyCode == Keys.Down) { EditorData.CurrentMap.MapSelection.MoveObject(0, 1); RefreshViewport(); } else if (e.KeyCode == Keys.Up) { EditorData.CurrentMap.MapSelection.MoveObject(0, -1); RefreshViewport(); } else if (e.KeyCode == Keys.Right) { EditorData.CurrentMap.MapSelection.MoveObject(-1, 0); RefreshViewport(); } else if (e.KeyCode == Keys.Left) { EditorData.CurrentMap.MapSelection.MoveObject(1, 0); RefreshViewport(); } }