Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new text surface with the specified width, height, and initial set of cell data.
        /// </summary>
        /// <param name="width">The width of the surface.</param>
        /// <param name="height">The height of the surface.</param>
        /// <param name="font">The font used for calculations.</param>
        /// <param name="initialCells">Seeds the cells with existing values. Array size must match <paramref name="width"/> * <paramref name="height"/>.</param>
        /// <param name="viewPort">Initial value for the <see cref="SurfaceBase.ViewPort"/> view.</param>
        public BasicNoDraw(int width, int height, Font font, Rectangle viewPort, Cell[] initialCells)
        {
            Effects           = new Effects.EffectsManager(this);
            ViewPortRectangle = viewPort;
            Width             = width;
            Height            = height;

            if (initialCells == null)
            {
                InitializeCells();
            }

            else if (initialCells.Length != width * height)
            {
                throw new ArgumentOutOfRangeException(nameof(initialCells), "initialCells length must equal width * height");
            }
            else
            {
                Cells       = initialCells;
                RenderCells = new Cell[Cells.Length];
                RenderRects = new Rectangle[Cells.Length];
            }

            _font = font;
            SetRenderCells();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of the input box.
 /// </summary>
 /// <param name="width">The width of the input box.</param>
 public InputBox(int width)
     : base(width, 1)
 {
     effects = new Effects.EffectsManager(textSurface);
     DetermineAppearance();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a new instance of the input box.
 /// </summary>
 /// <param name="width">The width of the input box.</param>
 public InputBox(int width)
     : base(width, 1)
 {
     effects = new Effects.EffectsManager(textSurface);
     DetermineAppearance();
 }