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; }
private static void Timer_OnFrameStart() { gfx.BeginScene(); gfx.ClearScene(); gfx.DrawTextWithBackground(gfx.FPS.ToString(), 100, 100, font, brush, backgroundBrush); gfx.EndScene(); }
private static void Timer_OnFrameStart() { gfx.BeginScene(); gfx.ClearScene(); gfx.DrawText($"FPS: {gfx.FPS}", 50, 50, font, brush); //Console.WriteLine($"Window Height: {gfx.Height} Width: {gfx.Width}"); //Console.WriteLine($"Target Hwnd: 0x{gfx.RenderTargetHwnd.ToString("X")}"); gfx.EndScene(); }
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(); } }
// Update Thread private void Update(object sender) { Pimp pimp = new Pimp(Pimp.BlockMethod.Zero, true, true, false); if (pimp.Inject("bf4")) { while (IsGameRunning) { bool check = pimp.IsScreenShot(); if (!check) { rect.Width = overlay.Width; rect.Height = overlay.Height; d2d.BeginScene(); d2d.ClearScene(clearBrush); OverlayControl(); d2d.EndScene(); } } RPM.CloseProcess(); Environment.Exit(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); } }
private void Loop() { while (true) { // GC.Collect(); gfx.BeginScene(); gfx.ClearScene(); if (CheatData.panorama) { for (int i = 0; i < 100; i++) { MyBaseAdr = mem.Read <int>(CheatData.bClient + Offsets.New.dwLocalPlayer); mteam = mem.Read <int>(MyBaseAdr + Offsets.New.m_iTeamNum); mycoords = mem.Read <Vector3>(MyBaseAdr + Offsets.New.m_vecOrigin); eBaseAdr = mem.Read <int>(CheatData.bClient + Offsets.New.dwEntityList + (i * Offsets.New.Loop_offset)); eteam = mem.Read <int>(eBaseAdr + Offsets.New.m_iTeamNum); dormant = mem.Read <bool>(eBaseAdr + Offsets.New.m_bDormant); // glowind = mem.Read<int>(eBaseAdr + Offsets.m_iGlowIndex); hp = mem.Read <int>(eBaseAdr + Offsets.New.m_iHealth); coords = mem.Read <Vector3>(eBaseAdr + Offsets.New.m_vecOrigin); head = CalcEnemyHead(eBaseAdr, 8); Gres = mem.Read <int>(CheatData.bClient + Offsets.New.dwPlayerResource); rank = mem.Read <int>(Gres + Offsets.New.m_iCompetitiveRanking + i * 4); int radar = mem.Read <int>(CheatData.bClient + Offsets.New.dwRadarBase); name = mem.Read <char>(radar + (i * 50) + 0x204, 50); string n = string.Empty; for (int j = 0; j < 49; j++) { n += name[j]; } // // angles = mem.Read<Vector2>(eBaseAdr + Offsets.m_angEyeAngles); mt = mteam; et = eteam; if (MyBaseAdr == 0x0) { continue; } VMatrix = mem.Read <Matrix4x4>(CheatData.bClient + Offsets.New.dwViewMatrix); ScreenVector sv = WorldToScreen(coords.X, coords.Y, coords.Z); ScreenVector svh = WorldToScreen(head.X, head.Y, head.Z); if (dormant) { continue; } if (hp == 0) { continue; } if (!sv.Result) { continue; } int ex = (int)sv.X; int ey = (int)sv.Y; int sx = WHwindow.Width / 2; int sy = WHwindow.Height; float h = (svh.Y - sv.Y); float w = 18500 / (float)Vector3.Distance(mycoords, coords); float x = (int)(sv.X - w / 2); float y = (sv.Y); if ((eteam != mteam) && mteam != 1) { if (CheatData.lines_wh) { gfx.DrawLine(sx, sy, ex, ey, 2, new Direct2DColor(pen[0], pen[1], pen[2])); } if (CheatData.hp_wh) { gfx.DrawHorizontalBar(hp, x, y, 2, h, 1, new Direct2DColor(255, 0, 0), new Direct2DColor(0, 0, 0)); } if (CheatData.box) { double d = Vector3.Distance(mycoords, coords); if (d < 1f) { continue; } Drawbox(sv.X, sv.Y, (int)d); } if (CheatData.ranks) { gfx.DrawText(n, svh.X, svh.Y, new Direct2DFont(factory, "Arial", 12), new Direct2DColor(255, 0, 0)); gfx.DrawText(Ranks[rank], ex, ey, new Direct2DFont(factory, "Arial", 12), new Direct2DColor(255, 0, 0)); } } } } else { for (int i = 0; i < 100; i++) { MyBaseAdr = mem.Read <int>(CheatData.bClient + Offsets.Old.dwLocalPlayer); mteam = mem.Read <int>(MyBaseAdr + Offsets.Old.m_iTeamNum); mycoords = mem.Read <Vector3>(MyBaseAdr + Offsets.Old.m_vecOrigin); eBaseAdr = mem.Read <int>(CheatData.bClient + Offsets.Old.dwEntityList + (i * Offsets.New.Loop_offset)); eteam = mem.Read <int>(eBaseAdr + Offsets.Old.m_iTeamNum); dormant = mem.Read <bool>(eBaseAdr + Offsets.New.m_bDormant); // glowind = mem.Read<int>(eBaseAdr + Offsets.m_iGlowIndex); hp = mem.Read <int>(eBaseAdr + Offsets.Old.m_iHealth); coords = mem.Read <Vector3>(eBaseAdr + Offsets.Old.m_vecOrigin); head = CalcEnemyHead(eBaseAdr, 8); Gres = mem.Read <int>(CheatData.bClient + Offsets.Old.dwPlayerResource); rank = mem.Read <int>(Gres + Offsets.Old.m_iCompetitiveRanking + i * 4); int radar = mem.Read <int>(CheatData.bClient + Offsets.Old.dwRadarBase); name = mem.Read <char>(radar + (i * 50) + 0x204, 50); string n = string.Empty; for (int j = 0; j < 49; j++) { n += name[j]; } // // angles = mem.Read<Vector2>(eBaseAdr + Offsets.m_angEyeAngles); mt = mteam; et = eteam; if (MyBaseAdr == 0x0) { continue; } VMatrix = mem.Read <Matrix4x4>(CheatData.bClient + Offsets.Old.dwViewMatrix); ScreenVector sv = WorldToScreen(coords.X, coords.Y, coords.Z); ScreenVector svh = WorldToScreen(head.X, head.Y, head.Z); if (dormant) { continue; } if (hp == 0) { continue; } if (!sv.Result) { continue; } int ex = (int)sv.X; int ey = (int)sv.Y; int sx = WHwindow.Width / 2; int sy = WHwindow.Height; float h = (svh.Y - sv.Y); float w = 18500 / (float)Vector3.Distance(mycoords, coords); float x = (int)(sv.X - w / 2); float y = (sv.Y); if ((eteam != mteam) && mteam != 1) { if (CheatData.lines_wh) { gfx.DrawLine(sx, sy, ex, ey, 2, new Direct2DColor(pen[0], pen[1], pen[2])); } if (CheatData.hp_wh) { gfx.DrawHorizontalBar(hp, x, y, 2, h, 1, new Direct2DColor(255, 0, 0), new Direct2DColor(0, 0, 0)); } if (CheatData.box) { double d = Vector3.Distance(mycoords, coords); if (d < 1f) { continue; } Drawbox(sv.X, sv.Y, (int)d); } if (CheatData.ranks) { gfx.DrawText(n, svh.X, svh.Y, new Direct2DFont(factory, "Arial", 12), new Direct2DColor(255, 0, 0)); gfx.DrawText(Ranks[rank], ex, ey, new Direct2DFont(factory, "Arial", 12), new Direct2DColor(255, 0, 0)); } } } } gfx.EndScene(); //Thread.Sleep(5); } }
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(); } }
private void Update(object sender) { // set up our colours for drawing var blackBrush = d2d.CreateBrush(0, 0, 0, 255); var redBrush = d2d.CreateBrush(153, 0, 0, 128); var yellowBrush = d2d.CreateBrush(153, 153, 0, 128); var orangeBrush = d2d.CreateBrush(255, 200, 0, 255); var darkOrangeBrush = d2d.CreateBrush(255, 100, 0, 255); var greenBrush = d2d.CreateBrush(0, 255, 0, 255); var blueBrush = d2d.CreateBrush(0, 0, 255, 255); var whiteBrush = d2d.CreateBrush(250, 250, 250, 128); var vehicleBrush = d2d.CreateBrush(243, 243, 255, 128); var heroVisBrush = d2d.CreateBrush(240, 0, 255, 255); var heroBrush = d2d.CreateBrush(120, 0, 120, 255); // and our font var font = d2d.CreateFont("Tahoma", 9); Direct2DBrush brush; Console.WriteLine("Initialising..."); // initialise the GameManager class that handles the player data gameManager = new GameManager(process, new Rectangle(0, 0, overlay.Width, overlay.Height)); Console.WriteLine("Ready."); // main loop while (IsGameRunning) { if (gameManager.UpdateFrame(new Rectangle(0, 0, overlay.Width, overlay.Height))) { d2d.BeginScene(); d2d.ClearScene(clearBrush); if (OPTIONS_ShowFPS) { d2d.DrawTextWithBackground($"FPS: {d2d.FPS}", 20, 20, font, greenBrush, blackBrush); } foreach (Player player in gameManager.AllPlayers) { if (!player.IsDead) { if (player.IsVisible) { if (player.MaxHealth < 400) { brush = yellowBrush; } else { brush = heroVisBrush; } } else { if (player.MaxHealth < 400) { brush = redBrush; } else { brush = heroBrush; } } if (!player.InVehicle) { /*if (!player.IsVisible)*/ DrawAABB(player.TransformAABB, brush); } else { brush = vehicleBrush; DrawAABB(player.TransformAABB, brush); } var name = player.Name; var dist = $"{(int)player.Distance}m"; Vector3 textPos = new Vector3(player.Position.X, player.Position.Y, player.Position.Z); if (gameManager.WorldToScreen(textPos, out textPos)) { var textPosX = textPos.X - ((name.Length * font.FontSize) / 4); d2d.DrawText(name, textPosX - 1, textPos.Y - 1, font, blackBrush); d2d.DrawText(name, textPosX, textPos.Y, font, whiteBrush); textPosX = textPos.X - ((dist.Length * font.FontSize) / 4); var textPosY = textPos.Y + font.FontSize; d2d.DrawText(dist, textPosX - 1, textPosY - 1, font, blackBrush); d2d.DrawText(dist, textPosX, textPosY, font, whiteBrush); } } } d2d.EndScene(); } } // clean up if the game has closed RPM.CloseProcess(); Environment.Exit(0); }