private void ToolsListBox_SelectedItemChanged(object sender, SadConsole.Controls.ListBox <SadConsole.Controls.ListBoxItem> .SelectedItemEventArgs e) { Tools.ITool tool = e.Item as Tools.ITool; if (e.Item != null) { selectedTool = tool; List <CustomPanel> newPanels = new List <CustomPanel>() { gameObjectNamePanel, animationPanel, framesPanel, toolsPanel }; if (tool.ControlPanels != null && tool.ControlPanels.Length != 0) { newPanels.AddRange(tool.ControlPanels); } panels = newPanels.ToArray(); MainScreen.Instance.ToolsPane.RedrawPanels(); if (tool is Tools.EntityCenterTool) { surface.GetLayer(LayerAnimCenter).IsVisible = true; surface.GetLayer(LayerBackground).IsVisible = true; } else { surface.GetLayer(LayerAnimCenter).IsVisible = false; surface.GetLayer(LayerBackground).IsVisible = false; } } }
public void New(Color foreground, Color background, int width, int height) { int renderWidth = Math.Min(MainScreen.Instance.InnerEmptyBounds.Width, width); int renderHeight = Math.Min(MainScreen.Instance.InnerEmptyBounds.Height, height); hotspotSurface = new BasicSurface(renderWidth, renderHeight, Settings.Config.ScreenFont); // Create the new text surface surface = new LayeredSurface(width, height, new Rectangle(0, 0, renderWidth, renderHeight), 1); // Update metadata LayerMetadata.Create("main", false, false, true, surface.GetLayer(0)); surface.SetActiveLayer(0); surface.Font = Settings.Config.ScreenFont; // Update the layer management panel layerManagementPanel.SetLayeredSurface(surface); // Set the text surface as the one we're displaying // Update the border if (MainScreen.Instance.ActiveEditor == this) { MainScreen.Instance.RefreshBorder(); } }
public void Resize(int width, int height) { Reset(); int renderWidth = Math.Min(MainScreen.Instance.InnerEmptyBounds.Width, width); int renderHeight = Math.Min(MainScreen.Instance.InnerEmptyBounds.Height, height); var oldSurface = surface; surface = new SadConsole.Surfaces.LayeredSurface(width, height, SadConsoleEditor.Settings.Config.ScreenFont, new Rectangle(0, 0, renderWidth, renderHeight), 1); for (var index = 0; index < oldSurface.LayerCount; index++) { oldSurface.SetActiveLayer(index); surface.SetActiveLayer(index); oldSurface.Copy(surface); surface.GetLayer(index).Metadata = oldSurface.GetLayer(index).Metadata; } layerManagementPanel.SetLayeredSurface(surface); MainScreen.Instance.RefreshBorder(); }