예제 #1
0
        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 Load(string file, IFileLoader loader)
        {
            if (loader is FileLoaders.LayeredSurface)
            {
                Reset();

                surface = (SadConsole.Surfaces.LayeredSurface)loader.Load(file);

                surface.RenderArea = new Rectangle(0, 0,
                                                   Math.Min(MainScreen.Instance.InnerEmptyBounds.Width, surface.RenderArea.Width),
                                                   Math.Min(MainScreen.Instance.InnerEmptyBounds.Height, surface.RenderArea.Height));

                layerManagementPanel.SetLayeredSurface(surface);

                Title = System.IO.Path.GetFileName(file);
            }
        }