Inheritance: ITextSurface
Beispiel #1
0
        /// <summary>
        /// Creates a new frame with the same dimensions as this entity and adds it to the Frames collection of the entity.
        /// </summary>
        /// <returns>The created frame.</returns>
        public TextSurfaceBasic CreateFrame()
        {
            if (Frames == null)
            {
                Frames = new List <TextSurfaceBasic>();
            }

            var frame = new TextSurfaceBasic(Width, Height);

            Frames.Add(frame);
            UpdateFrameReferences();
            return(frame);
        }
        /// <summary>
        /// Creates a new frame with the same dimensions as this entity and adds it to the Frames collection of the entity.
        /// </summary>
        /// <returns>The created frame.</returns>
        public TextSurfaceBasic CreateFrame()
        {
            if (Frames == null)
                Frames = new List<TextSurfaceBasic>();

            var frame = new TextSurfaceBasic(Width, Height);
            new SurfaceEditor(frame).Clear();
            Frames.Add(frame);
            UpdateFrameReferences();
            return frame;
        }
        void removeSelected_ButtonClicked(object sender, EventArgs e)
        {
            currentAnimation.Frames.Remove(selectedFrame);
            selectedFrame = currentAnimation.Frames[0];

            EnableDisableControls(0);
            DrawFrameCount();
        }
        private void previousFrame_ButtonClicked(object sender, EventArgs e)
        {
            var currentIndex = currentAnimation.Frames.IndexOf(selectedFrame) - 1;

            selectedFrame = currentAnimation.Frames[currentIndex];

            EnableDisableControls(currentIndex);

            frameChangeCallback(selectedFrame);

            EditorConsoleManager.ToolsPane.RedrawPanels();
        }
        public void SetAnimation(AnimatedTextSurface animation)
        {
            currentAnimation = animation;

            selectedFrame = currentAnimation.Frames[0];

            EnableDisableControls(0);
            DrawFrameCount();

            frameChangeCallback(selectedFrame);
        }
        private void SelectedFrameChanged(TextSurfaceBasic frame)
        {
            //if (((LayeredTextSurface)_consoleLayers.TextSurface).LayerCount != 0)
            //    ((LayeredTextSurface)_consoleLayers.TextSurface).Remove(0);
            //var layer = ((LayeredTextSurface)_consoleLayers.TextSurface).Add();
            //((LayeredTextSurface)_consoleLayers.TextSurface).SetActiveLayer(layer.Index);
            //TextSurface tempSurface = new TextSurface(_consoleLayers.Width, _consoleLayers.Height, ((LayeredTextSurface)_consoleLayers.TextSurface).Font);
            //frame.Copy(tempSurface);
            //var meta = LayerMetadata.Create("Root", false, false, true, layer);
            //((LayeredTextSurface)_consoleLayers.TextSurface).SetActiveLayer(0);

            var meta = ((LayeredTextSurface)consoleWrapper.TextSurface).GetLayer(LayerDrawing);
            meta.Cells = meta.RenderCells = frame.Cells;
            ((LayeredTextSurface)consoleWrapper.TextSurface).SetActiveLayer(LayerDrawing);
        }