private bool CreateOverlay() { if (_isOverlayInitialized && !_isOverlayReady && _gameMemory.Process.WindowHandle != IntPtr.Zero) { _window.Create(); _graphics.Width = _window.Width; _graphics.Height = _window.Height; _graphics.WindowHandle = _window.Handle; _graphics.Setup(); _window.SizeChanged += (object sender, OverlaySizeEventArgs e) => _graphics.Resize(_window.Width, _window.Height); _window.FitTo(_gameMemory.Process.WindowHandle, true); if (_windowEventDispatcher != null) { _windowEventDispatcher.Invoke(delegate { WinEventHook.WinEventDelegate windowEventDelegate = new WinEventHook.WinEventDelegate(MoveGameWindowEventCallback); _windowEventGCHandle = GCHandle.Alloc(windowEventDelegate); _windowEventHook = WinEventHook.WinEventHookOne(WinEventHook.SWEH_Events.EVENT_OBJECT_LOCATIONCHANGE, windowEventDelegate, (uint)_gameMemory.Process.Id, WinEventHook.GetWindowThread(_gameMemory.Process.WindowHandle)); }); } //Get a refernence to the underlying RenderTarget from SharpDX. This'll be used to draw portions of images. _device = (SharpDX.Direct2D1.WindowRenderTarget) typeof(Graphics) .GetField("_device", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance) .GetValue(_graphics); _consolas14Bold = _graphics.CreateFont("Consolas", 14, true); _consolas16Bold = _graphics.CreateFont("Consolas", 16, true); _consolas32Bold = _graphics.CreateFont("Consolas", 32, true); _black = _graphics.CreateSolidBrush(0, 0, 0, Config.Opacity); _white = _graphics.CreateSolidBrush(255, 255, 255, Config.Opacity); _green = _graphics.CreateSolidBrush(0, 128, 0, Config.Opacity); _lawngreen = _graphics.CreateSolidBrush(124, 252, 0, Config.Opacity); _red = _graphics.CreateSolidBrush(255, 0, 0, Config.Opacity); _darkred = _graphics.CreateSolidBrush(139, 0, 0, Config.Opacity); _grey = _graphics.CreateSolidBrush(128, 128, 128, Config.Opacity); _darkergrey = _graphics.CreateSolidBrush(60, 60, 60, Config.Opacity); _gold = _graphics.CreateSolidBrush(255, 215, 0, Config.Opacity); _goldenrod = _graphics.CreateSolidBrush(218, 165, 32, Config.Opacity); _violet = _graphics.CreateSolidBrush(238, 130, 238, Config.Opacity); _characterSheet = ImageLoader.LoadBitmap(_device, Properties.Resources.portraits); _inventorySheet = ImageLoader.LoadBitmap(_device, Properties.Resources.objects); _isOverlayReady = true; } return(_isOverlayReady); }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { csgo = (CSGOImplementation)Program.GameImplementation; if (csgo == null) { return; } if (csgo.Players == null) { return; } this.UpdateBoundaries(); int idx = 0, numPlayers = PlayersNum(); this.Width = (numPlayers + 1) * elementWidth; //Base FillRectangle(device, Theme.BackColor * 0.5f, this.X, this.Y, this.Width, this.Height); DrawRectangle(device, Theme.BorderColor, this.X, this.Y, this.Width, this.Height); DrawText(device, Theme.ForeColor, this.X, this.Y + this.Height / 2f, 100f, 20f, this.Text, this.Font); //Min/Max DrawText( device, Theme.ForeColor, this.X + 2f, this.Y + 2f, 20f, 20f, this.MaxValue.ToString(), this.Font); DrawText( device, Theme.ForeColor, this.X + 2f, this.Y + this.Height - 20f, 20f, 20f, this.MinValue.ToString(), this.Font); try { foreach (Player player in csgo.Players) { if (player != null) { DrawPlayer(device, player, idx++, numPlayers); } } } catch { } }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { /* BackColor: Background * ForeColor: BarLow * ShadowColor: BarHigh * BorderColor: Border & Font */ if (Theme.BackColor != Color.Transparent) { FillRectangle(device, ProgressBarTheme.BackColor, X, Y, Width, Height); } DrawRectangle(device, ProgressBarTheme.BorderColor, X, Y, Width, Height); Color color = ProgressBarTheme.Low; if (ProgressBarTheme.IsTransitioning) { color = new Color( (byte)(ProgressBarTheme.Low.R + (ProgressBarTheme.High.R - ProgressBarTheme.Low.R) / maxValue * currValue), (byte)(ProgressBarTheme.Low.G + (ProgressBarTheme.High.G - ProgressBarTheme.Low.G) / maxValue * currValue), (byte)(ProgressBarTheme.Low.B + (ProgressBarTheme.High.B - ProgressBarTheme.Low.B) / maxValue * currValue), (byte)(ProgressBarTheme.Low.A + (ProgressBarTheme.High.A - ProgressBarTheme.Low.A) / maxValue * currValue) ); } if (this.Enabled) { FillRectangle(device, ( blinkingEnabled && currValue >= maxValue * blinkingThreshold ? color * (0.75f + 0.25f * GetColorMultiplier()) : color ), X + 1f, Y + 1f, Width / maxValue * currValue - 2f, Height - 2f); } else { FillRectangle(device, ProgressBarTheme.BorderColor * 0.25f, X + 1f, Y + 1f, Width - 2f, Height - 2f); } DrawText(device); }
public override void Dispose() { base.Dispose(); this.direct2D1factory?.Dispose(); this.direct2D1factory = null; this.windowRenderTarget?.Dispose(); this.windowRenderTarget = null; GC.Collect(); }
public override int Shutdown() { SaveConfiguration(Config); try { if (_windowEventGCHandle.IsAllocated) { _windowEventGCHandle.Free(); } if (_windowEventHook != IntPtr.Zero) { WinEventHook.WinEventUnhook(_windowEventHook); } _windowEventDispatcher?.InvokeShutdown(); } catch (Exception ex) { _hostDelegates.ExceptionMessage(ex); } _black?.Dispose(); _white?.Dispose(); _green?.Dispose(); _lawngreen?.Dispose(); _grey?.Dispose(); _darkergrey?.Dispose(); _red?.Dispose(); _darkred?.Dispose(); _gold?.Dispose(); _goldenrod?.Dispose(); _violet?.Dispose(); _consolas14Bold?.Dispose(); _consolas16Bold?.Dispose(); _consolas32Bold?.Dispose(); _characterSheet?.Dispose(); _characterToImageTranslation = null; _windowEventHook = IntPtr.Zero; _windowEventDispatcher = null; _device = null; _graphics?.Dispose(); _graphics = null; _window?.Dispose(); _window = null; _isOverlayInitialized = false; _isOverlayReady = false; return(0); }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { if (Theme.ShadowColor != Color.Transparent) { FillRectangle(device, Theme.ShadowColor, X, Y, Width, Height); } if (Theme.BackColor != Color.Transparent) { FillRectangle(device, Theme.BackColor, X, Y, Width, Height); } }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { if (!Visible) { return; } //Reorder(); //if (this.Y + this.Height > Program.GameController.Form.Height) //{ // base.SetPosition(this.X, Program.GameController.Form.Height - this.Height); //} }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { this.DrawRectangle(device, this.Theme.BorderColor, this.X, this.Y, this.Width, this.Height); this.FillRectangle(device, this.Theme.BackColor, this.X, this.Y, this.Width, this.Height); this.DrawText(device, this.Theme.ForeColor, this.X + 2f, this.Y + 2f, this.Width - 4f, this.Height - 4f, String.Format("{0}: {1}", this.Text, this.acceptKey ? "(PRESS KEY)" : this.key.ToString()), this.Font); }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { this.DrawRectangle(device, this.Theme.BorderColor, this.X, this.Y, this.Width, this.Height); this.FillRectangle(device, this.Theme.BackColor, this.X, this.Y, this.Width, this.Height); this.DrawText(device, this.Theme.ForeColor, this.X + 2f, this.Y + 2f, this.Width - 4f, this.Height - 4f, String.Format("{0}: {1}", this.Text, Program.GameImplementation.GetValue(this.ExtraData).ToString()), //this.CurrentOptionValue), this.Font); }
protected virtual void DrawText(SharpDX.Direct2D1.WindowRenderTarget device) { if (!string.IsNullOrEmpty(Text)) { DrawText(device, ProgressBarTheme.ForeColor, X + 4f, Y + 2f, Width - 4f, Height, Text, Font); } }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { this.DrawRectangle(device, this.Theme.BorderColor, this.X, this.Y, this.Width, this.Height); this.FillRectangle(device, this.Theme.BackColor, this.X, this.Y, this.Width, this.Height); this.DrawText( device, this.Theme.ForeColor, this.X + 2f, this.Y + 2f, this.Width - 4f, this.Height - 4f, String.Format("{0}: {1}", this.Text, Math.Round(this.Value, 2).ToString()), this.Font ); DrawTrackBar(device, this.X + this.Width / 2f, this.Y, this.Width / 2f, this.Height); }
private void EnframeText(SharpDX.Direct2D1.WindowRenderTarget device, float x, float y, float width, float height, string text, bool drawBgColor) { if (drawBgColor) { FillRectangle(device, Theme.BackColor, x, y, width, height); } DrawRectangle(device, Theme.BorderColor, x, y, height, height); DrawText( device, Theme.ForeColor, x + 2f, y + 2f, width - 4f, height - 4f, text, this.Font); }
private void DrawTrackBar(SharpDX.Direct2D1.WindowRenderTarget device, float x, float y, float width, float height) { float lineHeight = height / 4f, lineX = x + lineHeight / 2f, lineY = y + height / 2f - lineHeight / 2f, lineWidth = width - lineHeight; this.FillRectangle(device, this.Theme.BackColor, lineX, lineY, lineWidth, lineHeight); this.DrawRectangle(device, this.Theme.BorderColor, lineX, lineY, lineWidth, lineHeight); float barWidth = height / 2f, barX = lineWidth / (maximum - minimum) * (value - minimum) + lineX - barWidth / 2f; this.FillRectangle(device, this.Theme.BackColor, barX, y, barWidth, height); this.DrawRectangle(device, this.Theme.BorderColor, barX, y, barWidth, height); }
//public override void SetPosition(float x, float y) //{ // float distX = x - X, distY = y - Y; // foreach (Control childControl in ChildControls) // childControl.SetPosition(childControl.X + distX, childControl.Y + distY); // base.SetPosition(x, y); //} protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { this.FillRectangle(device, this.Theme.BackColor, this.X, this.Y, this.Width, this.Height); if (ChildMenu != null) { ChildMenu.Draw(device); } if (!fixedPosition && this.Y + this.Height > Program.GameController.Form.Height) { this.SetPosition(this.X, Program.GameController.Form.Height - this.Height); } }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { this.DrawRectangle(device, this.Theme.BorderColor, this.X, this.Y, this.Width, this.Height); this.FillRectangle(device, this.Theme.BackColor, this.X, this.Y, this.Width, this.Height); string text = this.Text; if (ParentMenu != null) { if (ParentMenu.ChildMenu == null) { text += " >"; } else if (ParentMenu.ChildMenu == ChildMenu) { text = "< " + text; } } this.DrawText(device, this.Theme.ForeColor, this.X + 2f, this.Y + 2f, this.Width - 4f, this.Height - 4f, text, this.Font); }
protected override void DrawPlayer(SharpDX.Direct2D1.WindowRenderTarget device, Player player, int index, int numPlayers) { float kd = player.Deaths > 0 ? (player.Kills / player.Deaths) : player.Kills; float rectWidth = ElementWidth, rectX = this.X + rectWidth * (index + 1), rectHeight = this.Height / MaxValue * kd, rectY = this.Y + Height - rectHeight; FillRectangle(device, (player.InTeam == Team.CounterTerrorists ? colorCT : colorT) * (player.Index == CSGO.LocalPlayer.Index ? (0.75f + 0.25f * GetColorMultiplier()) : 1), rectX, rectY, rectWidth, rectHeight); DrawRectangle(device, Theme.BorderColor, rectX, rectY, rectWidth, rectHeight); float textY = rectY - 20f; if (textY < this.Y) { textY = this.Y; } else if (textY + 20f > this.Y + this.Height) { textY = this.Y + this.Height - 20f; } DrawText(device, Theme.ForeColor, Theme.ShadowColor, rectX, textY, rectWidth, 20f, Theme.ShadowOffsetX, Theme.ShadowOffsetY, String.Format("{0} ({1})", player.Name, kd), this.Font); }
public DUIWindowRenderTarget(IntPtr handle) { Size size = System.Windows.Forms.Control.FromHandle(handle).Size; this.direct2D1factory = new SharpDX.Direct2D1.Factory(SharpDX.Direct2D1.FactoryType.SingleThreaded); SharpDX.Direct2D1.HwndRenderTargetProperties hwndRenderTargetProperties = new SharpDX.Direct2D1.HwndRenderTargetProperties() { Hwnd = handle, PixelSize = new SharpDX.Size2(size.Width, size.Height), PresentOptions = SharpDX.Direct2D1.PresentOptions.None }; SharpDX.Direct2D1.PixelFormat pixelFormat = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.Unknown, SharpDX.Direct2D1.AlphaMode.Premultiplied); //强制设置DPI为96,96(默认值),无意间发现有的人居然会去修改系统的dpi SharpDX.Direct2D1.RenderTargetProperties renderTargetProperties = new SharpDX.Direct2D1.RenderTargetProperties(SharpDX.Direct2D1.RenderTargetType.Default, pixelFormat, 96, 96, SharpDX.Direct2D1.RenderTargetUsage.None, SharpDX.Direct2D1.FeatureLevel.Level_DEFAULT); //初始化,在_d2dFactory创建渲染缓冲区并与Target绑定 //SharpDX.Direct2D1.PixelFormat pf = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.Unknown, SharpDX.Direct2D1.AlphaMode.Premultiplied); this.windowRenderTarget = new SharpDX.Direct2D1.WindowRenderTarget(direct2D1factory, renderTargetProperties, hwndRenderTargetProperties); this.windowRenderTarget.AntialiasMode = SharpDX.Direct2D1.AntialiasMode.Aliased; this.windowRenderTarget.TextAntialiasMode = SharpDX.Direct2D1.TextAntialiasMode.Aliased; }
public void DrawGlyphRuns(SharpDX.Direct2D1.WindowRenderTarget renderTarget, SharpDX.Direct2D1.Brush brush) { // Just iterate through all the saved glyph runs // and have DWrite to draw each one. for (int i = 0; i < glyphRuns_.Count; i++) { CustomGlyphRun customGlyphRun = glyphRuns_[i]; if (customGlyphRun.glyphCount == 0) { continue; } GlyphRun glyphRun = customGlyphRun.Convert(glyphIndices_, glyphAdvances_, glyphOffsets_); if (glyphRun != null) { renderTarget.DrawGlyphRun(new System.Drawing.PointF(customGlyphRun.x, customGlyphRun.y), ref glyphRun, brush, MeasuringMode.Natural); } } }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { float x = this.X; RectangleF rect = (AutoSize ? MeasureString(this.Font, this.Text) : Rectangle); if (this.align == HorizontalAlign.Center) { x = this.X - rect.Width / 2f; } if (this.align == HorizontalAlign.Right) { x = this.X - rect.Width; } if (!castShadow) { DrawText(device, this.Theme.ForeColor, x, this.Y, this.Width, this.Height, this.Text, this.Font); } else { DrawText(device, this.Theme.ForeColor, this.Theme.ShadowColor, this.X, this.Y, this.Width, this.Height, this.Theme.ShadowOffsetX, this.Theme.ShadowOffsetY, this.Text, this.Font); } }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { if (Program.GameImplementation.GetValue <YesNo>("menuEnabled") == YesNo.Yes) { mainMenu.Draw(device); } if (Program.GameImplementation.GetValue <YesNo>("radarEnabled") == YesNo.Yes) { ctrlRadar.Draw(device); } if (Program.GameImplementation.GetValue <YesNo>("espEnabled") == YesNo.Yes) { ctrlEsp.Draw(device); } if (Program.GameImplementation.GetValue <YesNo>("crosshairEnabled") == YesNo.Yes) { ctrlCrosshair.Draw(device); } if (Program.GameImplementation.GetValue <YesNo>("miscInfoEnabled") == YesNo.Yes) { ctrlPlayerInformation.Draw(device); } }
private void DrawEntity(SharpDX.Direct2D1.WindowRenderTarget device, Player currentPlayer, Entity entity, Vector2 screenMid, float scale) { if (entity == null) { return; } if (!entity.IsValid()) { return; } if (entity.Address == currentPlayer.Address) { return; } if (entity.ClassID == Data.Enums.ClassID.Weapon) { if (entity.OwnerEntity != -1) { return; } } Vector2 point = entity.Vector2; point.X = screenMid.X + (currentPlayer.X - entity.X) * scale * -1; point.Y = screenMid.X + (currentPlayer.Y - entity.Y) * scale; point = Geometry.RotatePoint(point, screenMid, currentPlayer.Yaw - 90); //If player is in range //if (point.X >= X && point.X <= X + Width && point.Y >= Y && point.Y <= Y + Height && csgo.GetValue<OnOff>("radarDrawView") == OnOff.On) //{ // Vector2 view1 = point; // view1.Y -= viewY * scale; // view1.X += viewX * scale; // view1 = Geometry.RotatePoint(view1, point, currentPlayer.Yaw - entity.Yaw); // Vector2 view2 = point; // view2.Y -= viewY * scale; // view2.X -= viewX * scale; // view2 = Geometry.RotatePoint(view2, point, currentPlayer.Yaw - entity.Yaw); // FillPolygon(device, viewColor, point, view1, view2); // DrawPolygon(device, viewColorOutline, point, view1, view2); //} if (point.X < X) { point.X = X + dotSize / 2f; } if (point.Y < Y) { point.Y = Y + dotSize / 2f; } if (point.X > X + Width) { point.X = X + Width - dotSize / 2f; } if (point.Y > Y + Height) { point.Y = Y + Height - dotSize / 2f; } //if (csgo.GetValue<OnOff>("radarDrawLines") == OnOff.On) //{ // DrawLine(device, enemyColor, point.X, point.Y, screenMid.X, screenMid.Y, 1f); //} FillEllipse(device, CSGOTheme.LifebarForeground, point.X, point.Y, dotSize * scale, dotSize * scale, true); }
private void DrawPlayer(SharpDX.Direct2D1.WindowRenderTarget device, Player currentPlayer, Player player, Vector2 screenMid, float scale) { if (player == null) { return; } if (!player.IsValid()) { return; } if (player.Index == currentPlayer.Index) { return; } if (csgo.GetValue <Target>("radarDrawTarget") == Target.Enemies && player.InTeam == currentPlayer.InTeam) { return; } if (csgo.GetValue <Target>("radarDrawTarget") == Target.Allies && player.InTeam != currentPlayer.InTeam) { return; } Vector2 point = player.Vector2; point.X = (currentPlayer.X - player.X) * scale * -1; point.Y = (currentPlayer.Y - player.Y) * scale; bool highlighted = csgo.Highlighted[player.Index - 1]; if (point.Length() > this.Width / 2f) { point.Normalize(); point *= this.Width / 2f; } point += screenMid; point = Geometry.RotatePoint(point, screenMid, currentPlayer.Yaw - 90); //If player is in range if (csgo.GetValue <OnOff>("radarDrawLines") == OnOff.On) { DrawLine(device, CSGOTheme.Line, point.X, point.Y, screenMid.X, screenMid.Y, 1f); } FillEllipse(device, player.InTeam == Team.CounterTerrorists ? CSGOTheme.TeamCT : CSGOTheme.TeamT, point.X + dotSize / 2f, point.Y + dotSize / 2f, dotSize, dotSize, true); if (highlighted) { DrawEllipse(device, (player.InTeam == Team.Terrorists ? CSGOTheme.TeamT : CSGOTheme.TeamCT) * (DateTime.Now.Millisecond % 1000f / 1000f), point.X + (dotSize / 2f * scale), point.Y + (dotSize / 2f * scale), dotSize * scale * 4f, dotSize * scale * 4f, true); } }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { csgo = (CSGOImplementation)Program.GameImplementation; FillRectangle(device, Theme.BackColor, this.X, this.Y, this.Width, this.Height); lblDataRead.Text = string.Format("Data read: {0}", GetSize(WinAPI.BytesRead)); lblDataWritten.Text = string.Format("Data written: {0}", GetSize(WinAPI.BytesWritten)); //Update performance-bars /* ((CSGOGameController)Program.GameController).MemoryUpdater.GetFrameRate().ToString(), * ((CSGOGameController)Program.GameController).InputUpdater.GetFrameRate().ToString(), * ((CSGOGameController)Program.GameController).TriggerBot.GetFrameRate().ToString(), * ((CSGOGameController)Program.GameController).AimBot.GetFrameRate().ToString()*/ barMem.Value = ((CSGOGameController)Program.GameController).MemoryUpdater.GetFrameRate(); barMem.Text = String.Format("MEM {0}", barMem.Value); barInp.Value = ((CSGOGameController)Program.GameController).InputUpdater.GetFrameRate(); barInp.Text = String.Format("INP {0}", barInp.Value); barAim.Value = ((CSGOGameController)Program.GameController).AimBot.GetFrameRate(); barAim.Text = String.Format("AIM {0}", barAim.Value); barTrg.Value = ((CSGOGameController)Program.GameController).TriggerBot.GetFrameRate(); barTrg.Text = String.Format("TRG {0}", barTrg.Value); barDrw.Value = ((CSGOGameController)Program.GameController).Form.DrawUpdater.GetFrameRate(); barDrw.Text = String.Format("DRW {0}", barDrw.Value); barTick.Value = ((CSGOGameController)Program.GameController).Form.TickUpdater.GetFrameRate(); barTick.Text = String.Format("TCK {0}", barTick.Value); barRcs.Value = ((CSGOGameController)Program.GameController).RecoilControl.GetFrameRate(); barRcs.Text = String.Format("RCS {0}", barRcs.Value); barCPU.Value = ((CSGOGameController)Program.GameController).PerformanceUpdater.CurrentValue; barCPU.Text = String.Format("CPU {0}", barCPU.Value); //Update playerinfo //if (currentPlayer == null) // return; Player currentPlayer = csgo.GetCurrentPlayer(); bool valid = currentPlayer != null; lblState.Text = String.Format("State: {0}", GetSignOnState(csgo.SignOnState)); lblServerData.Text = String.Format("Server: {0}", csgo.ServerName); lblServerIP.Text = String.Format("IP: {0}", csgo.ServerIP); lblMapName.Text = String.Format("Current map: {0}", csgo.ServerMap); if (valid) { valid = csgo.SignOnState == SignOnState.SIGNONSTATE_FULL; } barSpeed.Enabled = valid; barRecoil.Enabled = valid; barSpread.Enabled = valid; barKD.Enabled = valid; if (valid) { //Velocity Vector2 velXY = new Vector2(currentPlayer.Velocity.X, currentPlayer.Velocity.Y); float length = velXY.Length(); float speedPercent = 100f / 450f * (length % 450f); float speedMeters = length * 0.01905f; float speedKiloMetersPerHour = speedMeters * 60f * 60f / 1000f; barSpeed.Value = (int)speedPercent; barSpeed.Text = String.Format("{0} km/h", Math.Round(speedKiloMetersPerHour, 2)); //Gun info if (Environment.TickCount - spinTick > 300) { spinnerCnt++; spinnerCnt %= spinners.Length; spinTick = Environment.TickCount; } lblWeaponInfo.Text = String.Format( "{0} [{1}] [{2}/{3}] {5}{4}", csgo.WeaponName, csgo.WeaponType, csgo.WeaponClip1 > 0 && csgo.WeaponClip1 <= 200 && !csgo.IsReloading ? csgo.WeaponClip1.ToString() : (csgo.IsReloading ? "RELOADING" + spinners[spinnerCnt].ToString() : "-"), csgo.WeaponClip2 > 0 && csgo.WeaponClip2 <= 500 ? csgo.WeaponClip2.ToString() : "-", (csgo.IsShooting ? "[x]" : ""), (csgo.WeaponShotsFired > 0 ? string.Format("[{0}] ", csgo.WeaponShotsFired.ToString()) : "") ); //lblShotsFired.Text = String.Format("Shots fired: {0}", csgo.ShotsFired); //Gun punch float percentage = 100f / 9f * currentPlayer.PunchVector.Length(); barRecoil.Value = percentage; barRecoil.Text = String.Format("Recoil: {0}%", Math.Round(percentage, 0)); //Gun spread percentage = 100f / 0.16f * csgo.AccuracyPenality; percentage = (float)Math.Min(percentage, 100f); barSpread.Value = percentage; barSpread.Text = String.Format("Spread: {0}%", Math.Round(percentage, 0)); //KD if (currentPlayer.Deaths > 0) { float kd = (float)currentPlayer.Kills / (float)Math.Max(1, currentPlayer.Deaths); barKD.Value = kd; barKD.Text = String.Format("k/d ratio: {0}", Math.Round(kd, 2)); } else { barKD.Value = 0; barKD.Text = "k/d ratio: ∞"; } } else { barSpeed.Value = 0f; barRecoil.Value = 0f; barSpread.Value = 0f; barKD.Value = 0f; barSpeed.Text = ""; barRecoil.Text = ""; barSpread.Text = ""; barKD.Text = ""; lblWeaponInfo.Text = ""; lblServerData.Text = ""; lblMapName.Text = ""; } }
internal D2DGraphics(SharpDX.Direct2D1.WindowRenderTarget RenderTarget2D, SharpDX.DirectWrite.Factory FactoryDWrite) { D2Drender = RenderTarget2D; DWrender = FactoryDWrite; utils = new D2DUtils(RenderTarget2D, FactoryDWrite); }
internal D2DUtils(SharpDX.Direct2D1.WindowRenderTarget RenderTarget2D, SharpDX.DirectWrite.Factory FactoryDWrite) { D2Drender = RenderTarget2D; DWrender = FactoryDWrite; }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { this.DrawRectangle(device, this.Theme.BorderColor, this.X, this.Y, this.Width, this.Height); this.FillRectangle(device, this.Theme.BackColor, this.X, this.Y, this.Width, this.Height); this.DrawText(device, this.Theme.ForeColor, this.X + 2f, this.Y + 2f, this.Width - 4f, this.Height - 4f, this.Text, FactoryManager.GetFont("smallSegoe")); }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { csgo = (CSGOImplementation)Program.GameImplementation; if (csgo == null) { return; } CSGOGameController csController = (CSGOGameController)Program.GameController; Player currentPlayer = csgo.GetCurrentPlayer(); if (currentPlayer == null) { return; } float screenW = csgo.ScreenSize.Width / 2f, screenH = csgo.ScreenSize.Height / 2f;//, width = 64; float multiplier = GetColorMultiplier(); #region aimbot radius if (Program.GameImplementation.GetValue <YesNo>("aimbotEnabled") == YesNo.Yes) { float aimRadius = Program.GameImplementation.GetValue <float>("aimbotRadius"); FillEllipse(device, aimBackColor, screenW, screenH, aimRadius * 2, aimRadius * 2, true ); DrawEllipse(device, backColor, screenW, screenH, aimRadius * 2, aimRadius * 2, true ); } #endregion #region soundesp if (Program.GameImplementation.GetValue <YesNo>("crosshairDrawSoundESP") == YesNo.Yes) { if (csController.SoundESP.LastPercent != 0f) { float size = 250f * csController.SoundESP.LastPercent / 100f; DrawEllipse(device, aimBackColor, screenW, screenH, size, size, true, 2f); } } #endregion #region recoil if (Program.GameImplementation.GetValue <YesNo>("crosshairDrawRecoil") == YesNo.Yes) { if (csgo.LocalPlayer.PunchVector.Length() != 0f) { float x = Program.GameController.Form.Width / 2f; float y = Program.GameController.Form.Height / 2f; float dy = Program.GameController.Form.Height / 90f; float dx = Program.GameController.Form.Width / 90f; x -= (dx * (csgo.LocalPlayer.PunchVector.Y)); y += (dy * (csgo.LocalPlayer.PunchVector.X)); //float pixelPerDeg = 1680f / 90f; //float distX = csgo.LocalPlayer.PunchVector.Y * 2; //float distY = csgo.LocalPlayer.PunchVector.X * 2 * -1f; //float x = csgo.ScreenSize.Width / 2f - distX * pixelPerDeg; //float y = csgo.ScreenSize.Height / 2f - distY * pixelPerDeg; DrawLine(device, colorT * 0.5f, x - 16f, y, x + 16f, y, 4f); DrawLine(device, colorT * 0.5f, x, y - 16f, x, y + 16f, 4f); } } #endregion #region spectator if (Program.GameImplementation.GetValue <YesNo>("spectatorDrawWarning") == YesNo.Yes) { float height = 22f + 20f * csgo.Spectators.Count; float specx = screenW - specPanelWidth / 2f, specy = csgo.ScreenSize.Height - 4 - height; if (csgo.Spectators.Count > 0) { FillRectangle(device, aimBackColor, specx, specy, specPanelWidth, height ); FillRectangle(device, aimBackColor, specx, specy, specPanelWidth, height ); DrawText(device, colorT, backColor, specx + specPanelMarginNames, specy + 2, 100, 20, 1, 1, "Spectators:", FactoryManager.GetFont("largeSegoe")); } for (int i = 0; i < csgo.Spectators.Count; i++) { try { DrawText(device, csgo.Spectators[i].SpectatorView == Data.Enums.SpectatorView.Ego ? colorT * (0.75f + 0.25f * multiplier) : colorT, backColor, specx + specPanelMarginNames, specy + 2f + (i + 1) * 20f, 256, 20, 1, 1, String.Format("{0} ({1})", csgo.Spectators[i].Name, csgo.Spectators[i].SpectatorView), FactoryManager.GetFont("smallSegoe")); if (csgo.Spectators[i].SpectatorView == Data.Enums.SpectatorView.Ego) { DrawText(device, colorT * (0.75f + 0.25f * multiplier), backColor, specx - specPanelExclMrk, specy + 2f + (i + 1) * 20f, 24f, 20, 1, 1, "!", FactoryManager.GetFont("smallSegoe")); } } catch { } } } #endregion #region crosshair if (Program.GameImplementation.GetValue <YesNo>("crosshairEnabled") == YesNo.Yes) { float inaccuracy = 0f; Color drawColor = backColor; if (csgo.TargetPlayer != null) { Entity targetPlayer = (Entity)csgo.TargetPlayer.Clone(); drawColor = targetPlayer.InTeam == Data.Team.CounterTerrorists ? colorCT : colorT; DrawText(device, foreColor, backColor, screenW + 2f, screenH + 2f, 100f, 20f, 1f, 1f, targetPlayer.Name, FactoryManager.GetFont("smallSegoe")); DrawText(device, foreColor, backColor, screenW + 2f, screenH - 20f, 100f, 20f, 1f, 1f, targetPlayer.Health.ToString() + "HP", FactoryManager.GetFont("smallSegoe")); } if (csgo.AccuracyPenality > 0.0f) { inaccuracy = csgo.AccuracyPenality / 0.002f; DrawEllipse(device, drawColor * 0.25f, screenW, screenH, 4f * inaccuracy, 4f * inaccuracy, true ); } //Left DrawLine(device, drawColor, screenW - xhairWidth / 2f, screenH, screenW + xhairWidth / 2f, screenH, 1f); //Top DrawLine(device, drawColor, screenW, screenH - xhairWidth / 2f, screenW, screenH + xhairWidth / 2f, 1f); if (inaccuracy > 0f) { float bar = xhairWidth / 16f * inaccuracy * 0.50f; if (bar > xhairWidth / 2f) { bar = xhairWidth / 2f; } //Left DrawLine(device, drawColor, screenW - 2f * inaccuracy, screenH - bar / 2f, screenW - 2f * inaccuracy, screenH + bar / 2f, 2f); //Right DrawLine(device, drawColor, screenW + 2f * inaccuracy, screenH - bar / 2f, screenW + 2f * inaccuracy, screenH + bar / 2f, 2f); //Up DrawLine(device, drawColor, screenW - bar / 2f, screenH - 2f * inaccuracy, screenW + bar / 2f, screenH - 2f * inaccuracy, 2f); //Down DrawLine(device, drawColor, screenW - bar / 2f, screenH + 2f * inaccuracy, screenW + bar / 2f, screenH + 2f * inaccuracy, 2f); } } #endregion #region spotted if (currentPlayer != null) { if (currentPlayer.IsSpotted) { DrawEllipse(device, colorT * (0.5f + 0.5f * multiplier), screenW, screenH, xhairWidth, xhairWidth, true, 3f); } } #endregion }
protected override void OnDraw(SharpDX.Direct2D1.WindowRenderTarget device) { csgo = (CSGOImplementation)Program.GameImplementation; //Draw background FillRectangle(device, CSGOTheme.BackColor, X, Y, Width, Height); if (csgo.SignOnState < SignOnState.SIGNONSTATE_NEW || csgo.SignOnState > SignOnState.SIGNONSTATE_FULL) { DrawText(device, this.Theme.ForeColor * (0.75f + 0.25f * GetColorMultiplier()), this.X + this.Width / 2f - 50f, this.Y + this.Height / 2f + 8f, 200, 20, "Not connected", this.Font); return; } Player currentPlayer = csgo.GetCurrentPlayer(); if (csgo.Players == null) { return; } //Check validity if (csgo.Players == null) { return; } if (csgo.Players.Length == 0) { return; } if (currentPlayer == null) { return; } if (csgo.GetValue <YesNo>("radarEnabled") == YesNo.No) { return; } resolution = csgo.GetValue <float>("radarZoom"); Vector2 screenMid = new Vector2(X + Width / 2f, Y + Height / 2f); float scale = 2f / resolution; #region SoundESP if (csgo.GetValue <YesNo>("soundEspEnabled") == YesNo.Yes) { //float maxSpan = csgo.GetValue<float>("soundEspInterval"); float maxRange = csgo.GetValue <float>("soundEspRange"); maxRange /= 0.01905f; if ((maxRange * scale * 2f) <= this.Width) { DrawEllipse(device, CSGOTheme.Line, screenMid.X, screenMid.Y, maxRange * scale * 2f, maxRange * scale * 2f, true, 1f); } SoundESP sEsp = ((CSGOGameController)Program.GameController).SoundESP; if (((maxRange * scale * 2f) / 100f * sEsp.LastPercent) <= this.Width) { DrawEllipse(device, CSGOTheme.Line, screenMid.X, screenMid.Y, (maxRange * scale * 2f) / 100f * sEsp.LastPercent, (maxRange * scale * 2f) / 100f * sEsp.LastPercent, true, 1f); } } #endregion //Draw other players try { foreach (Player player in csgo.Players) { if (player != null) { DrawPlayer(device, currentPlayer, player, screenMid, scale); } } } catch { } //foreach (Entity entity in csgo.Entities) //{ // DrawEntity(device, currentPlayer, entity, screenMid, scale); //} //Draw "view" DrawText(device, CSGOTheme.ForeColor, X + 4, Y + 4, 100, 20, "Zoom: x" + Math.Round(1 / resolution, 2), FactoryManager.GetFont("smallSegoe")); FillPolygon(device, CSGOTheme.ViewColor, screenMid.X, screenMid.Y, screenMid.X - viewX * scale, screenMid.Y - viewY * scale, screenMid.X + viewX * scale, screenMid.Y - viewY * scale); DrawPolygon(device, CSGOTheme.ViewColorOutline, screenMid.X, screenMid.Y, screenMid.X - viewX * scale, screenMid.Y - viewY * scale, screenMid.X + viewX * scale, screenMid.Y - viewY * scale); //Draw player FillEllipse(device, currentPlayer.InTeam == Team.CounterTerrorists ? CSGOTheme.TeamCT : CSGOTheme.TeamT, screenMid.X, screenMid.Y, dotSize * scale, dotSize * scale, true); }
protected abstract void DrawPlayer(SharpDX.Direct2D1.WindowRenderTarget device, Player player, int index, int numPlayers);