private static void DrawGrid( Direct2DRenderer gfx, Rectangle screen, Point pos, int pitch, Color color, int stroke = 1) { if (pitch < 1) { pitch = 1; } var x = pos.X - screen.X; var y = pos.Y - screen.Y; for (var i = 0 + x % pitch; i < screen.Width; i += pitch) { gfx.DrawLine(i, 0, i, screen.Height, stroke, color); } for (var i = 0 + y % pitch; i < screen.Height; i += pitch) { gfx.DrawLine(0, i, screen.Width, i, stroke, color); } }
private static void Main(string[] args) { var game_process = GetProcess("csgo", 5000); var overlay = new StickyOverlayWindow(game_process.MainWindowHandle, new OverlayCreationOptions { BypassTopmost = true, WindowTitle = HelperMethods.GenerateRandomString(5, 11) }); overlay.OnWindowBoundsChanged += Overlay_OnWindowBoundsChanged; gfx = new Direct2DRenderer(new RendererOptions { AntiAliasing = true, Hwnd = overlay.WindowHandle, MeasureFps = true, VSync = false }); font = gfx.CreateFont("Arial", 22); brush = gfx.CreateBrush(255, 0, 0, 255); backgroundBrush = gfx.CreateBrush(0xCC, 0xCC, 0xCC, 80); var timer = new FrameTimer(60); timer.OnFrameStart += Timer_OnFrameStart; timer.FPS = 900; timer.Start(); Console.WriteLine("drawing..."); Console.ReadLine(); }
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(); }
private static void DrawCross(Direct2DRenderer gfx, Rectangle screen, Point pos, Color color, int stroke = 1) { var x = pos.X - screen.X; var y = pos.Y - screen.Y; gfx.DrawLine(x, 0, x, screen.Height, stroke, color); gfx.DrawLine(0, y, screen.Width, y, stroke, color); }
public void Close() { created = false; tr.Abort(); WHwindow.HideWindow(); gfx = null; tr = null; }
private static void DrawTarget(Direct2DRenderer gfx, Rectangle screen, Target target) { if (target.Type == OverlayType.Guidelines) { DrawCross(gfx, screen, target.Position, target.Color, target.Stroke); } else if (target.Type == OverlayType.Grid) { DrawGrid(gfx, screen, target.Position, target.Pitch, target.Color, target.Stroke); } }
private static void DrawText( Direct2DRenderer gfx, Rectangle screen, Point pos, Color color, string text, int offset = 5) { var x = pos.X - screen.X + offset; var y = pos.Y - screen.Y + offset; gfx.DrawText(x, y, text, color); }
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; }
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(); }
private static void Main(string[] args) { Console.WindowHeight = Console.LargestWindowHeight / 2; Console.WindowWidth = Console.LargestWindowWidth / 2; OverlayCreationOptions overlayOptions = new OverlayCreationOptions() { BypassTopmost = true, Height = 600, Width = 600, WindowTitle = HelperMethods.GenerateRandomString(5, 11), X = Console.WindowLeft, Y = Console.WindowTop }; StickyOverlayWindow overlay = new StickyOverlayWindow(Process.GetCurrentProcess().MainWindowHandle, overlayOptions); overlay.OnWindowBoundsChanged += Overlay_OnWindowBoundsChanged; RendererOptions rendererOptions = new RendererOptions() { AntiAliasing = true, Hwnd = overlay.WindowHandle, MeasureFps = true, VSync = false }; gfx = new Direct2DRenderer(rendererOptions); font = gfx.CreateFont("Arial", 22); brush = gfx.CreateBrush(255, 0, 0, 255); backgroundBrush = gfx.CreateBrush(0xCC, 0xCC, 0xCC, 80); FrameTimer timer = new FrameTimer(60); timer.OnFrameStart += Timer_OnFrameStart; timer.Start(); Console.ReadLine(); timer.Stop(); gfx.Dispose(); overlay.Dispose(); }
private void DrawCoordinates(Direct2DRenderer gfx) { var coordinates = new Point(this.newTarget.Position.X, this.newTarget.Position.Y); if (this.Targets.Count > 0) { // Use relative coordinates var target = this.Targets[this.Targets.Count - 1]; coordinates.X -= target.Position.X; coordinates.Y -= target.Position.Y; if (target.Type == OverlayType.Grid) { // Grid relative coordinates.X %= target.Pitch; coordinates.Y %= target.Pitch; if (coordinates.X < 0) { coordinates.X += target.Pitch; } if (coordinates.Y < 0) { coordinates.Y += target.Pitch; } } } var text = string.Empty; if (this.newTarget.Type == OverlayType.Guidelines) { text = $"({coordinates.X}, {coordinates.Y}, {this.newTarget.Stroke})"; } else if (this.newTarget.Type == OverlayType.Grid) { text = $"({coordinates.X}, {coordinates.Y}, {this.newTarget.Stroke}, {this.newTarget.Pitch})"; } DrawText( gfx, this.screen, this.newTarget.Position, this.newTarget.Color, text, this.newTarget.Stroke / 2 + 5); }
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(); }
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); }
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); } }
private void handleInput() { Direct2DRenderer pDevice = overlay.Graphics; if (justToggled) { if (mousePos.X > 5 + Xshift && mousePos.X < 175 + Xshift) { if (mousePos.Y > 5 + Yshift && mousePos.Y < 25 + Yshift) { move = true; Xoffset = mousePos.X - Xshift; Yoffset = mousePos.Y - Yshift; } } if (mousePos.X > 15 + Xshift && mousePos.X < 30 + Xshift) { if (mousePos.Y > 50 + Yshift && mousePos.Y < 65 + Yshift) { Master.ToggleEnabled(); } } if (mousePos.X > 15 + Xshift && mousePos.X < 30 + Xshift) { if (mousePos.Y > 70 + Yshift && mousePos.Y < 85 + Yshift) { Master.ToggleMode(); } } if (mousePos.X > 15 + Xshift && mousePos.X < 30 + Xshift) { if (mousePos.Y > 90 + Yshift && mousePos.Y < 105 + Yshift) { Master.ToggleEsp(); } } if (mousePos.X > 15 + Xshift && mousePos.X < 30 + Xshift) { if (mousePos.Y > 110 + Yshift && mousePos.Y < 125 + Yshift) { Master.ToggleBHop(); } } Yshift += 25; if (distance(mousePos.X, mousePos.Y, 22 + Xshift, 117 + Yshift) <= 8) { Master.SetDelay(0); } if (distance(mousePos.X, mousePos.Y, 22 + Xshift, 137 + Yshift) <= 8) { Master.SetDelay(20); } if (distance(mousePos.X, mousePos.Y, 22 + Xshift, 157 + Yshift) <= 8) { Master.SetDelay(80); } Yshift -= 25; } if (move) { if (mouseDown) { Xshift = mousePos.X - Xoffset; Yshift = mousePos.Y - Yoffset; } else { move = false; } } }
private void drawThread() { Direct2DRenderer pDevice = overlay.Graphics; while (doLoop) { if (!isGameActive()) { pDevice.BeginScene(); pDevice.ClearScene(); pDevice.EndScene(); while (!isGameActive() && doLoop) { Thread.Sleep(100); } if (!doLoop) { break; } } watch.Reset(); watch.Start(); if ((GetAsyncKeyState((int)0x01) & 0x8000) != 0) { if (!mouseDown) { justToggled = true; mouseDown = true; } else { justToggled = false; } } else { mouseDown = false; justToggled = false; } GetCursorPos(out mousePos); handleInput(); pDevice.BeginScene(); pDevice.ClearScene(); if (Master.renderesp) { RenderESP(); } pDevice.FillRectangle(5 + Xshift, 5 + Yshift, 170, 210, blackBrush); pDevice.DrawRectangle(5 + Xshift, 5 + Yshift, 170, 210, 5, tealBrush); pDevice.DrawText("LysDick Hex", titleFont, tealBrush, 15 + Xshift, 10 + Yshift); pDevice.DrawRectangle(15 + Xshift, 50 + Yshift, 15, 15, 1, tealBrush); pDevice.DrawText("Enable Triggerbot", font, tealBrush, 35 + Xshift, 49 + Yshift); pDevice.DrawRectangle(15 + Xshift, 70 + Yshift, 15, 15, 1, tealBrush); pDevice.DrawText("Slow Mode", font, tealBrush, 35 + Xshift, 69 + Yshift); pDevice.DrawRectangle(15 + Xshift, 90 + Yshift, 15, 15, 1, tealBrush); pDevice.DrawText("ESP (15m)", font, tealBrush, 35 + Xshift, 89 + Yshift); pDevice.DrawRectangle(15 + Xshift, 110 + Yshift, 15, 15, 1, tealBrush); pDevice.DrawText("Bunny Hop (Space)", font, tealBrush, 35 + Xshift, 109 + Yshift); if (Master.enabled) { pDevice.FillRectangle(16 + Xshift, 51 + Yshift, 12, 12, tealBrush); } if (Master.mode == 1) { pDevice.FillRectangle(16 + Xshift, 71 + Yshift, 12, 12, tealBrush); } if (Master.renderesp) { pDevice.FillRectangle(16 + Xshift, 91 + Yshift, 12, 12, tealBrush); } if (Master.doBHop) { pDevice.FillRectangle(16 + Xshift, 111 + Yshift, 12, 12, tealBrush); } Yshift += 25; pDevice.DrawCircle(22 + Xshift, 117 + Yshift, 8, 1, tealBrush); pDevice.DrawText("0ms Delay", font, tealBrush, 35 + Xshift, 109 + Yshift); pDevice.DrawCircle(22 + Xshift, 137 + Yshift, 8, 1, tealBrush); pDevice.DrawText("20ms Delay", font, tealBrush, 35 + Xshift, 129 + Yshift); pDevice.DrawCircle(22 + Xshift, 157 + Yshift, 8, 1, tealBrush); pDevice.DrawText("80ms Delay", font, tealBrush, 35 + Xshift, 149 + Yshift); if (Master.delay == 0) { pDevice.FillCircle(22 + Xshift, 117 + Yshift, 7, tealBrush); } if (Master.delay == 20) { pDevice.FillCircle(22 + Xshift, 137 + Yshift, 7, tealBrush); } if (Master.delay == 80) { pDevice.FillCircle(22 + Xshift, 157 + Yshift, 7, tealBrush); } while (watch.ElapsedMilliseconds < (50 / 3)) { Thread.Sleep(1); } Yshift -= 25; pDevice.EndScene(); } }
protected virtual void OnDraw(Direct2DRenderer render) { }
// 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(); }
public override void Initialize(IWindow targetWindow) { // Set target window by calling the base method base.Initialize(targetWindow); // For demo, show how to use settings var current = Settings.Current; var type = GetType(); if (current.UpdateRate == 0) { current.UpdateRate = 1000 / 60; } current.Author = GetAuthor(type); current.Description = GetDescription(type); current.Identifier = GetIdentifier(type); current.Name = GetName(type); current.Version = GetVersion(type); // File is made from above info Settings.Save(); Settings.Load(); Console.Title = @"Overlay"; OverlayWindow = new DirectXOverlayWindow(targetWindow.Handle, false); _watch = Stopwatch.StartNew(); _redOpacityBrush = OverlayWindow.Graphics.CreateBrush(Color.FromArgb(80, 255, 0, 0)); _interiorBrush = OverlayWindow.Graphics.CreateBrush(0x7FFFFF00); _hugeFont = OverlayWindow.Graphics.CreateFont("Arial", 50, true); _font = OverlayWindow.Graphics.CreateFont("Arial", 32); _font_small = OverlayWindow.Graphics.CreateFont("Arial", 16); _black = OverlayWindow.Graphics.CreateBrush(0x7F000000); _gray = OverlayWindow.Graphics.CreateBrush(0x7FCCCCCC); _red = OverlayWindow.Graphics.CreateBrush(0x7FFF0000); _green = OverlayWindow.Graphics.CreateBrush(0x7F008000); _blue = OverlayWindow.Graphics.CreateBrush(0x7F0000FF); aBtnImg = Direct2DRenderer.LoadFromFile(Direct2DRenderer._device, "Resources/a_btn.png"); xBtnImg = Direct2DRenderer.LoadFromFile(Direct2DRenderer._device, "Resources/x_btn.png"); yBtnImg = Direct2DRenderer.LoadFromFile(Direct2DRenderer._device, "Resources/y_btn.png"); bBtnImg = Direct2DRenderer.LoadFromFile(Direct2DRenderer._device, "Resources/b_btn.png"); backBtnImg = Direct2DRenderer.LoadFromFile(Direct2DRenderer._device, "Resources/back_btn.png"); lBtnImg = Direct2DRenderer.LoadFromFile(Direct2DRenderer._device, "Resources/lb_btn.png"); ltBtnImg = Direct2DRenderer.LoadFromFile(Direct2DRenderer._device, "Resources/lt_btn.png"); rBtnImg = Direct2DRenderer.LoadFromFile(Direct2DRenderer._device, "Resources/rb_btn.png"); //aBtnImg = Direct2DRenderer.LoadFromFile(Properties.Resources.a_btn.ToString()); /*xBtnImg = _graphics.CreateImage(f.pngToBytes(Properties.Resources.x_btn)); * yBtnImg = _graphics.CreateImage(f.pngToBytes(Properties.Resources.y_btn)); * bBtnImg = _graphics.CreateImage(f.pngToBytes(Properties.Resources.b_btn)); * backBtnImg = _graphics.CreateImage(f.pngToBytes(Properties.Resources.back_btn)); * lBtnImg = _graphics.CreateImage(f.pngToBytes(Properties.Resources.lb_btn)); * ltBtnImg = _graphics.CreateImage(f.pngToBytes(Properties.Resources.lt_btn)); * rBtnImg = _graphics.CreateImage(f.pngToBytes(Properties.Resources.rb_btn));*/ _rotation = 0.0f; _displayFps = 0; _i = 0; // Set up update interval and register events for the tick engine. _tickEngine.PreTick += OnPreTick; _tickEngine.Tick += OnTick; }
protected override void OnDraw(Direct2DRenderer renderer) { _timeChangeAction.Invoke(renderer); }