Esempio n. 1
0
        /// <summary>
        /// Creates a surface without initializing it
        /// </summary>
        /// <param name="position">the top-left corner of the surface, in global terms</param>
        /// <param name="resolution">the resolution of the surface</param>
        /// <returns>The surface</returns>
        public FucksSurfaceManager CreateSurface(TermPosition position, TermResolution resolution)
        {
            var sz      = new TermSize(resolution.Xres, resolution.Yres);
            var manager = new FucksSurfaceManager(position, sz, resolution, BasicColor.Default);

            surfaces.Add(manager);
            return(manager);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates and initializes a surface encompasses the whole terminal
        /// </summary>
        /// <returns>The surface</returns>
        public FucksSurfaceManager CreateAndInitializeFullSurface()
        {
            var sz      = TermSize.CurrentTermSize;
            var manager = new FucksSurfaceManager(TermPosition.Origin, sz, BasicColor.Default);

            manager.Initialize();
            surfaces.Add(manager);
            return(manager);
        }
Esempio n. 3
0
        /// <summary>
        /// Brings a surface to the top,
        /// effectively focusing it
        /// </summary>
        /// <param name="surface">The surface to focus</param>
        public void Focus(FucksSurfaceManager surface)
        {
            int idx = surfaces.FindIndex((obj) => obj == surface);

            if (idx == surfaces.Count - 1)
            {
                return;
            }
            surfaces.Swap(idx, surfaces.Count - 1);
            surfaces.ForEach(mgr => mgr.MarkDirty());   //XXX this redraws the whole frame
            dirty = true;
        }
Esempio n. 4
0
        /// <summary>
        /// Translates a surface along the XY plane
        /// </summary>
        /// <param name="manager">the surface</param>
        /// <param name="x">amount to move in X</param>
        /// <param name="y">amount to move in Y</param>
        public void Translate(FucksSurfaceManager manager, int x, int y)
        {
            // invalidated = true;
            var postl = manager.surfacePosition;
            var bound = manager.bounds;

            manager.Translate(x, y);
            postl = postl.CompoundMinimumBound(x, y);
            var posbr = bound.CompoundMaximumBound(x, y) + postl;

            for (TermPosition pos = postl; pos.X <= posbr.X; pos.X++)
            {
                for (pos.Y = postl.Y; pos.Y <= posbr.Y; pos.Y++)
                {
                    ref
                    var v = ref renderState[pos.X, pos.Y];
                    v.rendered = false;
                    v.dirty    = true;
                    surfaces.ForEach(mgr => mgr.MarkCellDirtyIfInBounds(pos));
                }
            }
Esempio n. 5
0
 public void PutChar(FucksSurfaceManager surface, char c, TermPosition termPosition)
 {
     surface.PutChar(c, ref termPosition);
     dirty = surface.Dirty;
 }