예제 #1
0
 /// <summary>
 /// Gets a cell based on its coordinates on the surface.
 /// </summary>
 /// <param name="x">The X coordinate.</param>
 /// <param name="y">The Y coordinate.</param>
 /// <returns>The indicated cell.</returns>
 public Cell this[int x, int y]
 {
     get
     {
         return(cells[TextSurface.GetIndexFromPoint(x, y, Width)]);
     }
 }
예제 #2
0
        /// <summary>
        /// Moves the cusor left by the specified amount of columns, wrapping the cursor if needed.
        /// </summary>
        /// <param name="amount">The amount of columns to move the cursor</param>
        /// <returns>This cursor object.</returns>
        public Cursor LeftWrap(int amount)
        {
            var console = ((SurfaceEditor)_console.Target);

            int index = TextSurface.GetIndexFromPoint(this._position, console.TextSurface.Width) - amount;

            if (index < 0)
            {
                index = 0;
            }

            this._position = TextSurface.GetPointFromIndex(index, console.TextSurface.Width);

            return(this);
        }
예제 #3
0
        /// <summary>
        /// Moves the cusor right by the specified amount of columns, wrapping the cursor if needed.
        /// </summary>
        /// <param name="amount">The amount of columns to move the cursor</param>
        /// <returns>This cursor object.</returns>
        public Cursor RightWrap(int amount)
        {
            var console = ((SurfaceEditor)_console.Target);


            int index = TextSurface.GetIndexFromPoint(this._position, console.TextSurface.Width) + amount;

            if (index > console.TextSurface.Cells.Length)
            {
                index = console.TextSurface.Cells.Length - 1;
            }

            this._position = TextSurface.GetPointFromIndex(index, console.TextSurface.Width);

            return(this);
        }