예제 #1
0
        private void _frameTimer_OnFrame(FrameTimer timer, D2DDevice device)
        {
            // the render loop will call device.BeginScene() and device.EndScene() for us
            if (!device.IsDrawing)
            {
                _initializeGraphicObjects = true;
                return;
            }
            device.ClearScene();

            if (Config.focused)
            {
                if (vars.drawFOV == 1)
                {
                    device.DrawCircle(vars.ScreenWidth / 2 + 1, vars.ScreenHeight / 2 + 1, Config.FOV, 1, _blueBrush);  //Draw FOV circle
                }
                //Crosshair aimPunch
                Point centralPoint = new Point(vars.recoilX + 1, vars.recoilY + 1);
                device.DrawCrosshair(CrosshairStyle.Plus, centralPoint, 7, 1f, _greenBrush);

                for (int i = 0; i < Config.numberOfPlayers; i++)
                {
                    if (Lists.team[i] == 2)
                    {
                        _emptyBrush = _redBrush;
                    }
                    else
                    {
                        _emptyBrush = _greenBrush;
                    };

                    if (Lists.dormant[i] == 1)
                    {
                        _emptyBrush = _yellowBrush;
                    }

                    if (Lists.health[i] > 0 && vars.localClass.LocalPlayer != Lists.entityID[i] && Lists.entityID[i] != Lists.observer[i] && Lists.selectedBoneX[i] != 0)
                    {
                        device.OutlineCircle(Lists.selectedBoneX[i], Lists.selectedBoneY[i], Lists.distance[i] + 0.1f, 2.0f, _emptyBrush, _blackBrush);
                    }
                }
            }
        }
예제 #2
0
        private void _frameTimer_OnFrame(FrameTimer timer, D2DDevice device)
        {
            #region non drawing things
            D2DSolidColorBrush GetDXColor(Color color)
            {
                return(device.CreateSolidColorBrush(color.R, color.G, color.B, color.A));
            }

            if (!device.IsDrawing)
            {
                _initializeGraphicObjects = true;
                return;
            }
            device.ClearScene();
            #endregion
            DrawTextWithBackground("ZBase", 0, 0, 16, Color.Blue, Color.DimGray);

            if (Main.S.ESP)
            {
                foreach (Entity Player in Globals.EntityList)
                {
                    if (Player.EntityBase != Globals.LocalPlayer.EntityBase)
                    {
                        Vector2 Player2DPos     = Tools.WorldToScreen(Player.Position);
                        Vector2 Player2DHeadPos = Tools.WorldToScreen(Player.HeadPosition);
                        Vector2 Player2DNeckPos = Tools.WorldToScreen(Player.GetBonePosition(7));
                        if (!Tools.IsNullVector2(Player2DPos) && !Tools.IsNullVector2(Player2DHeadPos) && Player.Valid)
                        {
                            float FromHeadToNeck = (Player2DNeckPos.Y - Player2DHeadPos.Y);
                            Player2DHeadPos.Y -= FromHeadToNeck * 2.3f;
                            Player2DPos.Y     += FromHeadToNeck;
                            float BoxHeight = Player2DPos.Y - Player2DHeadPos.Y;
                            float BoxWidth  = (BoxHeight / 2);
                            //wierd ass calculations for box height, dont judge
                            Color drawcolor;
                            if (Player.IsTeammate)
                            {
                                drawcolor = Color.Blue;
                            }
                            else
                            {
                                drawcolor = Color.Red;
                            }
                            DrawOutlineBox(Player2DPos.X - (BoxWidth / 2), Player2DHeadPos.Y, BoxWidth, BoxHeight, drawcolor);
                            DrawLine(Main.MidScreen.X, Main.MidScreen.Y + Main.MidScreen.Y, Player2DPos.X, Player2DPos.Y, drawcolor);
                        }
                    }
                }
            }

            #region drawing functions
            void DrawBoxEdge(float x, float y, float width, float height, Color color, float thiccness = 2.0f)
            {
                device.DrawRectangleEdges(Rectangle.Create(x, y, width, height), thiccness, GetDXColor(color));
            }

            void DrawText(string text, float x, float y, int size, Color color, bool bold = false, bool italic = false)
            {
                D2DFont f = _device.CreateFont(new FontOptions()
                {
                    Bold           = bold,
                    FontFamilyName = "Arial",
                    FontSize       = size,
                    Italic         = italic,
                    WordWrapping   = true
                });

                device.DrawText(text, new Point(x, y), f, GetDXColor(color));
            }

            void DrawTextWithBackground(string text, float x, float y, int size, Color color, Color backcolor, bool bold = false, bool italic = false)
            {
                D2DFont f = _device.CreateFont(new FontOptions()
                {
                    Bold           = bold,
                    FontFamilyName = "Arial",
                    FontSize       = size,
                    Italic         = italic,
                    WordWrapping   = true
                });

                device.DrawTextWithBackground(text, new Point(x, y), f, GetDXColor(color), GetDXColor(backcolor));
            }

            void DrawLine(float fromx, float fromy, float tox, float toy, Color color, float thiccness = 2.0f)
            {
                device.DrawLine(fromx, fromy, tox, toy, thiccness, GetDXColor(color));
            }

            void DrawFilledRectangle(float x, float y, float width, float height, Color color)
            {
                device.FillRectangle(Rectangle.Create(x, y, width, height), GetDXColor(color));
            }

            void DrawCircle(float x, float y, float radius, Color color)
            {
                device.DrawCircle(new Circle(x, y, radius), 1, GetDXColor(color));
            }

            void DrawCrosshair(CrosshairStyle style, float x, float y, float size, float stroke, Color color)
            {
                device.DrawCrosshair(style, new Point(x, y), size, stroke, GetDXColor(color));
            }

            void DrawBox(float x, float y, float width, float height, Color color, float thiccness = 2.0f)
            {
                device.DrawRectangle(Rectangle.Create(x, y, width, height), thiccness, GetDXColor(color));
            }

            void DrawOutlineBox(float x, float y, float width, float height, Color color, float thiccness = 2.0f)
            {
                device.OutlineRectangle(Rectangle.Create(x, y, width, height), thiccness, GetDXColor(color), GetDXColor(Color.Black));
            }

            void DrawRoundedBox(float x, float y, float width, float height, float radius, Color color, float thiccness = 2.0f)
            {
                device.DrawRoundedRectangle(RoundedRectangle.Create(x, y, width, height, radius), thiccness, GetDXColor(color));
            }

            #endregion
        }
예제 #3
0
        private void _frameTimer_OnFrame(FrameTimer timer, D2DDevice device)
        {
            // the render loop will call device.BeginScene() and device.EndScene() for us

            if (!device.IsDrawing)
            {
                _initializeGraphicObjects = true;
                return;
            }

            // clear the scene / fill it with our background

            device.ClearScene(_backgroundColor);


            if (!CanDraw)
            {
                return;
            }
            // text

            // the background is dynamically adjusted to the text's size
            var esp     = Program.IsEspEnabled ? '+' : '-';
            var radar   = Program.IsRadarEnabled ? '+' : '-';
            var trigger = Program.IsTriggerBot ? '+' : '-';
            var aim     = Program.IsAimEnabled ? '+' : '-';
            var cross   = Program.IsCrosshairDraw ? '+' : '-';
            var bunny   = Program.IsBunnyHopEnabled ? '+' : '-';

            device.DrawTextWithBackground(
                $"Fps: {device.FramesPerSecond} [ Esp(F5): {esp} ] [ Radar(F6): {radar} ] [ Trigger(F7): {trigger} ] [ Aim(F8): {aim} ] [ Cross(F9): {cross} ] [ Bunny(F10): {bunny} ]",
                10, 50, _font, _redBrush, _blackBrush);

            if (IsInGame())
            {
                if (LocalPlayer == null)
                {
                    return;
                }


                device.DrawTextWithBackground(
                    $"Me: (Map: {_mapName}) {Closed?.Name} {LocalPlayer.Health} {LocalPlayer.Team} {LocalPlayer.Position} Max:{MaxPlayersOnMap}",
                    10, 80, _font, _redBrush, _blackBrush);

                if (Program.IsCrosshairDraw)
                {
                    device.FillCircle(_sizeX / 2f, _sizeY / 2f, Fov, _blueBrush);
                    device.DrawCrosshair(CrosshairStyle.Plus, new Point(_sizeX / 2f, _sizeY / 2f), 15, 1, _blackBrush);
                }

                foreach (var justEntity in ListOfGlow.ToList())
                {
                    try
                    {
                        var w2S = justEntity.W2SPosition;
                        if (w2S.X <= 0 || w2S.Y <= 0 || w2S.X >= Program.ScreenSize.X || w2S.Y >= Program.ScreenSize.Y)
                        {
                            continue;
                        }

                        /*if (Program.IsEspEnabled)
                         * {
                         *  var classId = justEntity.ClassId;
                         *
                         *  device.DrawTextWithBackground($"[{classId}]", w2S.X, w2S.Y, _font, _redBrush,
                         *      _blackBrush);
                         * }*/
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
            else
            {
                device.DrawTextWithBackground($"Not in game", 10, 70, _font, _redBrush, _blackBrush);
            }
            return;

            // primitives

            device.DrawCircle(100, 100, 50, 2.0f, _redBrush);
            device.DrawDashedCircle(250, 100, 50, 2.0f, _greenBrush);

            // Rectangle.Create offers a method to create rectangles with x, y, width, heigth
            device.DrawRectangle(Rectangle.Create(350, 50, 100, 100), 2.0f, _blueBrush);
            device.DrawRoundedRectangle(RoundedRectangle.Create(500, 50, 100, 100, 6.0f), 2.0f, _redBrush);

            device.DrawTriangle(650, 150, 750, 150, 700, 50, _greenBrush, 2.0f);

            // lines

            device.DrawLine(50, 175, 750, 175, 2.0f, _blueBrush);
            device.DrawDashedLine(50, 200, 750, 200, 2.0f, _redBrush);

            // outlines & filled

            device.OutlineCircle(100, 275, 50, 4.0f, _redBrush, _blackBrush);
            device.FillCircle(250, 275, 50, _greenBrush);

            device.OutlineRectangle(Rectangle.Create(350, 225, 100, 100), 4.0f, _blueBrush, _blackBrush);

            _gradient.SetRange(500, 225, 600, 325);
            device.FillRoundedRectangle(RoundedRectangle.Create(500, 225, 100, 100, 6.0f), _gradient);

            device.FillTriangle(650, 325, 750, 325, 700, 225, _greenBrush);


            // images

            //device.DrawImage(_image, 310, 375);
        }