private void setupInstance(IntPtr parentWindowHandle, Direct2DRendererOptions options)
        {
            ParentWindowHandle = parentWindowHandle;

            if (PInvoke.IsWindow(parentWindowHandle) == 0)
            {
                throw new Exception("The parent window does not exist");
            }

            PInvoke.RECT bounds = new PInvoke.RECT();
            PInvoke.GetRealWindowRect(parentWindowHandle, out bounds);

            int x = bounds.Left;
            int y = bounds.Top;

            int width  = bounds.Right - x;
            int height = bounds.Bottom - y;

            Window = new OverlayWindow(x, y, width, height);

            options.Hwnd = Window.WindowHandle;

            Graphics = new Direct2DRenderer(options);

            serviceThread = new Thread(new ThreadStart(windowServiceThread))
            {
                IsBackground = true,
                Priority     = ThreadPriority.BelowNormal
            };

            serviceThread.Start();
        }
Пример #2
0
        public static void Run(IntPtr parentWindowHandle)
        {
            Console.SetWindowSize(Console.LargestWindowWidth / 2, Console.LargestWindowHeight / 2);

            var rendererOptions = new Direct2DRendererOptions()
            {
                AntiAliasing = true,
                Hwnd         = MainClass.mProc_H,
                MeasureFps   = true,
                VSync        = false
            };

            var manager = new OverlayManager(parentWindowHandle, rendererOptions);

            var overlay = manager.Window;
            var gfx     = manager.Graphics;

            var whiteSmoke = gfx.CreateBrush(0xF5, 0xF5, 0xF5, 100);

            var blackBrush = gfx.CreateBrush(0, 0, 0, 255);
            var redBrush   = gfx.CreateBrush(255, 0, 0, 255);
            var greenBrush = gfx.CreateBrush(0, 255, 0, 255);
            var blueBrush  = gfx.CreateBrush(0, 0, 255, 255);

            var font = gfx.CreateFont("Consolas", 22);

            RECT.Left    = overlay.Width - overlay.Width;
            RECT.Top     = overlay.Height - overlay.Height;
            RECT.Right   = overlay.Width;
            RECT.Bottom  = overlay.Height;
            RECT.WCenter = overlay.Width - overlay.Width / 2;
            RECT.HCenter = overlay.Height - overlay.Height / 2;

            while (true)
            {
                Thread.Sleep(50);
                gfx.BeginScene();
                gfx.ClearScene(gfx.CreateBrush(0, 0, 0, 0));

                if (Settings.Overlay.MenuON && !SDK.m_bIsScoped)
                {
                    gfx.FillRectangle(RECT.Left + 100, RECT.HCenter, 50, 50, blueBrush);
                }

                if (Settings.Overlay.Crosshair)
                {
                    gfx.FillEllipse(RECT.WCenter, RECT.HCenter, 3, 3, redBrush);
                }

                if (SDK.HitVal != SDK.HitAmmount || HitMark > 1)
                {
                    HitMarker();
                }

                gfx.EndScene();
            }

            Environment.Exit(0);
        }
        public OverlayManager(IntPtr parentWindowHandle, bool vsync = false, bool measurefps = false, bool antialiasing = true)
        {
            Direct2DRendererOptions options = new Direct2DRendererOptions()
            {
                AntiAliasing = antialiasing,
                Hwnd         = IntPtr.Zero,
                MeasureFps   = measurefps,
                VSync        = vsync
            };

            setupInstance(parentWindowHandle, options);
        }
Пример #4
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            Stopwatch jew = new Stopwatch();

            var overlay = new OverlayWindow(0, 0, (int)SystemInformation.VirtualScreen.Width, (int)SystemInformation.VirtualScreen.Height);

            var rendererOptions = new Direct2DRendererOptions()
            {
                AntiAliasing = true,
                Hwnd         = overlay.WindowHandle,
                MeasureFps   = true,
                VSync        = false
            };

            var d2d = new Direct2DRenderer(rendererOptions);

            var whiteSmoke = d2d.CreateBrush(0, 0, 0, 0);

            var blackBrush = d2d.CreateBrush(0, 0, 0, 150);
            var redBrush   = d2d.CreateBrush(255, 0, 0, 255);

            jew.Start();
            while (drawRunning)
            {
                d2d.BeginScene();
                d2d.ClearScene(whiteSmoke);
                int temp = findClosestEndPoint(listOfClicks, Form1.MousePosition, 10);
                if (temp != -1 && mousePressed)
                {
                    listOfClicks[temp].x = MousePosition.X;
                    listOfClicks[temp].y = MousePosition.Y;
                }
                d2d.FillCircle(listOfClicks[0].x, listOfClicks[0].y, 7, blackBrush);
                d2d.FillCircle(listOfClicks[1].x, listOfClicks[1].y, 7, blackBrush);
                d2d.FillCircle(listOfClicks[2].x, listOfClicks[2].y, 7, blackBrush);

                d2d.DrawLine(listOfClicks[0].x, listOfClicks[0].y, listOfClicks[1].x, listOfClicks[1].y, 5, redBrush);
                d2d.DrawLine(listOfClicks[0].x, listOfClicks[0].y, listOfClicks[2].x, listOfClicks[2].y, 5, redBrush);

                d2d.EndScene();
            }
            d2d.BeginScene();
            d2d.ClearScene(whiteSmoke);
            d2d.EndScene();
            jew.Stop();
            jew.Reset();
            //running = false;
        }
Пример #5
0
        public Overlay(Process gameProcess)
        {
            process = gameProcess;

            // check the game window exists then create the overlay
            while (true)
            {
                handle = NativeMethods.FindWindow(null, "STAR WARS Battlefront II");

                if (handle != IntPtr.Zero)
                {
                    break;
                }
            }

            // check if game running. timed at 2-5ms per call so runs in own thread
            gameCheckThread = new Thread(new ParameterizedThreadStart(GameCheck));
            gameCheckThread.Start();

            // Starting the ESP before the game leaves invalid process info so we'll wait a second to let the game check thread fix that
            if (process.MainWindowHandle == IntPtr.Zero)
            {
                Thread.Sleep(1000);
            }

            // set up the remote process memory class
            RPM.OpenProcess(process.Id);

            // setup the overlay
            var rendererOptions = new Direct2DRendererOptions()
            {
                AntiAliasing = OPTIONS_AA,
                Hwnd         = IntPtr.Zero,
                MeasureFps   = OPTIONS_ShowFPS,
                VSync        = OPTIONS_VSync
            };

            OverlayManager manager = new OverlayManager(handle, rendererOptions);

            overlay    = manager.Window;
            d2d        = manager.Graphics;
            clearBrush = d2d.CreateBrush(0xF5, 0xF5, 0xF5, 0);  // our transparent colour

            // start the update thread
            updateThread = new Thread(new ParameterizedThreadStart(Update));
            updateThread.Start();
        }
Пример #6
0
        static void overlay_manager_example(IntPtr parentWindowHandle)
        {
            Console.SetWindowSize(Console.LargestWindowWidth / 2, Console.LargestWindowHeight / 2);

            var rendererOptions = new Direct2DRendererOptions()
            {
                AntiAliasing = true,
                Hwnd         = IntPtr.Zero,
                MeasureFps   = true,
                VSync        = false
            };

            OverlayManager manager = new OverlayManager(parentWindowHandle, rendererOptions);

            var overlay = manager.Window;
            var d2d     = manager.Graphics;

            var whiteSmoke = d2d.CreateBrush(0xF5, 0xF5, 0xF5, 100);

            var blackBrush = d2d.CreateBrush(0, 0, 0, 255);
            var redBrush   = d2d.CreateBrush(255, 0, 0, 255);
            var greenBrush = d2d.CreateBrush(0, 255, 0, 255);
            var blueBrush  = d2d.CreateBrush(0, 0, 255, 255);

            var font = d2d.CreateFont("Consolas", 22);

            while (true)
            {
                d2d.BeginScene();
                d2d.ClearScene(whiteSmoke);

                d2d.DrawTextWithBackground("FPS: " + d2d.FPS, 20, 40, font, greenBrush, blackBrush);

                d2d.BorderedRectangle(300, 40, 100, 200, 4, redBrush, blackBrush);
                d2d.DrawHorizontalBar(100, 290, 40, 2, 200, 4, greenBrush, blackBrush);
                d2d.DrawHorizontalBar(100, 280, 40, 2, 200, 4, blueBrush, blackBrush);

                d2d.DrawCrosshair(CrosshairStyle.Gap, 400, 300, 25, 4, redBrush);

                d2d.EndScene();
            }
        }
Пример #7
0
        public void _Init_()
        {
            mem     = CheatData.mem;
            created = true;
            GetWindowRect(handle, out rect);
            WHwindow = new OverlayWindow(rect.left, rect.top, rect.right, rect.bottom);
            //  WHwindow = new OverlayWindow();
            //WHwindow.MoveWindow( rect.right-rect.top, rect.bottom);
            var rendererOptions = new Direct2DRendererOptions()
            {
                AntiAliasing = true,
                Hwnd         = WHwindow.WindowHandle,
                MeasureFps   = true,
                VSync        = false
            };

            gfx = new Direct2DRenderer(rendererOptions);
            tr  = new Thread(Loop);
            tr.Start();
        }
Пример #8
0
        static void example()
        {
            var overlay = new OverlayWindow(0, 0, 800, 600);

            var rendererOptions = new Direct2DRendererOptions()
            {
                AntiAliasing = true,
                Hwnd         = overlay.WindowHandle,
                MeasureFps   = true,
                VSync        = false
            };

            var d2d = new Direct2DRenderer(rendererOptions);

            var whiteSmoke = d2d.CreateBrush(0xF5, 0xF5, 0xF5, 100);

            var blackBrush = d2d.CreateBrush(0, 0, 0, 255);
            var redBrush   = d2d.CreateBrush(255, 0, 0, 255);
            var greenBrush = d2d.CreateBrush(0, 255, 0, 255);
            var blueBrush  = d2d.CreateBrush(0, 0, 255, 255);

            var font = d2d.CreateFont("Consolas", 22);

            while (true)
            {
                d2d.BeginScene();
                d2d.ClearScene(whiteSmoke);

                d2d.DrawTextWithBackground("FPS: " + d2d.FPS, 20, 40, font, greenBrush, blackBrush);

                d2d.BorderedRectangle(300, 40, 100, 200, 4, redBrush, blackBrush);
                d2d.DrawHorizontalBar(100, 290, 40, 2, 200, 4, greenBrush, blackBrush);
                d2d.DrawHorizontalBar(100, 280, 40, 2, 200, 4, blueBrush, blackBrush);

                d2d.DrawCrosshair(CrosshairStyle.Gap, 400, 300, 25, 4, redBrush);

                d2d.EndScene();
            }
        }
        public OverlayManager(IntPtr parentWindowHandle, out OverlayWindow overlay, out Direct2DRenderer d2d)
        {
            Direct2DRendererOptions options = new Direct2DRendererOptions()
            {
                AntiAliasing = true,
                Hwnd         = IntPtr.Zero,
                MeasureFps   = true,
                VSync        = false
            };

            setupInstance(parentWindowHandle, options);

            overlay = Window;
            d2d     = Graphics;

            d2d.whiteSmoke = d2d.CreateBrush(0xF5, 0xF5, 0xF5, 100);

            d2d.blackBrush    = d2d.CreateBrush(0, 0, 0, 255);
            d2d.redBrush      = d2d.CreateBrush(255, 0, 0, 255);
            d2d.lightRedBrush = d2d.CreateBrush(255, 100, 100, 255);
            d2d.greenBrush    = d2d.CreateBrush(0, 255, 0, 255);
            d2d.blueBrush     = d2d.CreateBrush(0, 0, 255, 255);
            d2d.font          = d2d.CreateFont("Consolas", 22);
        }
Пример #10
0
        private void Nampham()
        {
            rect.left   = 0;    //
            rect.right  = 1366; //
            rect.top    = 21;   //
            rect.bottom = 726;  //
            int Width           = rect.right - rect.left;
            int Height          = rect.bottom - rect.top;
            int Width2          = 1382; //
            int Height2         = 744;  //
            var overlay         = new OverlayWindow(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
            var rendererOptions = new Direct2DRendererOptions()
            {
                AntiAliasing = false,
                Hwnd         = overlay.WindowHandle,
                MeasureFps   = true,
                VSync        = true
            };

            var     d2d         = new Direct2DRenderer(rendererOptions);
            var     trains      = d2d.CreateBrush(0, 0, 0, 0);
            var     blackBrush  = d2d.CreateBrush(0, 0, 0, 255);
            var     redBrush    = d2d.CreateBrush(242, 14, 14, 255);
            var     greenBrush  = d2d.CreateBrush(33, 208, 43, 255);
            var     whiteBrush  = d2d.CreateBrush(255, 255, 255, 200);
            var     blueBrush   = d2d.CreateBrush(0, 0, 255, 255);
            var     grenBrush   = d2d.CreateBrush(33, 208, 43, 180);
            var     greenBrush2 = d2d.CreateBrush(0, 188, 0, 255);
            var     font        = d2d.CreateFont("Tahoma", 8, true);
            var     bigfont     = d2d.CreateFont("Tahoma", 14, true);
            Vector2 center      = new Vector2();

            while (true)
            {
                center.X = Width / 2;
                center.Y = (Height / 2) + 20;
                d2d.BeginScene();
                d2d.ClearScene(trains);
                if (Showbone)
                {
                    var m_pWorld = Mem.ReadMemory <int>(Mem.BaseAddress + Offsets.PyGame + 0x410);
                    List <LUPPI.NP.Word> modal = new List <NP.Word>();
                    var m_pSceneContext        = Mem.ReadMemory <int>(m_pWorld + 0x8);
                    var cameraBase             = Mem.ReadMemory <int>(m_pSceneContext + 0x4);
                    var viewMatrix             = Mem.ReadMatrix <float>(cameraBase + 0xC4, 16);
                    var pSkeletonList          = Mem.ReadMemory <int>(m_pWorld + 0x290);
                    int visibleCount           = Mem.ReadMemory <int>(m_pWorld + 0x278);
                    int coutene = 0;
                    for (int i = 0; i < visibleCount; i++)
                    {
                        int r_pModel    = Mem.ReadMemory <int>(pSkeletonList + i);
                        int m_pAnimator = Mem.ReadMemory <int>(r_pModel + 0x328);
                        if (m_pAnimator > 1)
                        {
                            var intt = Mem.ReadMemory <int>(m_pAnimator + 0x528);
                            //var bon = Mem.ReadMemory<int>(m_pAnimator + 0x970);
                            var name = Mem.ReadString(intt, 35);
                            //float[] b = Mem.ReadMatrix<float>(r_pModel + 0x3B0, 16);
                            if (name.Contains("_male"))
                            {
                                coutene += 1;
                                modal.Add(new NP.Word()
                                {
                                    baseAdd = m_pAnimator, baseModal = r_pModel, isMen = true
                                });
                            }
                            else if (name.Contains("_female"))
                            {
                                coutene += 1;
                                modal.Add(new NP.Word()
                                {
                                    baseAdd = m_pAnimator, baseModal = r_pModel, isMen = false
                                });
                            }
                        }
                    }
                    d2d.DrawTextWithBackground("ENERMY : " + (coutene - 1) + " 💩", 10, 400, bigfont, redBrush, whiteBrush);
                    for (int i = 0; i < modal.Count; i++)
                    {
                        if (i == 0)//LOCALPLAYER POS
                        {
                            var m_Position1 = modal[i].pos;
                            MyPosition.X = m_Position1[12];
                            MyPosition.Y = m_Position1[13];
                            MyPosition.Z = m_Position1[14];
                        }
                        //string name = modal[i].TypeName;
                        //if (name.Contains("dataosha_male") || name.Contains("dataosha_female"))
                        {
                            var     m_Position = modal[i].pos;
                            Vector3 position;
                            position.X = m_Position[12];
                            position.Y = m_Position[13];
                            position.Z = m_Position[14];
                            var p = 0;
                            for (int j = 0; j < 0xE80; j += 0x40)
                            {
                                var ab         = Mem.ReadMemory <int>(modal[i].baseAdd + 0x970);
                                var boneMatrix = Mem.ReadMatrix <float>(ab + j, 16);
                                var bone4      = new LUPPI.NP.Matrix(boneMatrix);
                                var bone24     = new LUPPI.NP.Matrix(m_Position);
                                var result     = LUPPI.NP.Matrix.Multiply(bone4, bone24);
                                var vec3a      = new Vector3(result.M41, result.M42, result.M43);
                                Maths.WorldToScreen3(vec3a, viewMatrix, out var testeee, Width, Height);
                                d2d.DrawText(p.ToString(), testeee.X, testeee.Y, font, whiteBrush);
                                p++;
                            }
                            Maths.WorldToScreen(position, out var testee2, Width, Height);
                            int    khoangCach = Helper.GetDistance(MyPosition, position, 20);
                            string tea        = "[" + khoangCach + "m]";
                            if (khoangCach < 150)
                            {
                                d2d.DrawText(tea, testee2.X - tea.Length, testee2.Y, font, greenBrush2);
                            }
                            else
                            {
                                d2d.DrawText(tea, testee2.X - tea.Length, testee2.Y, font, whiteBrush);
                            }
                        }
                    }
                }
                if (isBoxEsp)
                {
                    Vector2 vector3;
                    LocalPlayer = Mem.ReadMemory <int>(Mem.BaseAddress + Offsets.LocalPlayer);
                    Mem.ReadMemory <int>(Mem.BaseAddress + 0x22);
                    MyPosition = GetEncryptedPosition(LocalPlayer);
                    List <Entity> ls = ReadAllEntity();
                    d2d.DrawTextWithBackground("ENERMY : " + enemyCount.ToString() + " 💩", 10, 400, bigfont, redBrush, whiteBrush);
                    d2d.DrawTextWithBackground("AIM LEG: " + aimLeg.ToString(), 10, 370, bigfont, redBrush, whiteBrush);
                    for (int i = 0; i < ls.Count; i++)
                    {
                        //ls[i].Coordinates.Y += 15f;
                        ls[i].Coordinates = ls[i].GetEncryptedPosition();
                        if (Maths.WorldToScreen(ls[i].Coordinates, out vector3, Width2, Height2))
                        {
                            int   khoangCach = Helper.GetDistance(MyPosition, ls[i].Coordinates, 10);
                            var   widthhp    = 0f;
                            var   widthhp2   = 0f;
                            float numaim     = 2f;
                            if (ls[i].isPlayer && ls[i].hp > 0)
                            {
                                float heiadd = 0f;
                                bool  flag3  = ls[i].pose == Pose.Standing;
                                if (flag3)
                                {
                                    heiadd += 18.5f;
                                }
                                bool flag4 = ls[i].pose == Pose.Prone;
                                if (flag4)
                                {
                                    heiadd += 12.5f;
                                    numaim  = 1.6f;
                                }
                                bool flag5 = ls[i].pose == Pose.Crouching;
                                if (flag5)
                                {
                                    heiadd += 4f;
                                    numaim  = 1.1f;
                                }
                                Vector2 line1, line2, line3, line4, line5, line6, line7, line8;
                                if (isBoxEsp)
                                {
                                    var a1  = ls[i].Coordinates.X;
                                    var a2  = ls[i].Coordinates.Y;
                                    var a3  = ls[i].Coordinates.Z;
                                    var v7  = a1 - 5.5f;
                                    var v8  = a2 - 2.5f;
                                    var v9  = a3 - 5.5f;
                                    var v10 = a1 + 5.5f;
                                    var v12 = a3 + 5.5f;
                                    if (Maths.WorldToScreen(new Vector3(v7, v8, v9), out line1, Width, Height))
                                    {
                                        var v4  = a2 + heiadd;
                                        var v11 = a2 + heiadd;
                                        var v13 = v4;
                                        var v14 = v4;
                                        if (Maths.WorldToScreen(new Vector3(v10, v4, v12), out line2, Width, Height))
                                        {
                                            if (Maths.WorldToScreen(new Vector3(v10, v8, v9), out line3, Width, Height))
                                            {
                                                if (Maths.WorldToScreen(new Vector3(v7, v11, v9), out line4, Width, Height))
                                                {
                                                    if (Maths.WorldToScreen(new Vector3(v7, v8, v12), out line5, Width, Height))
                                                    {
                                                        if (Maths.WorldToScreen(new Vector3(v7, v13, v12), out line6, Width, Height))
                                                        {
                                                            if (Maths.WorldToScreen(new Vector3(v10, v8, v12), out line7, Width, Height))
                                                            {
                                                                if (Maths.WorldToScreen(new Vector3(v10, v14, v9), out line8, Width, Height))
                                                                {
                                                                    d2d.DrawLine(line1.X, line1.Y, line4.X, line4.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line3.X, line3.Y, line8.X, line8.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line7.X, line7.Y, line2.X, line2.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line5.X, line5.Y, line6.X, line6.Y, 1, whiteBrush);

                                                                    //Chan
                                                                    d2d.DrawLine(line1.X, line1.Y, line3.X, line3.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line3.X, line3.Y, line7.X, line7.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line7.X, line7.Y, line5.X, line5.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line5.X, line5.Y, line1.X, line1.Y, 1, whiteBrush);

                                                                    //Dau
                                                                    d2d.DrawLine(line4.X, line4.Y, line8.X, line8.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line8.X, line8.Y, line2.X, line2.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line2.X, line2.Y, line6.X, line6.Y, 1, whiteBrush);
                                                                    d2d.DrawLine(line6.X, line6.Y, line4.X, line4.Y, 1, whiteBrush);

                                                                    widthhp  = (float)Helper.GetDistance2(line4, line2, 1);
                                                                    widthhp2 = (float)Helper.GetDistance2(line6, line8, 1);
                                                                    if (widthhp < widthhp2)
                                                                    {
                                                                        widthhp = widthhp2;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                var     dy = ls[i].Coordinates.X;
                                var     dy_4 = ls[i].Coordinates.Y;
                                var     v46 = ls[i].Coordinates.Z;
                                var     v27 = dy_4 + 27.0f;
                                Vector2 aimpoint, aimpoint2;
                                if (Maths.WorldToScreen(new Vector3(dy, v27, v46), out aimpoint, Width, Height))
                                {
                                    string tea = ls[i].PlayerName + " [" + khoangCach + " m]";
                                    if (khoangCach < 150)
                                    {
                                        d2d.DrawText(tea, aimpoint.X - tea.Length * 2, aimpoint.Y - 10, font, redBrush);
                                    }
                                    else
                                    {
                                        d2d.DrawText(tea, aimpoint.X - tea.Length * 2, aimpoint.Y - 10, font, whiteBrush);
                                    }

                                    //Player HP
                                    if (ls[i].hp == 100)
                                    {
                                        d2d.DrawVerticalBar(ls[i].hp, aimpoint.X - widthhp / 2, aimpoint.Y - 15f, widthhp, 1, 3, greenBrush2, blackBrush);
                                    }
                                    else
                                    {
                                        d2d.DrawVerticalBar(ls[i].hp, aimpoint.X - widthhp / 2, aimpoint.Y - 15f, widthhp, 1, 3, redBrush, blackBrush);
                                    }
                                }

                                if (Maths.WorldToScreen(new Vector3(dy, v27, v46), out aimpoint, Width, Height2))
                                {
                                    var v41 = dy_4 + heiadd;
                                    if (Maths.WorldToScreen(new Vector3(dy, v41, v46), out aimpoint2, Width, Height2))
                                    {
                                        if ((Maths.InsideCircle((int)center.X, (int)center.Y, 80, (int)aimpoint2.X, (int)aimpoint2.Y)))
                                        {
                                            if (Keyboard.IsKeyDown(Keys.LShiftKey))
                                            {
                                                Cursor.Position = new Point((int)(aimpoint2.X), (int)(aimpoint2.Y));
                                                if (Keyboard.IsKeyDown(Keys.LButton))
                                                {
                                                    Cursor.Position = new Point((int)(aimpoint2.X), (int)(aimpoint2.Y + ls[i].Pitch));
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            if (ls[i].isItem)
                            {
                                if (ls[i].dropID == 1001 || ls[i].dropID == 1002 || ls[i].dropID == 1007 || ls[i].dropID == 1026)
                                {
                                    d2d.DrawText2("[GUN]", vector3.X, vector3.Y, font, whiteBrush, greenBrush2);
                                }
                                else if (ls[i].dropID == 1273 || ls[i].dropID == 1274 || ls[i].dropID == 1275)
                                {
                                    d2d.DrawText2("[SCOPE]", vector3.X, vector3.Y, font, whiteBrush, greenBrush2);
                                }
                                else if (khoangCach < 100)
                                {
                                    //d2d.DrawText("[I]", vector3.X, vector3.Y, font, whiteBrush);
                                }
                            }
                            if (ls[i].isItemDie && khoangCach < 100)
                            {
                                d2d.DrawText2("[DIE]", vector3.X, vector3.Y, font, whiteBrush, greenBrush2);
                            }
                        }
                    }
                }

                d2d.EndScene();
                //Thread.Sleep(1);
            }
        }
 public OverlayManager(IntPtr parentWindowHandle, Direct2DRendererOptions options)
 {
     setupInstance(parentWindowHandle, options);
 }
Пример #12
0
        // Init
        public Overlay(Process process)
        {
            this.process = process;

            // check the game window exists then create the overlay
            while (true)
            {
                handle = NativeMethods.FindWindow(null, "Battlefield 4");

                if (handle != IntPtr.Zero)
                {
                    break;
                }
            }

            gameCheckThread = new Thread(new ParameterizedThreadStart(GameCheck));
            gameCheckThread.Start();
            if (process.MainWindowHandle == IntPtr.Zero)
            {
                Thread.Sleep(1000);
            }

            RPM.OpenProcess(process.Id);

            // setup the overlay
            var rendererOptions = new Direct2DRendererOptions()
            {
                AntiAliasing = OPTIONS_AA,
                Hwnd         = IntPtr.Zero,
                MeasureFps   = OPTIONS_ShowFPS,
                VSync        = OPTIONS_VSync
            };

            OverlayManager manager = new OverlayManager(handle, rendererOptions);

            overlay    = manager.Window;
            d2d        = manager.Graphics;
            clearBrush = d2d.CreateBrush(0xF5, 0xF5, 0xF5, 0);  // our transparent colour



            // Init player array
            localPlayer = new GPlayer();
            //localPlayer.CurrentWeapon = new Weapon();
            localWeapons  = new List <Gun>();
            players       = new List <GPlayer>();
            targetEnimies = new List <GPlayer>();

            // Init update thread
            updateStream = new Thread(new ParameterizedThreadStart(Update));
            updateStream.Start();


            ScreenCapture sc = new ScreenCapture();

            sc.CaptureWindowToFile(process.MainWindowHandle, @"C:\PZ_BF4_FAIRFIGHT_GAME_SS.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);



            // Init Key Listener
            KeyAssign();
        }