Пример #1
0
        protected override void OnRedraw()
        {
            Display.Clear(Color.White);

            IFont font = Font.AgateSans;

            font.Color = Color.Black;

            font.TextImageLayout = TextImageLayout.InlineTop;
            font.DrawText(0, 0, "Test InlineTop:\n{0}Test Layout {0} Text\nTest second line.",
                          image);

            font.TextImageLayout = TextImageLayout.InlineCenter;
            font.DrawText(0, 150, "Test InlineCenter:\n{0}Test Layout {0} Text\nTest second line.",
                          image);

            font.TextImageLayout = TextImageLayout.InlineBottom;
            font.DrawText(0, 300, "Test InlineBottom:\n{0}Test Layout {0} Text\nTest second line.",
                          image);

            font.DrawText(0, 450, "This is a test of the {0}AlterText{1} stuff." +
                          "The last word here should appear really {2}Large{3}.",
                          LayoutCacheAlterFont.Color(Color.Green), LayoutCacheAlterFont.Color(Color.Black),
                          LayoutCacheAlterFont.Scale(3.0, 3.0), LayoutCacheAlterFont.Scale(1.0, 1.0));

            font.DrawText(0, 530, "Test of escape sequences: {{}Escaped{}}");
        }
Пример #2
0
        private void CreateTestFramebuffer()
        {
            const int angleIncrement = 373 / 8;

            font.Color            = Color.Black;
            font.DisplayAlignment = OriginAlignment.CenterRight;

            FrameBuffer frame = new FrameBuffer(32, 32);
            var         clr   = Color.FromHsv(hueAngle, 1, 1);

            Display.RenderTarget = frame;
            Display.BeginFrame();
            Display.Clear();
            mySurface.Draw(new Rectangle(Point.Zero, frame.Size));
            Display.Primitives.FillRect(clr, new Rectangle(0, 0, 8, 32));

            var    pt   = new Point(31, 16);
            string text = tests.Count.ToString();

            font.Color = Color.Black;
            font.DrawText(pt.X - 1, pt.Y, text);
            font.DrawText(pt.X + 1, pt.Y, text);
            font.DrawText(pt.X, pt.Y - 1, text);
            font.DrawText(pt.X, pt.Y + 1, text);

            font.Color = Color.White;
            font.DrawText(pt.X, pt.Y, text);

            Display.EndFrame();
            tests.Add(frame.RenderTarget);

            hueAngle += angleIncrement;
        }
Пример #3
0
            public float PaintLeft(float x, float y, string text)
            {
                var layout = TextFont.GetTextLayout(text);

                TextFont.DrawText(layout, x, y);
                return(layout.Metrics.Height);
            }
Пример #4
0
        public void Draw(GameTime gameTime)
        {
            spriteBatch.Begin();

            var firstLineFont   = fonts.First();
            var firstLineHeight = firstLineFont.FontHeight;

            IFont f = fonts[fontIndex];

            spriteBatch.Draw(blank, new Rectangle(0, firstLineHeight, 300, 600), Color.DarkSlateGray);
            spriteBatch.Draw(blank, new Rectangle(300, firstLineHeight, 300, 600), Color.DarkBlue);

            firstLineFont.TextAlignment = OriginAlignment.TopLeft;
            firstLineFont.Color         = Color.White;
            firstLineFont.DrawText(spriteBatch, 0, 0, "Press space to cycle fonts.");

            f.Color         = Color.White;
            f.TextAlignment = OriginAlignment.TopLeft;
            f.DrawText(spriteBatch, 0, firstLineHeight, "Left-aligned numbers");

            for (int i = 1; i < numbers.Length; i++)
            {
                f.DrawText(spriteBatch, 0, firstLineHeight + i * f.FontHeight, numbers[i].ToString());
            }

            f.TextAlignment = OriginAlignment.TopRight;
            f.DrawText(spriteBatch, 600, firstLineHeight, "Right-aligned numbers");

            for (int i = 1; i < numbers.Length; i++)
            {
                f.DrawText(spriteBatch, 600.0f, firstLineHeight + i * f.FontHeight, numbers[i].ToString());
            }

            spriteBatch.End();
        }
        public void PaintWorld(WorldLayer layer)
        {
            int startTick = Hud.Game.Me.Powers.SkillSlots[2].CooldownStartTick;

            font.DrawText(startTick + "", 200, 100);
            int finishTick = Hud.Game.Me.Powers.SkillSlots[2].CooldownFinishTick;

            font.DrawText(finishTick + "", 200, 300);
        }
Пример #6
0
        private void DrawBorderedText(IFont font, int x, int y, string text, Color color, Color borderColor)
        {
            font.Color = borderColor;
            font.DrawText(spriteBatch, x + 1, y, text);
            font.DrawText(spriteBatch, x, y + 1, text);
            font.DrawText(spriteBatch, x - 1, y, text);
            font.DrawText(spriteBatch, x, y - 1, text);

            font.Color = color;
            font.DrawText(spriteBatch, x, y, text);
        }
        public void Run(string[] args)
        {
            using (var wind = new DisplayWindowBuilder(args)
                              .BackbufferSize(300, 300)
                              .QuitOnClose()
                              .Title(Name)
                              .Build())
            {
                FrameBuffer buffer = new FrameBuffer(300, 300);

                while (AgateApp.IsAlive)
                {
                    IFont font = Font.AgateSans;
                    font.Size  = 24;
                    font.Color = Color.White;

                    Display.RenderTarget = buffer;
                    Display.BeginFrame();
                    Display.Clear(Color.Gray);

                    font.DrawText(string.Format("Time: {0}", Timing.TotalSeconds.ToString("0.0")));

                    Display.EndFrame();

                    Display.RenderTarget = wind.FrameBuffer;
                    Display.BeginFrame();
                    Display.Clear(Color.Gray);

                    buffer.RenderTarget.Draw();

                    Display.EndFrame();
                    AgateApp.KeepAlive();
                }
            }
        }
Пример #8
0
        public void PaintWorld(WorldLayer layer)
        {
            if (Hud.Render.UiHidden)
            {
                return;
            }
            var x = Hud.Window.Size.Width * 0.47f;
            var y = Hud.Window.Size.Height * 0.015f;

            textBuilder.Clear();
            int CursableCount = 0;
            var monsters      = Hud.Game.AliveMonsters.Where(m => m.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) <= 40);

            foreach (var monster in monsters)
            {
                if (monster.CurHealth <= monster.MaxHealth * 0.18)
                {
                    CursableCount++;
                }
            }
            if (CursableCount > 0)
            {
                textBuilder.AppendFormat("Cursable inside");
                textBuilder.AppendLine();
            }
            var layout = RedFont.GetTextLayout(textBuilder.ToString());

            RedFont.DrawText(layout, x, y);
        }
Пример #9
0
        public void Paint(string msg)
        {
            var x = (int)(_hud.Window.Size.Width - 100) / 2;
            var y = (_hud.Window.Size.Height / 3) * 2;

            _centreFont.DrawText(msg, x, y);
        }
Пример #10
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (Hud.Render.UiHidden)
            {
                return;
            }
            var x = Hud.Window.Size.Width * 0.7f;
            var y = Hud.Window.Size.Height * 0.01f;

            double boneringer = 0;
            var    actors     = Hud.Game.Actors.Where(a => a.SnoActor.Sno == ActorSnoEnum._p6_necro_commandskeletons_d);

            if (actors.Count() > 0)
            {
                boneringer = actors.First().GetAttributeValue(Hud.Sno.Attributes.Multiplicative_Damage_Percent_Bonus, uint.MaxValue);
            }
            if (boneringer >= 2.4)
            {
                textBuilder.Clear();

                var BoneRingerCalc1 = boneringer / 1.5f;      // Command Multiplier
                var BoneRingerCalc2 = BoneRingerCalc1 / 1.6f; // Enforcer Multiplier
                var BoneRingerCalc3 = BoneRingerCalc2 - 1f;
                var BoneRingerTime  = BoneRingerCalc3 * 100f / 30.0;

                textBuilder.AppendFormat("{0:0.00}", BoneRingerTime);
                textBuilder.AppendLine();

                var layout = GreenFont.GetTextLayout(textBuilder.ToString());
                GreenFont.DrawText(layout, x, y);
            }
        }
Пример #11
0
        /// <summary>
        /// Renders menu item.
        /// </summary>
        /// <param name="graphics">graphicsto render to.</param>
        /// <param name="font">font for text.</param>
        /// <param name="px">X offset.</param>
        /// <param name="py">Y offset.</param>
        internal void Render(Graphics graphics, IFont font, int px, int py)
        {
            if (true == this.IsHr)
            {
                graphics.SetColor(this.menu.Window.Desktop.Theme.Colors.BorderDark);
                graphics.DrawRectangle((int)(px + 18 + this.bounds.X + Menu.defaultCharWidth), py + 2 + this.bounds.Y, this.bounds.Width - 18 - Menu.defaultCharWidth, 1);
                return;
            }

            if (true == this.selected)
            {
                RenderSelection(graphics, px, py);
            }

            int offXX = 0;

            if (false == this.topItem)
            {
                offXX = 18;
            }

            graphics.SetColor(this.menu.Window.Desktop.Theme.Colors.TextDark);

            if (null != font)
            {
                font.DrawText(graphics, offXX + px + this.bounds.X + Menu.defaultCharWidth, py + this.bounds.Y + 5, this.text);
            }
        }
        private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref)
        {
            var    w      = m.CurHealth * w2 / m.MaxHealth;
            var    per    = LightFont.GetTextLayout((m.CurHealth * 100 / m.MaxHealth).ToString(PercentageDescriptor) + "%");
            var    y      = YPos + py * 8 * yref;
            IBrush cBrush = null;
            IFont  cFont  = null;

            //Brush selection
            switch (m.Rarity)
            {
            case ActorRarity.Boss:
                cBrush = BossBrush;
                break;

            case ActorRarity.Champion:
                cBrush = ChampionBrush;
                break;

            case ActorRarity.Rare:
                cBrush = RareBrush;
                break;

            case ActorRarity.RareMinion:
                cBrush = RareMinionBrush;
                break;

            default:
                cBrush = BackgroundBrush;
                break;
            }

            //Jugger Highlight
            if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut))
            {
                cFont  = RedFont;
                cBrush = RareJuggerBrush;
            }
            else
            {
                cFont = NameFont;
            }


            //Draw Rectangles
            BackgroundBrush.DrawRectangle(XPos, y, w2, h);
            BorderBrush.DrawRectangle(XPos, y, w2, h);
            cBrush.DrawRectangle(XPos, y, (float)w, h);
            LightFont.DrawText(per, XPos + 8 + w2, y - py);

            //Draw MonsterType
            if (ShowMonsterType)
            {
                var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized);
                cFont.DrawText(name, XPos + 3, y - py);
            }

            //increase linecount
            yref += 1.0f;
        }
Пример #13
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }

            watermark.DrawText(watermark.GetTextLayout("pHelper"), 4, Hud.Window.Size.Height * 0.966f);
        }
Пример #14
0
        private void CenterText(IFont font, int y, string text, Color color)
        {
            Size size = font.MeasureString(text);

            int x = (Coordinates.Width - size.Width) / 2;

            font.Color = color;
            font.DrawText(spriteBatch, x, y, text);
        }
Пример #15
0
        private void FontTests(IFont font, out Rectangle drawRect)
        {
            Point drawPoint = new Point(10, 10);
            Size  fontsize  = font.MeasureString(text);

            drawRect = new Rectangle(drawPoint, fontsize);

            font.DrawText(drawPoint, text);
        }
Пример #16
0
        public void Draw()
        {
            Display.BeginFrame();
            Display.Clear(Color.Black);
            IFont font = Font.AgateSans;

            font.Size = 14;

            font.DrawText("FPS: " + Display.FramesPerSecond);

            pe.Draw();
            font.DrawText((int)pe.Position.X, (int)pe.Position.Y, "Particles: " + pe.Particles.Count + "/" + pe.Particles.Capacity);

            sm.Draw();
            font.DrawText((int)sm.Position.X, (int)sm.Position.Y, "Particles: " + sm.Particles.Count + "/" + sm.Particles.Capacity);

            se.Draw();
            font.DrawText((int)se.Position.X, (int)se.Position.Y, "Particles: " + se.Particles.Count + "/" + se.Particles.Capacity);

            Display.EndFrame();
            AgateApp.KeepAlive();
        }
Пример #17
0
        public void Run(string[] args)
        {
            ChangeDisplayWindow(3);

            Surface mySurface = new Surface("Images/pointer.png");

            Input.Unhandled.KeyDown   += Keyboard_KeyDown;
            Input.Unhandled.MouseMove += (sender, e) => mousePosition = e.MousePosition;

            IFont font = Font.AgateSans;

            Size bottomSize = font.MeasureString(bottomText);
            Size topSize    = font.MeasureString(topText + "z\nz");

            // Run the program while the window is open.
            while (AgateApp.IsAlive)
            {
                var mouseText = topText +
                                $"Resolution: {currentResolution}\nMouse: {mousePosition}";

                Display.BeginFrame();
                Display.Clear(Color.DarkGreen);

                font.DrawText(0, Display.CurrentWindow.Height - bottomSize.Height, bottomText);

                Display.Primitives.FillRect(Color.Maroon,
                                            new Rectangle(0, 0, Display.CurrentWindow.Width, topSize.Height));

                font.DrawText(mouseText);

                mySurface.Draw(mousePosition.X, mousePosition.Y);

                Display.EndFrame();
                AgateApp.KeepAlive();
            }

            mySurface.Dispose();
            wind.Dispose();
        }
Пример #18
0
        public void Run(string[] args)
        {
            using (var window = new DisplayWindowBuilder(args)
                                .BackbufferSize(800, 600)
                                .QuitOnClose()
                                .Build())
            {
                snda = new SoundBuffer("snda.wav");
                sndb = new SoundBuffer("sndb.wav");

                IFont font = Font.AgateSans;

                Input.Unhandled.KeyDown   += Keyboard_KeyDown;
                Input.Unhandled.MouseDown += Mouse_MouseDown;

                while (AgateApp.IsAlive)
                {
                    Display.BeginFrame();
                    Display.Clear();

                    font.Size  = 14;
                    font.Color = Color.White;
                    font.DrawText("Press a for first sound, b for second sound.");

                    if (snda.IsPlaying)
                    {
                        font.DrawText(0, 30, "first sound is playing");
                    }
                    if (sndb.IsPlaying)
                    {
                        font.DrawText(0, 60, "second sound is playing");
                    }

                    Display.EndFrame();
                    AgateApp.KeepAlive();
                }
            }
        }
Пример #19
0
        public void Paint(IBuff buff)
        {
            if ((buff == null) || (buff.IconCounts[0] <= 0))
            {
                return;
            }
            var cooldown   = buff.TimeLeftSeconds[1].ToString("F");
            var textLayout = _centreFont.GetTextLayout(cooldown);
            var x          = (_hud.Window.Size.Width - (float)Math.Ceiling(textLayout.Metrics.Width)) / 2;
            var y          = (_hud.Window.Size.Height - textLayout.Metrics.Height) / 2;

            //_centreFont.DrawText(buff.TimeLeftSeconds[1].ToString("F"), x, y);
            _centreFont.DrawText(buff.TimeLeftSeconds.Length.ToString(), x, y);
        }
Пример #20
0
        public void PaintTopInGame(ClipState clipState)
        {
            watermark.DrawText(WATERMARK_TEXT, Hud.Window.Size.Width * 0.04f, Hud.Window.Size.Height * 0.966f);
            tableHeadingLayout = tableHeadingFont.GetTextLayout(heading);
            tableHeadingFont.DrawText(tableHeadingLayout, coordX, coordY);

            currentRowIndex = 0;

            var buffs = Hud.Game.Me.Powers.AllBuffs.Where(buff => buff.Active && !excludedBuffs.Contains(buff.SnoPower.Sno))
                        .OrderBy(power => power.SnoPower.Sno).ToList();

            if (initialBuffs.Count == 0)
            {
                initialBuffs.AddRange(buffs);
            }

            var tableEntries = new List <string>();

            buffs.ForEach(buff =>
            {
                if (!initialBuffs.Contains(buff))
                {
                    buffDelta.Add(buff);
                    return;
                }

                if (!(GetBuffRow(buff) is string row))
                {
                    return;
                }
                tableEntries.Add(row);
            });

            var deltaTableEntries = GetDeltaBuffTableEntries();

            background.DrawRectangle(coordX - 10, coordY - 10, Hud.Window.Size.Width * 0.7f,
                                     ((tableEntries.Count + deltaTableEntries.Count + 1) * 19f) + 20);

            tableEntries.ForEachWithIndex((entry, index) =>
            {
                var font = index % 2 == 0 ? tableRow : tableRowB;
                font.DrawText(entry, coordX, coordY + ((index + 1) * 19f));
            });

            deltaTableEntries.ForEachWithIndex((entry, index) =>
            {
                deltaTableRow.DrawText(entry, coordX, coordY + ((tableEntries.Count + index + 1) * 19f));
            });
        }
Пример #21
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (Hud.Game.SpecialArea != SpecialArea.GreaterRift)
            {
                return;
            }
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }

            var ui = Hud.Render.GreaterRiftBarUiElement;

            if (!ui.Visible)
            {
                return;
            }

            var secondsLeft = (Hud.Game.CurrentTimedEventEndTick - (double)Hud.Game.CurrentGameTick) / 60.0d;
            var percent     = Hud.Game.RiftPercentage;

            if (!(secondsLeft > 0))
            {
                return;
            }

            string text;
            var    _x       = 9000000000 / ui.Rectangle.Width;
            var    currentX = ui.Rectangle.Left + ui.Rectangle.Width / 100.0f * percent;
            var    timeX    = ui.Rectangle.Right - (float)(ui.Rectangle.Width / 900.0f * secondsLeft);
            var    _time    = (currentX - timeX) * _x;

            if (_time <= 0)
            {
                text        = "- " + ValueToString((long)_time, ValueFormat.LongTime);
                currentFont = MalusTimeFont;
            }
            else
            {
                text        = "+ " + ValueToString((long)_time, ValueFormat.LongTime);
                currentFont = BonusTimeFont;
            }

            var textLayout = currentFont.GetTextLayout(text);
            var x          = (float)currentX - textLayout.Metrics.Width / 2;
            var y          = ui.Rectangle.Top - ui.Rectangle.Height * 0.1f - textLayout.Metrics.Height;

            currentFont.DrawText(textLayout, x, y);
        }
Пример #22
0
        protected override void OnRedraw()
        {
            Display.Clear(Color.Blue);

            surf.InterpolationHint = InterpolationMode.Fastest;
            surf.Draw(10, 10);

            IFont font = Font.AgateSans;

            font.Size = 30;
            font.DrawText(10, 500, "Chonky chonk chonk");

            surf2.InterpolationHint = InterpolationMode.Nicest;
            surf2.Draw(420, 10);
        }
Пример #23
0
        private static void RenderToFrameBuffer(FrameBuffer myBuffer, IFont font)
        {
            FrameBuffer save = Display.RenderTarget;

            Display.RenderTarget = myBuffer;
            Display.BeginFrame();

            Display.Clear(Color.Blue);
            Display.Primitives.FillRect(Color.Black, new Rectangle(2, 2, 20, 20));

            font.Color = Color.Red;
            font.DrawText(3, 3, "HELLO WORLD");

            Display.EndFrame();

            Display.RenderTarget = save;
        }
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }
            if (!IsGreaterRift)
            {
                return;
            }

            var ui = Hud.Render.GreaterRiftBarUiElement;

            if (ui == null || !ui.Visible)
            {
                return;
            }
            var secondsElapsed = riftQuest.StartedOn.ElapsedMilliseconds;
            var percent        = (float)Hud.Game.RiftPercentage;

            if (secondsElapsed > greaterriftMaxTimeMilliseconds)
            {
                return;
            }

            string text;
            var    _myTime_ms   = percent * 9000f - secondsElapsed - pauseTimer.ElapsedMilliseconds;
            var    _myTime_span = TimeSpan.FromMilliseconds(_myTime_ms);

            if (_myTime_ms <= 0)
            {
                text        = "- " + String.Format(CultureInfo.InvariantCulture, MinutesSecondsFormat, _myTime_span);
                currentFont = MalusTimeFont;
            }
            else
            {
                text        = "+ " + String.Format(CultureInfo.InvariantCulture, MinutesSecondsFormat, _myTime_span);
                currentFont = BonusTimeFont;
            }

            var textLayout = currentFont.GetTextLayout(text);
            var x          = ui.Rectangle.Left + ui.Rectangle.Width / 100.0f * percent - textLayout.Metrics.Width / 2;
            var y          = ui.Rectangle.Top - ui.Rectangle.Height * 0.1f - textLayout.Metrics.Height;

            currentFont.DrawText(textLayout, x, y);
        }
Пример #25
0
        public void Run(string[] args)
        {
            using (new DisplayWindowBuilder(args)
                   .BackbufferSize(800, 600)
                   .QuitOnClose()
                   .Build())
            {
                font      = Font.AgateSans;
                font.Size = 14;

                Input.Unhandled.MouseDown += Mouse_MouseDown;
                Input.Unhandled.KeyDown   +=
                    (sender, e) => done    = e.KeyCode == KeyCode.Escape;

                mySurface = new Surface("9ball.png");

                while (AgateApp.IsAlive && done == false)
                {
                    Display.RenderTarget = Display.CurrentWindow.FrameBuffer;
                    Display.BeginFrame();
                    Display.Clear(Color.Gray);

                    font.Color            = Color.White;
                    font.DisplayAlignment = OriginAlignment.TopLeft;
                    font.DrawText("Click or tap to create another frame buffer.");

                    int y = font.FontHeight;
                    int x = 10;
                    foreach (var surf in tests)
                    {
                        surf.Draw(x, y);
                        y += surf.DisplayHeight + 10;

                        if (y + 42 >= Display.CurrentWindow.Height)
                        {
                            y  = font.FontHeight;
                            x += 42;
                        }
                    }

                    Display.EndFrame();
                    AgateApp.KeepAlive();
                }
            }
        }
Пример #26
0
        protected void RenderValue(Graphics graphics, int x, int y)
        {
            IFont font = this.Parent.Parent.FontInfo.Font;

            if (null != font)
            {
                String value = this.property.ToString();

                int len = value.Length;

                while (font.TextLength(value, 0, len) > this.Bounds.Width / 2 - 16)
                {
                    len--;
                }

                font.DrawText(graphics, 4 + x + this.Bounds.X + this.Bounds.Width / 2, y + this.Bounds.Y + 4, value, 0, len);
            }
        }
Пример #27
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (Hud.Render.UiHidden)
            {
                return;
            }
            float x = Hud.Window.Size.Width * 0.75f;
            float y = Hud.Window.Size.Height * 0.01f;

            BKIngame = false;
            foreach (var player in Hud.Game.Players)//others
            {
                if (player.HeroClassDefinition.HeroClass == HeroClass.Necromancer)
                {
                    var Nayrs = player.Powers.GetBuff(476587);
                    if (!(Nayrs == null || !Nayrs.Active))
                    {
                        BKIngame = true;
                        textBuilder.Clear();
                        textBuilder.AppendFormat("{0:0.00}", Nayrs.TimeLeftSeconds[1]);
                        textBuilder.AppendLine();
                        textBuilder.AppendFormat("{0:0.00}", Nayrs.TimeLeftSeconds[2]);
                        textBuilder.AppendLine();
                        textBuilder.AppendFormat("{0:0.00}", Nayrs.TimeLeftSeconds[3]);
                        textBuilder.AppendLine();
                        textBuilder.AppendFormat("{0:0.00}", Nayrs.TimeLeftSeconds[4]);
                        textBuilder.AppendLine();
                        textBuilder.AppendFormat("{0:0.00}", Nayrs.TimeLeftSeconds[5]);
                        textBuilder.AppendLine();
                        textBuilder.AppendFormat("{0:0.00}", Nayrs.TimeLeftSeconds[6]);
                        textBuilder.AppendLine();//rat
                    }
                }
            }

            if (BKIngame)
            {
                var layout = GreenFont.GetTextLayout(textBuilder.ToString());
                GreenFont.DrawText(layout, x, y);
            }
        }
Пример #28
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }

            DrawSkillBrushes();

            if (Settings.Active)
            {
                watermarkEnabled.DrawText("pHelper", 4, Hud.Window.Size.Height * 0.966f);
            }
            else
            {
                watermarkDisabled.DrawText("pHelper", 4, Hud.Window.Size.Height * 0.966f);
            }

            if (Hud.Window.CursorInsideRect(4, Hud.Window.Size.Height * 0.966f, 70, 20))
            {
                version.DrawText("v" + ConfigPersistence.VERSION, 4, Hud.Window.Size.Height * 0.946f);
            }
        }
Пример #29
0
        public void Run(string[] args)
        {
            using (new DisplayWindowBuilder(args)
                   .BackbufferSize(800, 600)
                   .QuitOnClose()
                   .Build())
            {
                FrameBuffer myBuffer = new FrameBuffer(200, 35);

                IFont font = Font.AgateSans;
                RenderToFrameBuffer(myBuffer, font);

                var watch = System.Diagnostics.Stopwatch.StartNew();

                while (AgateApp.IsAlive)
                {
                    Display.BeginFrame();
                    Display.Clear(Color.Black);

                    myBuffer.RenderTarget.Draw(35, 35);
                    font.DrawText(38, 73, "HELLO WORLD");

                    Display.EndFrame();

                    AgateApp.KeepAlive();

                    if (watch.ElapsedMilliseconds > 3000)
                    {
                        RenderToFrameBuffer(myBuffer, font);

                        watch.Reset();
                        watch.Start();
                    }
                }
            }
        }
Пример #30
0
        private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref)
        {
            if (m.Rarity == ActorRarity.RareMinion && !ShowRareMinions)
            {
                return;                                                             //no minions
            }
            if (m.SummonerAcdDynamicId != 0)
            {
                return;                                                             //no clones
            }
            var    w      = m.CurHealth * w2 / m.MaxHealth;
            var    per    = LightFont.GetTextLayout((m.CurHealth * 100 / m.MaxHealth).ToString(PercentageDescriptor) + "%");
            var    y      = YPos + py * 8 * yref;
            IBrush cBrush = null;
            IFont  cFont  = null;

            //Brush selection
            switch (m.Rarity)
            {
            case ActorRarity.Boss:
                cBrush = BossBrush;
                break;

            case ActorRarity.Champion:
                cBrush = ChampionBrush;
                break;

            case ActorRarity.Rare:
                cBrush = RareBrush;
                break;

            case ActorRarity.RareMinion:
                cBrush = RareMinionBrush;
                break;

            default:
                cBrush = BackgroundBrush;
                break;
            }

            //Jugger Highlight
            if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut))
            {
                cFont  = RedFont;
                cBrush = RareJuggerBrush;
            }
            else
            {
                cFont = NameFont;
            }

            //Missing Highlight
            if (MissingHighlight && (m.Rarity == ActorRarity.Champion || m.Rarity == ActorRarity.Rare) && !m.IsOnScreen)
            {
                var missing = RedFont.GetTextLayout("⚠");
                RedFont.DrawText(missing, XPos - 17, y - py);
            }

            //Circle Non-Clones and Boss
            //if (CircleNonIllusion && m.SummonerAcdDynamicId == 0 && HasAffix(m, MonsterAffix.Illusionist) || m.Rarity == ActorRarity.Boss && ShowBossHitBox)
            //        HitBoxDecorator.Paint(layer, m, m.FloorCoordinate, string.Empty);

            //Show Debuffs on Monster
            if (ShowDebuffAndCC)
            {
                string textDebuff = null;
                if (m.Locust)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Locust";
                }
                //if (m.Palmed) textDebuff += (textDebuff == null ? "" : ", ") + "Palm";
                if (m.Haunted)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Haunt";
                }
                if (m.MarkedForDeath)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Mark";
                }
                if (m.Strongarmed)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Strongarm";
                }
                string textCC = null;
                //if (m.Frozen) textCC += (textCC == null ? "" : ", ") + "Frozen";
                //if (m.Chilled) textCC += (textCC == null ? "" : ", ") + "Chill";
                //if (m.Slow) textCC += (textCC == null ? "" : ", ") + "Slow";
                //if (m.Stunned) textCC += (textCC == null ? "" : ", ") + "Stun";
                if (m.Invulnerable)
                {
                    textCC += (textCC == null ? "" : ", ") + "Invulnerable";
                }
                //if (m.Blind) textCC += (textCC == null ? "" : ", ") + "Blind";
                var d = LightFont.GetTextLayout(textDebuff + (textDebuff != null && textCC != null ? " | " : "") + textCC);
                LightFont.DrawText(d, XPos + 65 + w2, y - py);
            }

            //Draw Rectangles
            BackgroundBrush.DrawRectangle(XPos, y, w2, h);
            BorderBrush.DrawRectangle(XPos, y, w2, h);
            cBrush.DrawRectangle(XPos, y, (float)w, h);
            LightFont.DrawText(per, XPos + 8 + w2, y - py);

            //Draw MonsterType
            if (ShowMonsterType)
            {
                var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized);
                cFont.DrawText(name, XPos + 3, y - py);
            }

            //increase linecount
            yref += 1.0f;
        }