public ESP() { // initialize a new Graphics object // GraphicsWindow will do the remaining initialization var graphics = new GameOverlay.Drawing.Graphics { MeasureFPS = true, PerPrimitiveAntiAliasing = true, TextAntiAliasing = true, UseMultiThreadedFactories = false, VSync = true, WindowHandle = IntPtr.Zero }; // it is important to set the window to visible (and topmost) if you want to see it! _window = new StickyWindow(EntityUpdater.EntityUpdater.handle, graphics) { IsTopmost = true, IsVisible = true, FPS = 144, X = EntityUpdater.EntityUpdater.ScreenRect.left, Y = EntityUpdater.EntityUpdater.ScreenRect.top, Width = EntityUpdater.EntityUpdater.ScreenSize.Width, Height = EntityUpdater.EntityUpdater.ScreenSize.Height }; _window.DrawGraphics += _window_DrawGraphics; }
private void DrawProgressBarDirectX(GameOverlay.Drawing.Graphics g, GameOverlay.Drawing.SolidBrush bgBrush, GameOverlay.Drawing.SolidBrush foreBrush, float x, float y, float width, float height, float value, float maximum = 100) { // Draw BG. g.DrawRectangle(bgBrush, x, y, x + width, y + height, 3f); // Draw FG. GameOverlay.Drawing.Rectangle foreRect = new GameOverlay.Drawing.Rectangle( x, y, x + ((width * value / maximum)), y + (height) ); g.FillRectangle(foreBrush, foreRect); }
private void statisticsPanelDirectX_Paint(GameOverlay.Windows.OverlayWindow w, GameOverlay.Drawing.Graphics g) { // Additional information and stats. // Adjustments for displaying text properly. int xOffset = 5; int yOffset = 640; int heightGap = 15; int i = 1; // IGT Display. g.DrawText(font, 22, whiteBrush, xOffset + 0, yOffset + 0, string.Format("{0}", Program.gameMem.IGTString)); if (Program.programSpecialOptions.Flags.HasFlag(ProgramFlags.Debug)) { g.DrawText(font, 14, greyBrush, xOffset + 0, yOffset + 25, "Raw IGT"); g.DrawText(font, 14, greyBrush, xOffset + 0, yOffset + 38, "A:" + Program.gameMem.IGTRunningTimer.ToString("00000000000000000000")); g.DrawText(font, 14, greyBrush, xOffset + 0, yOffset + 53, "C:" + Program.gameMem.IGTCutsceneTimer.ToString("00000000000000000000")); g.DrawText(font, 14, greyBrush, xOffset + 0, yOffset + 68, "M:" + Program.gameMem.IGTMenuTimer.ToString("00000000000000000000")); g.DrawText(font, 14, greyBrush, xOffset + 0, yOffset + 83, "P:" + Program.gameMem.IGTPausedTimer.ToString("00000000000000000000")); yOffset += 70; // Adding an additional offset to accomdate Raw IGT. } g.DrawText(font, 16, greyBrush, xOffset + 0, yOffset + (heightGap * ++i), string.Format("DA Rank: {0}", Program.gameMem.Rank)); g.DrawText(font, 16, greyBrush, xOffset + 0, yOffset + (heightGap * ++i), string.Format("DA Score: {0}", Program.gameMem.RankScore)); g.DrawText(font, 16, redBrush, xOffset + 0, yOffset + (heightGap * ++i), "Enemy HP"); yOffset += 6; foreach (EnemyHP enemyHP in Program.gameMem.EnemyHealth.Where(a => a.IsAlive).OrderBy(a => a.Percentage).ThenByDescending(a => a.CurrentHP)) { int x = xOffset + 0; int y = yOffset + (heightGap * ++i); DrawProgressBarDirectX(g, backBrushDirectX, foreBrushDirectX, x, y, 158, heightGap, enemyHP.Percentage * 100f, 100f); g.DrawText(font, 12, redBrush, x + 5, y, string.Format("{0} {1:P1}", enemyHP.CurrentHP, enemyHP.Percentage)); } }
private void inventoryPanelDirectX_Paint(GameOverlay.Windows.OverlayWindow w, GameOverlay.Drawing.Graphics g) { //if (!Program.programSpecialOptions.Flags.HasFlag(ProgramFlags.NoInventory)) //{ // foreach (InventoryEntry inv in Program.gameMem.PlayerInventory) // { // if (inv == default || inv.SlotPosition < 0 || inv.SlotPosition > 19 || inv.IsEmptySlot) // continue; // int slotColumn = inv.SlotPosition % 4; // int slotRow = inv.SlotPosition / 4; // int imageX = slotColumn * Program.INV_SLOT_WIDTH; // int imageY = slotRow * Program.INV_SLOT_HEIGHT; // int textX = imageX + Program.INV_SLOT_WIDTH; // int textY = imageY + Program.INV_SLOT_HEIGHT; // bool evenSlotColumn = slotColumn % 2 == 0; // Brush textBrush = Brushes.White; // if (inv.Quantity == 0) // textBrush = Brushes.DarkRed; // GameOverlay.Drawing.Image imageBrush; // Weapon weapon; // if (inv.IsItem && GameMemory.ItemToImageTranslation.ContainsKey(inv.ItemID)) // { // if (inv.ItemID == ItemEnumeration.OldKey) // imageBrush = new TextureBrush(GameMemory.inventoryImagePatch1, GameMemory.ItemToImageTranslation[inv.ItemID]); // else // imageBrush = new TextureBrush(GameMemory.inventoryImage, GameMemory.ItemToImageTranslation[inv.ItemID]); // } // else if (inv.IsWeapon && GameMemory.WeaponToImageTranslation.ContainsKey(weapon = new Weapon() { WeaponID = inv.WeaponID, Attachments = inv.Attachments })) // imageBrush = new TextureBrush(GameMemory.inventoryImage, GameMemory.WeaponToImageTranslation[weapon]); // else // imageBrush = new TextureBrush(inventoryError, new Rectangle(0, 0, Program.INV_SLOT_WIDTH, Program.INV_SLOT_HEIGHT)); // // Double-slot item. // if (imageBrush.Image.Width == Program.INV_SLOT_WIDTH * 2) // { // // If we're an odd column, we need to adjust the transform so the image doesn't get split in half and tiled. Not sure why it does this. // if (!evenSlotColumn) // imageBrush.TranslateTransform(Program.INV_SLOT_WIDTH, 0); // // Shift the quantity text over into the 2nd slot's area. // textX += Program.INV_SLOT_WIDTH; // } // g.CreateImage(Properties.Resources.ui0100_iam_texout.); // g.FillRectangle(imageBrush, imageX, imageY, imageBrush.Image.Width, imageBrush.Image.Height); // g.DrawText(font, 14, greyBrush, textX, textY, (inv.Quantity != -1) ? inv.Quantity.ToString() : "∞"); // //font, 14, greyBrush // } //} }