Beispiel #1
0
 public void Update()
 {
     editor.Print(0, 0, stat.Name);
     editor.Clear(14, 0);
     editor.Clear(15, 0);
     editor.Print(14, 0, stat.Value.ToString());
     if (stat.AltValue != 0)
     {
         editor.Clear(17, 0);
         editor.Clear(18, 0);
         editor.Print(17, 0, stat.AltValue.ToString());
     }
 }
        public void Update()
        {
            editor.Clear();
            editor.Print(0, 0, stat.Name);
            //calculation move to method?
            ColoredString statusString = stat.Value.ToString().CreateColored(colorOne, Color.Black, null) +
                                         "/".CreateColored(Color.White, Color.Black, null) +
                                         stat.AltValue.ToString().CreateColored(colorTwo, Color.Black, null);
            ColoredString gradient = new string((char)176, 14).CreateGradient(colorOne, colorTwo, colorOne, colorTwo);
            double        percent  = (double)stat.Value / (double)stat.AltValue;

            //drawing
            editor.Print(width - statusString.ToString().Length, 0, statusString);
            editor.Print(0, 1, gradient.SubString(0, (int)((double)gradient.Count * (double)percent)));
        }
Beispiel #3
0
 public BorderedConsole(string title, int width, int height) : this(width, height)
 {
     if (title.Length > width - 2)
     {
         throw new ArgumentOutOfRangeException("Title wider then width");
     }
     borderEdit.Print(2, 0, title);
 }
 public BorderedScrollingConsole(string title, int width, int height, int bufferHeight) : this(width, height, bufferHeight)
 {
     if (title.Length > width - 3)
     {
         throw new ArgumentOutOfRangeException("Title wider than width.");
     }
     borderEdit.Print(2, 0, title);
 }
Beispiel #5
0
        public override void Draw(GameTime gameTime)
        {
            frameCounter++;

            string fps = string.Format("fps: {0}", frameRate);

            editor.Clear();
            editor.Print(0, 0, fps);
            consoleRender.Render(console, Point.Zero);
        }
Beispiel #6
0
        public override void Draw(ISurface surface, Rectangle area)
        {
            if (Item is Color || Item is Tuple <Color, Color, string> )
            {
                var    editor = new SurfaceEditor(surface);
                string value  = new string(' ', area.Width - 2);

                Cell cellLook = new Cell();
                _currentAppearance.CopyAppearanceTo(cellLook);

                if (Item is Color)
                {
                    cellLook.Background = (Color)Item;
                    editor.Print(area.Left + 1, area.Top, value, cellLook);
                }
                else
                {
                    cellLook.Foreground = ((Tuple <Color, Color, string>)Item).Item2;
                    cellLook.Background = ((Tuple <Color, Color, string>)Item).Item1;
                    value = ((Tuple <Color, Color, string>)Item).Item3.Align(HorizontalAlignment.Left, area.Width - 2);
                    editor.Print(area.Left + 1, area.Top, value, cellLook);
                }

                editor.Print(area.Left, area.Top, " ", _currentAppearance);
                editor.Print(area.Left + area.Width - 1, area.Top, " ", _currentAppearance);

                if (IsSelected)
                {
                    editor.SetGlyph(area.Left, area.Top, 16);
                    editor.SetGlyph(area.Left + area.Width - 1, area.Top, 17);
                }

                IsDirty = false;
            }
            else
            {
                base.Draw(surface, area);
            }
        }
Beispiel #7
0
            public override void Draw(GameTime gameTime)
            {
                frameCounter++;
                string fps = string.Format("fps: {0}", frameRate);

                editor.Clear();
                editor.Print(0, 0, fps);
                consoleRender.Render(surface);

                Global.GraphicsDevice.SetRenderTarget(null);
                Global.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone);
                Global.SpriteBatch.Draw(surface.LastRenderResult, Vector2.Zero, Color.White);
                Global.SpriteBatch.End();
            }
Beispiel #8
0
        public virtual void Draw(ISurface surface, Rectangle area)
        {
            string value = Item.ToString();

            if (value.Length < area.Width)
            {
                value += new string(' ', area.Width - value.Length);
            }
            else if (value.Length > area.Width)
            {
                value = value.Substring(0, area.Width);
            }
            var editor = new SurfaceEditor(surface);

            editor.Print(area.Left, area.Top, value, _currentAppearance);
            _isDirty = false;
        }
Beispiel #9
0
            public override void Draw(ISurface surface, Microsoft.Xna.Framework.Rectangle area)
            {
                string value = ((LayerMetadata)((LayeredSurface.Layer)Item).Metadata).Name;

                if (value.Length < area.Width)
                {
                    value += new string(' ', area.Width - value.Length);
                }
                else if (value.Length > area.Width)
                {
                    value = value.Substring(0, area.Width);
                }
                var editor = new SurfaceEditor(surface);

                editor.Print(area.X, area.Y, value, _currentAppearance);
                _isDirty = false;
            }
Beispiel #10
0
        public override void Draw(ISurface surface, Rectangle area)
        {
            string value = ((FileLoaders.IFileLoader)Item).FileTypeName;

            if (value.Length < area.Width)
            {
                value += new string(' ', area.Width - value.Length);
            }
            else if (value.Length > area.Width)
            {
                value = value.Substring(0, area.Width);
            }
            var editor = new SurfaceEditor(surface);

            editor.Print(area.Left, area.Top, value, _currentAppearance);
            _isDirty = false;
        }
        public static GameObject CreateFromString(string s, Color color = new Color())
        {
            if (color == new Color())
            {
                color = Color.White;
            }
            var lines = s.Split('\n');

            var text   = new AnimatedSurface("deafult", lines.Max(ss => ss.Length), lines.Length);
            var editor = new SurfaceEditor(text.CreateFrame());

            for (int i = 0; i < lines.Length; i++)
            {
                editor.Print(0, i, lines[i], color);
            }
            return(new GameObject(text));
        }
Beispiel #12
0
        public override void Draw(ITextSurface surface, Rectangle area)
        {
            string value = ((Editors.EntityEditor.FrameWrapper)Item).CurrentIndex.ToString();

            if (value.Length < area.Width)
            {
                value += new string(' ', area.Width - value.Length);
            }
            else if (value.Length > area.Width)
            {
                value = value.Substring(0, area.Width);
            }

            var editor = new SurfaceEditor(surface);

            editor.Print(area.X, area.Y, value, _currentAppearance);
            _isDirty = false;
        }
Beispiel #13
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="surface"></param>
            /// <param name="area"></param>
            public override void Draw(ISurface surface, Microsoft.Xna.Framework.Rectangle area)
            {
                var           hotSpot = ((Hotspot)Item);
                ColoredString value   = ((char)hotSpot.DebugAppearance.Glyph).ToString().CreateColored(hotSpot.DebugAppearance.Foreground, hotSpot.DebugAppearance.Background, hotSpot.DebugAppearance.Mirror) + " ".CreateColored(_currentAppearance.Foreground, _currentAppearance.Background) + hotSpot.Title.CreateColored(_currentAppearance.Foreground, _currentAppearance.Background);

                if (value.Count < area.Width)
                {
                    value += new string(' ', area.Width - value.Count).CreateColored(_currentAppearance.Foreground, _currentAppearance.Background);
                }
                else if (value.Count > area.Width)
                {
                    value = new ColoredString(value.Take(area.Width).ToArray());
                }
                var editor = new SurfaceEditor(surface);

                editor.Print(area.X, area.Y, value);
                _isDirty = false;
            }
            public override void Draw(ISurface surface, Microsoft.Xna.Framework.Rectangle area)
            {
                string value = ((ResizableObject)Item).Name;

                if (string.IsNullOrEmpty(value))
                {
                    value = "<no name>";
                }

                if (value.Length < area.Width)
                {
                    value += new string(' ', area.Width - value.Length);
                }
                else if (value.Length > area.Width)
                {
                    value = value.Substring(0, area.Width);
                }
                var editor = new SurfaceEditor(surface);

                editor.Print(area.X, area.Y, value, _currentAppearance);
                _isDirty = false;
            }