Beispiel #1
0
        private static void window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            if (albionProcess.HasExited)
            {
                return;
            }
            var gfx = e.Graphics;

            IntPtr ptr = albionProcess.MainWindowHandle;

            GetWindowRect(ptr, ref albionWindowRect);
            //
            gfx.ClearScene();
            int textPadding = 20;
            int padding     = 30;
            var infoText    = new StringBuilder()
                              .Append("Process: ").Append(albionProcess.ProcessName.ToString().PadRight(textPadding))
                              .Append("FPS: ").Append(gfx.FPS.ToString().PadRight(textPadding))
                              .Append("FrameTime: ").Append(e.FrameTime.ToString().PadRight(textPadding))
                              .Append("FrameCount: ").Append(e.FrameCount.ToString().PadRight(textPadding))
                              .Append("DeltaTime: ").Append(e.DeltaTime.ToString().PadRight(textPadding))
                              .ToString();


            var titleBarHeight = SystemInformation.CaptionHeight; //

            gfx.DrawTextWithBackground(consolasFont, redBrush, transparentBrush, albionWindowRect.Left + padding + 10, albionWindowRect.Top + titleBarHeight + padding + 10, infoText);
            gfx.DrawRectangle(redBrush, albionWindowRect.Left + padding, albionWindowRect.Top + titleBarHeight + padding, albionWindowRect.Right - padding, albionWindowRect.Bottom - padding, 2);
            Random rnd = new Random();

            var point = new Point(albionWindowRect.Left + albionWindowRect.Width / 2, albionWindowRect.Top + albionWindowRect.Height / 2);

            gfx.DrawCrosshair(redBrush, point, 10, 1, CrosshairStyle.Gap);
        }
Beispiel #2
0
        private void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            gfx.ClearScene(_brushes["background"]);
            gfx.DrawBox2D(_brushes["black"], _brushes["black"], 0, 0, _window.Width, _window.Height, 0);
        }
Beispiel #3
0
        private void Window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            ProcessWindowHelper.GetWindowThreadProcessId(ProcessWindowHelper.GetForegroundWindow(), out int activeProcId);

            float xIndex = 10, yIndex = 10;

            if (activeProcId == _process.Id)
            {
                if (!_primeParts.Any())
                {
                    e.Graphics.DrawTextWithBackground(_font, _whiteBrush, _grayBrush, xIndex, yIndex, "No parts found");
                }

                foreach (PrimePart primePart in _primeParts)
                {
                    e.Graphics.DrawTextWithBackground(_font, _whiteBrush, _grayBrush, xIndex, yIndex, primePart.ToString());

                    yIndex += _font.FontSize + 5;
                }
            }
            else
            {
                e.Graphics.ClearScene();
            }
        }
        private void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            // you do not need to call BeginScene() or EndScene()
            var gfx = e.Graphics;

            gfx.ClearScene(_transparent); // set the background of the scene (can be transparent)

            gfx.DrawTextWithBackground(_font, _red, _black, 10, 10, "FPS: " + gfx.FPS);



            gfx.DrawCircle(_red, 100, 100, 50, 2);
            gfx.DashedCircle(_green, 250, 100, 50, 2);

            // Rectangle.Create takes x, y, width, height instead of left top, right, bottom
            gfx.DrawRectangle(_blue, Rectangle.Create(350, 50, 100, 100), 2);
            gfx.DrawRoundedRectangle(_red, RoundedRectangle.Create(500, 50, 100, 100, 6), 2);

            gfx.DrawTriangle(_green, 650, 150, 750, 150, 700, 50, 2);

            gfx.DrawLine(_blue, 50, 175, 750, 175, 2);
            gfx.DashedLine(_red, 50, 200, 750, 200, 2);

            gfx.OutlineCircle(_black, _red, 100, 275, 50, 4);
            gfx.FillCircle(_green, 250, 275, 50);

            // parameters will always stay in this order: outline color, inner color, position, stroke
            gfx.OutlineRectangle(_black, _blue, Rectangle.Create(350, 225, 100, 100), 4);
            gfx.FillRoundedRectangle(_red, RoundedRectangle.Create(500, 225, 100, 100, 6));

            gfx.FillTriangle(_green, 650, 325, 750, 325, 700, 225);
        }
        internal override void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            if (!Loaded)
            {
                return;
            }
            if (!_windowLoaded)
            {
                return;
            }

            e.Graphics.ClearScene();

            var layerUsed = false;

            if (!CurrentOpacity.CloseTo(1f))
            {
                var lp = new LayerParameters()
                {
                    ContentBounds = new RawRectangleF(0, 0, Window.Width, Window.Height), Opacity = CurrentOpacity
                };
                e.Graphics.LayerHelper.AddOpacity(lp);
                layerUsed = true;
            }

            DxWindow.Draw(e.Graphics);

            OnDraw?.Invoke(sender, e);

            if (layerUsed)
            {
                e.Graphics.LayerHelper.RemoveOpacity();
            }
        }
Beispiel #6
0
        private void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            var padding  = 16;
            var infoText = new StringBuilder()
                           .Append("FPS: ").Append(gfx.FPS.ToString().PadRight(padding))
                           .Append("FrameTime: ").Append(e.FrameTime.ToString().PadRight(padding))
                           .Append("FrameCount: ").Append(e.FrameCount.ToString().PadRight(padding))
                           .Append("DeltaTime: ").Append(e.DeltaTime.ToString().PadRight(padding))
                           .ToString();

            gfx.ClearScene(_brushes["background"]);

            gfx.DrawTextWithBackground(_fonts["consolas"], _brushes["green"], _brushes["black"], 58, 20, infoText);

            gfx.DrawGeometry(_gridGeometry, _brushes["grid"], 1.0f);

            if (_lastRandomSet == 0L || e.FrameTime - _lastRandomSet > 2500)
            {
                _lastRandomSet = e.FrameTime;
            }

            _random = new Random(unchecked ((int)_lastRandomSet));

            for (float row = _gridBounds.Top + 12; row < _gridBounds.Bottom - 120; row += 120)
            {
                for (float column = _gridBounds.Left + 12; column < _gridBounds.Right - 120; column += 120)
                {
                    DrawRandomFigure(gfx, column, row);
                }
            }
        }
Beispiel #7
0
        private void FlatSDK_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            if (ESPXOptions.bLoadColorsBTN == 1)
            {
                loadColorsFromFile(gfx);
                ESPXOptions.bLoadColorsBTN = 0;
            }
            if (ESPXOptions.bSaveBTN == 1)
            {
                SerializeStatic.Serialize(typeof(ESPXOptions), "ESPXCFG.xml");
                ESPXOptions.bSaveBTN = 0;
            }
            if (ESPXOptions.bLoadBTN == 1)
            {
                SerializeStatic.Deserialize(typeof(ESPXOptions), "ESPXCFG.xml");
                ESPXOptions.bLoadBTN = 0;
            }


            LocalPlayer = FlatSDK.GetLocalPlayer();

            if (LocalPlayer == null)
            {
                return;
            }
            if (LocalPlayer.extra == null)
            {
                return;
            }



            if (entityDrawPositions.Count > 0)
            {
                entityDrawPositions.Clear();
            }

            foreach (var entity in listEntityItems)
            {
                //var dump = ObjectDumper.Dump(entity.eItem);
                //var dump = ObjectDumper.Dump(entity);

                //if (entity.type != 82) { continue; }

                // Console.Write("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!n");
                //Console.Write(dump);
                //
                //myarray.Add(entity.eItem.id.ToString()  +  ":" + entity.eItem.gname.ToString() );
                try
                {
                    DrawItemWeapon(gfx, entity, entity.eItem.id.ToString());
                }
                catch {
                    Console.Write("DrawItemWeapon error\n");
                }
            }
        }
 protected override void InternalRenderPreparation(StackPanelElement element, DrawGraphicsEventArgs renderArgs)
 {
     base.InternalRenderPreparation(element, renderArgs);
     foreach (var child in element.ChildElements)
     {
         RendererResolver.Renderers[child.GetType()].PrepareToRender(child, renderArgs);
     }
 }
Beispiel #9
0
        private static void Overlay_OnDraw(object sender, DrawGraphicsEventArgs e)
        {
            if (!Loaded)
            {
                return;
            }

            //g.Graphics.DrawTextWithBackground(FontCollection.Get("Window.Title.Font").Font, BrushCollection.Get("Window.Font").Brush, BrushCollection.Get("Control.Fill.Pressed").Brush, 50, 50, 300, 300, "qweasdzxc\nqweqweqweasdasdasdasdasd", TextAlignment.Trailing);
        }
Beispiel #10
0
        private static void Overlay_OnPreDraw(object sender, DrawGraphicsEventArgs e)
        {
            if (!Loaded)
            {
                return;
            }

            //l.Text = $"{g.Graphics.MeasureText(textbox.Text.Substring(0, textbox.CaretPos), FontCollection.Get("Control.Font").Font).Width}";
            //l1.Text = $"{g.Graphics.MeasureText(textbox.Text.Substring(0, textbox.CaretPos + 1), FontCollection.Get("Control.Font").Font).Width}";
        }
Beispiel #11
0
        private void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            gfx.ClearScene(_brushes["background"]);

            gfx.DrawText(_fonts["arial"], 22, _brushes["white"], 20, 20, $"FPS: {gfx.FPS}");
            gfx.DrawRectangle(_brushes["white"], 20, 60, 400, 400, 1.0f);

            gfx.DrawText(_fonts["arial"], 22, _brushes["white"], 40, 100, $"Count: {e.FrameCount}");
            gfx.DrawText(_fonts["arial"], 22, _brushes["white"], 40, 130, $"Time: {e.FrameTime}");
            gfx.DrawText(_fonts["arial"], 22, _brushes["white"], 40, 160, $"Delta: {e.DeltaTime}");
        }
Beispiel #12
0
        private void DrawWindowGraphics(object sender, DrawGraphicsEventArgs e)
        {
            this.window.PlaceAbove(this.garouWindow);

            Graphics gfx = e.Graphics;

            gfx.ClearScene();

            DrawInfoText(gfx);
            if (ShowInputHistory)
            {
                DrawInputHistory(gfx, effectiveInputsP1, AnchorPoint.LEFT);
                DrawInputHistory(gfx, effectiveInputsP2, AnchorPoint.RIGHT);
            }
        }
Beispiel #13
0
        private void OnDrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            onDrawGraphics.Invoke();

            try
            {
                Draw();
            }
            catch (Exception exception)
            {
                Program.WriteToLog(exception);
                MessageBox.Show(new Form(), @"Exception in HUD draw. Written to crash.txt.");
                Close();
            }
        }
 private void ApplyEffects <T>(T element, DrawGraphicsEventArgs renderArgs) where T : RenderElement
 {
     if (!(element.Effects?.Any() ?? false))
     {
         return;
     }
     foreach (var effect in element.Effects)
     {
         var effectType = effect.GetType();
         if (EffectPlayerResolver.EffectPlayers.Keys.Contains(effectType))
         {
             EffectPlayerResolver.EffectPlayers[effectType].ApplyEffect(element, effect, renderArgs);
         }
     }
 }
        private void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            var padding  = 16;
            var infoText = new StringBuilder()
                           .Append("Ping: ").Append(_pingNum).Append(" ms".PadRight(padding))
                           .ToString();

            gfx.ClearScene(_brushes["background"]);

            // Determine where to draw the text
            var   text_size       = gfx.MeasureString(_fonts["consolas"], FONT_SIZE, infoText);
            float centered_text_x = ((float)_screenWidth / 2.0F) - (text_size.X / 2.0F);

            gfx.DrawTextWithBackground(_fonts["consolas"], _brushes["green"], _brushes["black"], centered_text_x, 20, infoText);
        }
        public void Render <T>(T element, AudioPlayer audioPlayer, DrawGraphicsEventArgs renderArgs) where T : RenderElement
        {
            PrepareToRender(element, renderArgs);
            ApplyEffects(element, renderArgs);

            var gfx = renderArgs.Graphics;

            gfx.ClipRegionStart(element.AbsoluteRenderArea.ToOverlayRectangle());

            if (element.Rotation != null)
            {
                gfx.TransformStart(TransformationMatrix.Rotation(element.Rotation.Rotation,
                                                                 element.Rotation.RotationCenter.HasValue ?
                                                                 element.Rotation.RotationCenter.Value.ToOverlayPoint() :
                                                                 new Point(element.AbsoluteLocation.X + (element.Size.X / 2f), element.AbsoluteLocation.Y + (element.Size.Y / 2f))));
            }

            InternalRender(element, audioPlayer, renderArgs);

            var time = audioPlayer.CurrentTime.TotalMilliseconds + Offset;

            foreach (var child in element.ChildElements)
            {
                if (child.EndAt < time)
                {
                    continue;
                }
                if (child.StartAt > time)
                {
                    break;
                }

                var type = child.GetType();
                if (RendererResolver.Renderers.ContainsKey(type))
                {
                    RendererResolver.Renderers[type].Render(child, audioPlayer, renderArgs);
                }
            }

            if (element.Rotation != null)
            {
                gfx.TransformEnd();
            }

            gfx.ClipRegionEnd();
        }
Beispiel #17
0
        private void Window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            Graphics gfx = e.Graphics;

            gfx.ClearScene();
            gfx.BeginScene();
            WallHack(gfx);

            if (b_KeyboardDown)
            {
                gfx.DrawText(font, Brushes["teammate"], 0, Window.Height / 2, $"Aimbot: On");
            }
            else
            {
                gfx.DrawText(font, Brushes["enemy"], 0, Window.Height / 2, $"Aimbot: Off");
            }

            gfx.EndScene();
        }
Beispiel #18
0
        private void OnDrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            window.PlaceAbove(handle); // FIXME: Sometimes the overlay goes behind the target window.

            var gfx = e.Graphics;

            gfx.ClearScene();

            lock (bufferLock)
            {
                var clientRect = Helpers.ScreenHelper.ClientRectangle(handle);
                foreach (var rectangle in read.Rectangles)
                {
                    var geom = new Rectangle(rectangle.Rectangle.Left - clientRect.Left,
                                             rectangle.Rectangle.Top - clientRect.Top,
                                             rectangle.Rectangle.Right - clientRect.Left,
                                             rectangle.Rectangle.Bottom - clientRect.Top);

                    if (rectangle.FillColor.A > 0)
                    {
                        gfx.DrawRectangle(Brush(rectangle.FillColor), geom, 0);
                    }

                    if (rectangle.StrokeThickness > 0 && rectangle.StrokeColor.A > 0)
                    {
                        gfx.DrawRectangleEdges(Brush(rectangle.StrokeColor), geom, rectangle.StrokeThickness);
                    }
                }

                foreach (var circle in read.Circles)
                {
                    var geom = new Circle(new Point(circle.Center.X - clientRect.Left,
                                                    circle.Center.Y - clientRect.Top), (float)circle.Radius);

                    gfx.DrawCircle(Brush(circle.StrokeColor), geom, circle.StrokeThickness);
                }

                foreach (var text in read.Text)
                {
                    gfx.DrawText(defaultFont, text.Size, Brush(text.Color), text.Position.X - clientRect.Left, text.Position.Y - clientRect.Top, text.Text);
                }
            }
        }
        private void Window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            gfx.BeginScene();

            // set the background of the scene (the whole screen; transparent)
            gfx.ClearScene();

            // make rectangular overlays on the left and right sides of the screen
            GameOverlay.Drawing.Rectangle rectangleLeft  = GameOverlay.Drawing.Rectangle.Create(0, 0, overlayWidthLeft, actualScreenHeight);
            GameOverlay.Drawing.Rectangle rectangleRight = GameOverlay.Drawing.Rectangle.Create(actualScreenWidth - overlayWidthRight, 0, overlayWidthRight, actualScreenHeight);

            gfx.DrawRectangle(red, rectangleLeft, 0);
            gfx.FillRectangle(red, rectangleLeft);

            gfx.DrawRectangle(red, rectangleRight, 0);
            gfx.FillRectangle(red, rectangleRight);

            gfx.EndScene();
        }
Beispiel #20
0
        private void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            var g = e.Graphics;

            var padding = 16;

            g.ClearScene(_brushes["transparent"]);

            //g.FillRectangle(_brushes["transparent"], 0, 0, screenWidth, screenHeight);

            g.DrawGeometry(bigGridGeometry, lineBrush, StrokeSize);
            g.DrawGeometry(smallGridGeometry, secondaryLineBrush, SecondaryStrokeSize);

            for (int i = 0; i < numberPositionsX.Length; i++)
            {
                g.DrawText(gridNumberFont, numberColorsX[i], numberPositionsX[i].X, numberPositionsX[i].Y, labelsX[i]);
                g.DrawText(gridNumberFont, numberColorsY[i], numberPositionsY[i].X, numberPositionsY[i].Y, labelsY[i]);
                //g.DrawText(gridNumberFont, textXBrushShadow, numberPositionsX[i].X+4, numberPositionsX[i].Y, labelsX[i]);
                //g.DrawText(gridNumberFont, textYBrushShadow, numberPositionsY[i].X, numberPositionsY[i].Y+4, labelsY[i]);
            }
        }
Beispiel #21
0
        private void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            try
            {
                Graphics gfx = e.Graphics;
                if (_window.X != config.Overlay_x || _window.Y != config.Overlay_y || _window.Width != config.Overlay_width || _window.Height != config.Overlay_height)
                {
                    _window.X      = config.Overlay_x;
                    _window.Y      = config.Overlay_y;
                    _window.Width  = config.Overlay_width;
                    _window.Height = config.Overlay_height;
                    _window.Recreate();
                }

                if (_fonts["consolas"].FontSize != config.Overlay_FontSize)
                {
                    SetOverlayFonts();
                }

                var infoText = new StringBuilder().ToString();
                foreach (string s in LastLines)
                {
                    string newLine = $"{s}\r\n";
                    Point  p       = gfx.MeasureString(_fonts["consolas"], config.Overlay_FontSize, newLine);

                    if (p.X > _window.Width)
                    {
                        string newLines = "";
                        newLine = s;

                        float ratio     = _window.Width / p.X;
                        float part      = p.X / _window.Width;
                        float lenString = ratio * newLine.Length;

                        for (int i = 1; i < part + 1; i++)
                        {
                            float lenNewLines = (newLine.Length < lenString ? newLine.Length - 1 : (int)lenString);;
                            newLines += $"{newLine.Substring(0, (int)lenNewLines)}\r\n";
                            newLine   = newLine[(int)lenNewLines..];
Beispiel #22
0
        private void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            var abs = shinyMain.Current.BoundingRectangle.Location.ToDrawing();

            var gfx = e.Graphics;

            var padding  = 16;
            var infoText = new StringBuilder()
                           .Append("FPS: ").Append(gfx.FPS.ToString().PadRight(padding))
                           .Append("FrameTime: ").Append(e.FrameTime.ToString().PadRight(padding))
                           .Append("FrameCount: ").Append(e.FrameCount.ToString().PadRight(padding))
                           .Append("DeltaTime: ").Append(e.DeltaTime.ToString().PadRight(padding))
                           .ToString();

            gfx.ClearScene();

            if (GetForegroundWindow() != hwnd)
            {
                return;
            }


            gfx.DrawTextWithBackground(_fonts["consolas"], _brushes["green"], _brushes["black"], 250, 3, infoText);

            if (FftpLabelLocation != null)
            {
                gfx.DrawText(_fonts["calibri"], _brushes["white"], new Point(FftpLabelLocation.X - abs.X + 75, FftpLabelLocation.Y - abs.Y), "& Penny Dreadful");
            }

            if (DeckListErrors != null)
            {
                foreach (var error in DeckListErrors)
                {
                    gfx.DrawText(_fonts["consolas"], _brushes["red"], new Point(error.X - abs.X - 20, error.Y - abs.Y + 2), "🚫");
                }
            }
        }
Beispiel #23
0
        private static void FlatSDK_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            if (ESPOptions.bSaveBTN == 1)
            {
                SerializeStatic.Serialize(typeof(ESPOptions), "ESPCFG.xml");
                ESPOptions.bSaveBTN = 0;
            }
            if (ESPOptions.bLoadBTN == 1)
            {
                SerializeStatic.Deserialize(typeof(ESPOptions), "ESPCFG.xml");
                ESPOptions.bLoadBTN = 0;
            }


            LocalPlayer = FlatSDK.GetLocalPlayer();

            if (LocalPlayer == null)
            {
                return;
            }
            if (LocalPlayer.extra == null)
            {
                return;
            }

            foreach (var ent in FlatSDK.GetEntities())
            {
                if (ent.type != 82)
                {
                    continue;
                }

                DrawBlip(gfx, ent);
            }
        }
Beispiel #24
0
        protected override void InternalRenderPreparation(ImageElement element, DrawGraphicsEventArgs renderArgs)
        {
            base.InternalRenderPreparation(element, renderArgs);
            if (element.AutoSize)
            {
                return;
            }
            if (element.ParentElement == null)
            {
                return;
            }
            if (!ImageElements.ContainsKey(element))
            {
                return;
            }

            var image = ImageElements[element];

            if (image.Bitmap?.IsDisposed ?? true)
            {
                return;
            }

            var ratio = image.Width / image.Height;

            if (element.Dock == ElementDock.None)
            {
                FillAsMuchAsPossible(element, image);
                return;
            }



            var currentHeight = element.Size.Y;
            // element.Size = new System.Drawing.Point(ratio * currentHeight)
        }
Beispiel #25
0
        private void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            gfx.ClearScene(_brushes["background"]);

            gfx.FillRoundedRectangle(_brushes["black"], 0, 0, 500, 100, 8.0f);

            for (int i = 1; i < _plrNames.Length; i += 2)
            {
                if (_plrNames[i] != "")
                {
                    gfx.DrawText(_fonts["consolas"], _brushes["green"], 10, i * 10, _plrNames[i] + " " + _plrRanks[i]);
                }
            }

            for (int i = 2; i < _plrNames.Length; i += 2)
            {
                if (_plrNames[i] != "")
                {
                    gfx.DrawText(_fonts["consolas"], _brushes["green"], 300, (i * 10) - 10, _plrNames[i] + " " + _plrRanks[i]);
                }
            }
        }
Beispiel #26
0
 internal abstract void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e);
Beispiel #27
0
        private void Draw(object sender, DrawGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            gfx.ClearScene(_brushes["transparent"]);

            float x          = 0f;
            float incrementY = 25f;
            float leaderboardStatsOffsetX = 250f;
            float y = 0 + incrementY;

            // stats drawing
            //gfx.ClearScene(_brushes["stats_background"]);
            // data limit
            gfx.DrawTextWithBackground(_fonts["consolas"],
                                       _brushes["gray"],
                                       _brushes["stats_background"],
                                       x,
                                       y,
                                       $"Data limit: {Math.Round(StatsDataStore.DataUsed, 2)}%");
            y += incrementY;

            // custom messages if any
            CustomMessages.ForEach(m =>
            {
                gfx.DrawTextWithBackground(_fonts["consolas"],
                                           _brushes["gray"],
                                           _brushes["stats_background"],
                                           x,
                                           y,
                                           m);
                y += incrementY;
            });

            // headers
            gfx.DrawTextWithBackground(_fonts["consolas"],
                                       _brushes["white"],
                                       _brushes["stats_background"],
                                       x,
                                       y,
                                       BuildHeader().ToString());
            y += incrementY;

            // stats
            StatsDataStore
            .GetData()
            .OrderBy(d => d.Stats.Value)
            .Select(r => BuildEntryRowString(r)).ToList()
            .ForEach(r =>
            {
                var(displayString, data) = r;
                gfx.DrawTextWithBackground(_fonts["consolas"],
                                           _brushes[GetColor(data)],
                                           _brushes["stats_background"],
                                           x,
                                           y,
                                           displayString.ToString());
                y += incrementY;
            });

            // leaderboard drawing
            // reset coords
            x = 0;
            y = 0 + incrementY;
            // headers
            gfx.DrawTextWithBackground(_fonts["consolas"],
                                       _brushes["white"],
                                       _brushes["stats_background"],
                                       x + leaderboardStatsOffsetX,
                                       y,
                                       BuildHeaderLeaderboard().ToString());
            y += incrementY;
            // sub header
            gfx.DrawTextWithBackground(_fonts["consolas"],
                                       _brushes["light gray"],
                                       _brushes["stats_background"],
                                       x + leaderboardStatsOffsetX,
                                       y,
                                       BuildSubHeaderLeaderboard().ToString());
            y += incrementY;
            // leaderboard pos
            StatsDataStore
            .GetDataLeaderboard()
            .OrderBy(d => d.PositionType)
            .Select(r => BuildEntryRowString(r)).ToList()
            .ForEach(r =>
            {
                // main line
                var(posLine, data) = r;
                gfx.DrawTextWithBackground(_fonts["consolas"],
                                           _brushes[GetColor(data)],
                                           _brushes["stats_background"],
                                           x + leaderboardStatsOffsetX,
                                           y,
                                           posLine.ToString());
                y += incrementY;
                // sub lines
                var detailLines = data.Positions.Select(p => BuildEntryDetailRowString(p));
                foreach (var line in detailLines)
                {
                    var(sb, detailData) = line;
                    gfx.DrawTextWithBackground(_fonts["consolas"],
                                               detailData.Roe > 0 ? _brushes["dimmed green"] : _brushes["dimmed red"],
                                               _brushes["stats_background"],
                                               x + leaderboardStatsOffsetX,
                                               y,
                                               sb.ToString());
                    y += incrementY;
                }
            });

            var(xOffset, yOffset) = WindowDataStore.GetLastOffets();
            _window.X            += xOffset;
            _window.Y            += yOffset;
        }
Beispiel #28
0
    private void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
    {
        var gfx = e.Graphics;

        gfx.ClearScene(_brushes["transparency"]);

        if (isDraw)
        {
            ResizeWindow(gfx);

            // 绘制帧数
            gfx.DrawText(_fonts["Microsoft YaHei"], 12, _brushes["green"], 10, _window.Height / 3, $"FPS:{gfx.FPS}");

            ///////////////////////////////////////////////////////
            //                 用户自定义绘制区域                   //
            ///////////////////////////////////////////////////////

            // 视角宽和视角高
            gview_width  = windowData.Width / 2;
            gview_height = windowData.Height / 2;

            long m_ped_factory = Memory.Read <long>(Globals.WorldPTR);
            long m_local_ped   = Memory.Read <long>(m_ped_factory + 0x08);

            // 自己坐标
            long    pCNavigation = Memory.Read <long>(m_local_ped + 0x30);
            Vector3 myPosV3      = Memory.Read <Vector3>(pCNavigation + 0x50);

            /////////////////////////////////////////////////////////////////////

            // 玩家列表
            long pPlayerListPTR = Memory.Read <long>(Globals.NetworkPlayerMgrPTR);
            int  playerCount    = Memory.Read <int>(pPlayerListPTR + 0x178);

            // Ped数量
            long m_replay        = Memory.Read <long>(Globals.ReplayInterfacePTR);
            long m_ped_interface = Memory.Read <long>(m_replay + 0x18);
            int  m_max_peds      = Memory.Read <int>(m_ped_interface + 0x108);
            int  m_cur_peds      = Memory.Read <int>(m_ped_interface + 0x110);

            gfx.DrawText(_fonts["Microsoft YaHei"], 12, _brushes["blue"], 10, _window.Height / 3 + 30,
                         $"GTA5线上小助手\n\nX: {myPosV3.X:0.0000}\nY: {myPosV3.Y:0.0000}\nZ: {myPosV3.Z:0.0000}\n\n" +
                         $"玩家数量: {playerCount}\nPed数量: {m_cur_peds}");

            long pAimingPedPTR = Memory.Read <long>(Globals.AimingPedPTR);
            bool isAimPed      = Memory.Read <long>(pAimingPedPTR + 0x280) > 0;

            if (Settings.Overlay.ESP_Crosshair)
            {
                // 当玩家按住右键准心对准敌人,准心变成粉红色,否则为绿色
                if (isAimPed && Convert.ToBoolean(WinAPI.GetKeyState((int)WinVK.RBUTTON) & WinAPI.KEY_PRESSED))
                {
                    DrawCrosshair(gfx, _brushes["deepPink"], 7.0f, 1.5f);
                }
                else
                {
                    DrawCrosshair(gfx, _brushes["green"], 7.0f, 1.5f);
                }
            }

            ///////////////////////////////////////////////////////

            for (int i = 0; i < m_max_peds; i++)
            {
                long m_ped_list = Memory.Read <long>(m_ped_interface + 0x100);
                m_ped_list = Memory.Read <long>(m_ped_list + i * 0x10);
                if (!Memory.IsValid(m_ped_list))
                {
                    continue;
                }

                // 如果是自己,跳过
                if (m_local_ped == m_ped_list)
                {
                    continue;
                }

                // 如果ped死亡,跳过
                float ped_Health = Memory.Read <float>(m_ped_list + 0x280);
                if (ped_Health <= 0)
                {
                    continue;
                }

                float ped_MaxHealth    = Memory.Read <float>(m_ped_list + 0x2A0);
                float ped_HPPercentage = ped_Health / ped_MaxHealth;

                long m_player_info = Memory.Read <long>(m_ped_list + 0x10C8);
                //if (!Memory.IsValid(m_player_info))
                //    continue;

                string pedName = Memory.ReadString(m_player_info + 0xA4, null, 20);

                // 绘制玩家
                if (!Settings.Overlay.ESP_Player)
                {
                    if (pedName != "")
                    {
                        continue;
                    }
                }

                // 绘制Ped
                if (!Settings.Overlay.ESP_NPC)
                {
                    if (pedName == "")
                    {
                        continue;
                    }
                }

                long m_navigation = Memory.Read <long>(m_ped_list + 0x30);
                if (!Memory.IsValid(m_navigation))
                {
                    continue;
                }

                // ped坐标
                var pedPosV3 = Memory.Read <Vector3>(m_navigation + 0x50);

                // Ped与自己的距离
                float myToPedDistance = (float)Math.Sqrt(
                    Math.Pow(myPosV3.X - pedPosV3.X, 2) +
                    Math.Pow(myPosV3.Y - pedPosV3.Y, 2) +
                    Math.Pow(myPosV3.Z - pedPosV3.Z, 2));

                // m_heading    0x20
                // m_heading2   0x24
                var v2PedSinCos = new Vector2
                {
                    X = Memory.Read <float>(m_navigation + 0x20),
                    Y = Memory.Read <float>(m_navigation + 0x30)
                };

                if (Settings.Overlay.ESP_3DBox)
                {
                    if (pedName != "")
                    {
                        // 玩家 3DBox
                        DrawAABBBox(gfx, _brushes["red"], pedPosV3, v2PedSinCos);
                    }
                    else
                    {
                        // Ped 3DBox
                        DrawAABBBox(gfx, _brushes["white"], pedPosV3, v2PedSinCos);
                    }
                }

                Vector2 pedPosV2 = WorldToScreen(pedPosV3);
                Vector2 pedBoxV2 = GetBoxWH(pedPosV3);

                if (!IsNullVector2(pedPosV2))
                {
                    //int ped_type = Memory.Read<int>(m_ped_list + 0x10B8);
                    //ped_type = ped_type << 11 >> 25;
                    //Draw2DNameText(gfx, _brushes["white"], pedPosV2, pedBoxV2, ped_type.ToString(), myToPedDistance);

                    if (pedName != "")
                    {
                        if (Settings.Overlay.ESP_2DBox)
                        {
                            // 2D方框
                            Draw2DBox(gfx, _brushes["red"], pedPosV2, pedBoxV2, 0.7f);
                        }

                        if (Settings.Overlay.ESP_2DLine)
                        {
                            if (Settings.Overlay.ESP_2DBox)
                            {
                                // 2DBox射线
                                Draw2DLine(gfx, _brushes["red"], pedPosV2, pedBoxV2, 0.7f);
                            }
                            else
                            {
                                // 3DBox射线
                                DrawAABBLine(gfx, _brushes["red"], pedPosV3, 0.7f);
                            }
                        }

                        if (Settings.Overlay.ESP_2DHealthBar)
                        {
                            if (Settings.Overlay.ESP_2DBox)
                            {
                                // 2DBox血条
                                Draw2DHealthBar(gfx, _brushes["green"], pedPosV2, pedBoxV2, ped_HPPercentage, 0.7f);
                            }
                            else
                            {
                                // 3DBox血条
                                Draw3DHealthBar(gfx, _brushes["green"], pedPosV2, pedBoxV2, ped_HPPercentage, 0.7f);
                            }
                        }

                        if (Settings.Overlay.ESP_HealthText)
                        {
                            if (Settings.Overlay.ESP_2DBox)
                            {
                                // 2DBox血量数字
                                Draw2DHealthText(gfx, _brushes["red"], pedPosV2, pedBoxV2, ped_Health, ped_MaxHealth, i);
                            }
                            else
                            {
                                // 3DBox血量数字
                                Draw3DHealthText(gfx, _brushes["red"], pedPosV2, pedBoxV2, ped_Health, ped_MaxHealth, i);
                            }
                        }

                        if (Settings.Overlay.ESP_NameText)
                        {
                            if (Settings.Overlay.ESP_2DBox)
                            {
                                // 2DBox玩家名称
                                Draw2DNameText(gfx, _brushes["red"], pedPosV2, pedBoxV2, pedName, myToPedDistance);
                            }
                            else
                            {
                                // 3DBox玩家名称
                                Draw3DNameText(gfx, _brushes["red"], pedPosV2, pedBoxV2, pedName, myToPedDistance);
                            }
                        }
                    }
                    else
                    {
                        if (Settings.Overlay.ESP_2DBox)
                        {
                            // 2D方框
                            Draw2DBox(gfx, _brushes["white"], pedPosV2, pedBoxV2, 0.7f);
                        }

                        if (Settings.Overlay.ESP_2DLine)
                        {
                            if (Settings.Overlay.ESP_2DBox)
                            {
                                // 2DBox射线
                                Draw2DLine(gfx, _brushes["white"], pedPosV2, pedBoxV2, 0.7f);
                            }
                            else
                            {
                                // 3DBox射线
                                DrawAABBLine(gfx, _brushes["white"], pedPosV3, 0.7f);
                            }
                        }

                        if (Settings.Overlay.ESP_2DHealthBar)
                        {
                            if (Settings.Overlay.ESP_2DBox)
                            {
                                // 2DBox血条
                                Draw2DHealthBar(gfx, _brushes["green"], pedPosV2, pedBoxV2, ped_HPPercentage, 0.7f);
                            }
                            else
                            {
                                // 3DBox血条
                                Draw3DHealthBar(gfx, _brushes["green"], pedPosV2, pedBoxV2, ped_HPPercentage, 0.7f);
                            }
                        }

                        if (Settings.Overlay.ESP_HealthText)
                        {
                            if (Settings.Overlay.ESP_2DBox)
                            {
                                // 2DBox血量数字
                                Draw2DHealthText(gfx, _brushes["white"], pedPosV2, pedBoxV2, ped_Health, ped_MaxHealth, i);
                            }
                            else
                            {
                                // 3DBox血量数字
                                Draw3DHealthText(gfx, _brushes["white"], pedPosV2, pedBoxV2, ped_Health, ped_MaxHealth, i);
                            }
                        }

                        if (Settings.Overlay.ESP_NameText)
                        {
                            if (Settings.Overlay.ESP_2DBox)
                            {
                                // 2DBox玩家名称
                                Draw2DNameText(gfx, _brushes["white"], pedPosV2, pedBoxV2, pedName, myToPedDistance);
                            }
                            else
                            {
                                // 3DBox玩家名称
                                Draw3DNameText(gfx, _brushes["white"], pedPosV2, pedBoxV2, pedName, myToPedDistance);
                            }
                        }
                    }

                    //int pedEntityType = Memory.Read<int>(ped_offset_0 + 0x10B8);
                    //byte pedEntityType = Memory.Read<byte>(ped_offset_0 + 0x2B);
                    //byte oHostility = Memory.Read<byte>(ped_offset_0 + 0x18C);

                    //pedEntityType = pedEntityType >> 14 & 0x1F;

                    //gfx.DrawText(_fonts["Microsoft YaHei"], 10, _brushes["red"],
                    //    pedPosV2.X, pedPosV2.Y,
                    //    $"Type : {pedEntityType}");
                }

                if (Settings.Overlay.ESP_Bone)
                {
                    // 骨骼
                    DrawBone(gfx, m_ped_list, 0, 7);
                    DrawBone(gfx, m_ped_list, 7, 8);
                    DrawBone(gfx, m_ped_list, 8, 3);
                    DrawBone(gfx, m_ped_list, 8, 4);
                    DrawBone(gfx, m_ped_list, 7, 5);
                    DrawBone(gfx, m_ped_list, 7, 6);
                }
            }
        }
    }
Beispiel #29
0
        private void _window_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            Draw(gfx);
        }
Beispiel #30
0
        private static void FlatSDK_DrawGraphics(object sender, DrawGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            if (AimOptions.bSaveBTN == 1)
            {
                SerializeStatic.Serialize(typeof(AimOptions), "AimCFG.xml");
                AimOptions.bSaveBTN = 0;
            }
            if (AimOptions.bLoadBTN == 1)
            {
                SerializeStatic.Deserialize(typeof(AimOptions), "AimCFG.xml");
                AimOptions.bLoadBTN = 0;
            }

            LocalPlayer = FlatSDK.GetLocalPlayer();

            if (LocalPlayer == null)
            {
                return;
            }
            if (LocalPlayer.extra == null)
            {
                return;
            }

            var entList = GetEntitiesAsArray();

            var AimTargets = new AimTarget[entList.Length];

            float fClosestDist = -1;

            float ScreenCenterX = FlatSDK.Overlay.Width / 2.0f;
            float ScreenCenterY = FlatSDK.Overlay.Height / 2.0f;


            if (AimOptions.bDrawFow == 1)
            {
                gfx.DrawCircle(FlatSDKInternal.IRenderer._opakwhite, ScreenCenterX, ScreenCenterY, AimOptions.bFovArray[AimOptions.bFovInt], 2);
            }



            for (int i = 0; i < entList.Length; i++)
            {
                var current = entList[i];
                if (current.type != 82)
                {
                    continue;
                }


                var clampPos = current.HeadBone.position - current.position;


                bool w2sHead = FlatSDK.WorldToScreen(FlatSDK.Overlay.Width, FlatSDK.Overlay.Height, new Vector3(current.HeadBone.position.X, current.HeadBone.position.Y - (AimOptions.bPredict * 2), current.HeadBone.position.Z - (AimOptions.bYAxis * 8)), out Vector2 HeadPosition);
                AimTargets[i]                   = new AimTarget();
                AimTargets[i].Screen2D          = HeadPosition;
                AimTargets[i].uniqueID          = current.uniqueID;
                AimTargets[i].CrosshairDistance = Vector2.Distance(HeadPosition, new Vector2(ScreenCenterX, ScreenCenterY));



                // isInFov
                if (BestTargetUniqID == -1)
                {
                    if (isInside(ScreenCenterX, ScreenCenterY, AimOptions.bFovArray[AimOptions.bFovInt], AimTargets[i].Screen2D.X, AimTargets[i].Screen2D.Y))
                    {
                        fClosestDist     = AimTargets[i].CrosshairDistance;
                        BestTargetUniqID = AimTargets[i].uniqueID;
                    }
                }

                //if (BestTargetUniqID == -1)
                //{
                //    if (w2sHead)
                //    {
                //        gfx.FillCircle(FlatSDKInternal.IRenderer._opakwhite, HeadPosition.X, HeadPosition.Y, 5);
                //    }
                //}
                //else
                //{
                //    if (w2sHead)
                //    {
                //        gfx.FillCircle(FlatSDKInternal.IRenderer._red, HeadPosition.X, HeadPosition.Y, 5);
                //    }
                //}
            }


            if (FlatSDK.IsKeyPushedDown(AimOptions.bAimKeys[AimOptions.bAimKeyINT]))
            {
                if (BestTargetUniqID != -1)
                {
                    var best = FindAimTargetByUniqueID(AimTargets, BestTargetUniqID);

                    if (best != null)
                    {
                        // kek

                        {
                            var roundPos = new Vector2((float)Math.Round(best.Screen2D.X), (float)Math.Round(best.Screen2D.Y));
                            AimAtPosV2(roundPos.X, roundPos.Y, false);
                        }
                    }
                }
            }
            else
            {
                BestTargetUniqID = -1;
            }
        }