SadConsoleEditor.Editors.SceneEditor.New C# (CSharp) Method

New() public method

public New ( Color foreground, Color background, int width, int height ) : void
foreground Color
background Color
width int
height int
return void
        public void New(Color foreground, Color background, int width, int height)
        {
            // Create the new text surface
            textSurface = new LayeredTextSurface(width, height, 1);

            // Update metadata
            LayerMetadata.Create("main", false, false, true, textSurface.GetLayer(0));
            textSurface.SetActiveLayer(0);
            textSurface.Font = Settings.Config.ScreenFont;

            // Update the layer management panel
            layerManagementPanel.SetLayeredTextSurface(textSurface);

            // Set the text surface as the one we're displaying
            consoleWrapper.TextSurface = textSurface;

            // Update the border
            if (EditorConsoleManager.ActiveEditor == this)
                EditorConsoleManager.UpdateBorder(consoleWrapper.Position);
        }

Usage Example

Example #1
0
        private void CreateNewEditor(Editors.Editors editorType, int width, int height, Color defaultForeground, Color defaultBackground)
        {
            Editors.IEditor editor = null;

            switch (editorType)
            {
            case SadConsoleEditor.Editors.Editors.Console:
                editor = new Editors.LayeredConsoleEditor();
                editor.New(defaultForeground, defaultBackground, width, height);
                break;

            case SadConsoleEditor.Editors.Editors.GameObject:
                editor = new Editors.GameObjectEditor();
                editor.New(defaultForeground, defaultBackground, width, height);
                break;

            case SadConsoleEditor.Editors.Editors.Scene:
                editor = new Editors.SceneEditor();
                editor.New(defaultForeground, defaultBackground, width, height);
                break;

            case SadConsoleEditor.Editors.Editors.GUI:
                break;

            default:
                break;
            }

            if (editor != null)
            {
                AddEditor(editor, true);
            }

            topBarPane.IsVisible = true;
            ToolsPane.IsVisible  = true;
        }
All Usage Examples Of SadConsoleEditor.Editors.SceneEditor::New