private Vector2 W2S(ExternalUtilsCSharp.MathObjects.Vector3 point) { ExternalUtilsCSharp.MathObjects.Matrix vMatrix = WithOverlay.Framework.ViewMatrix; ExternalUtilsCSharp.MathObjects.Vector2 screenSize = new ExternalUtilsCSharp.MathObjects.Vector2(WithOverlay.SHDXOverlay.Width, WithOverlay.SHDXOverlay.Height); return(SharpDXConverter.Vector2EUCtoSDX(MathUtils.WorldToScreen(vMatrix, screenSize, point))); }
protected void DrawLine(SharpDXRenderer renderer, Vector2 center, float distance, float length, float angle, float width, bool outline) { ExternalUtilsCSharp.MathObjects.Vector2 vecCenter = SharpDXConverter.Vector2SDXtoEUC(center); ExternalUtilsCSharp.MathObjects.Vector2 vecRotateA = new MathObjects.Vector2(vecCenter.X + distance, vecCenter.Y); ExternalUtilsCSharp.MathObjects.Vector2 vecRotateB = new MathObjects.Vector2(vecCenter.X + distance + length, vecCenter.Y); vecRotateA = ExternalUtilsCSharp.MathUtils.RotatePoint(vecRotateA, vecCenter, angle); vecRotateB = ExternalUtilsCSharp.MathUtils.RotatePoint(vecRotateB, vecCenter, angle); Vector2 _vecRotateA = SharpDXConverter.Vector2EUCtoSDX(vecRotateA); Vector2 _vecRotateB = SharpDXConverter.Vector2EUCtoSDX(vecRotateB); if (outline) { renderer.DrawLine(this.SecondaryColor, _vecRotateA, _vecRotateB, width + 2f); } renderer.DrawLine(this.PrimaryColor, _vecRotateA, _vecRotateB, width); }
private static void overlay_TickEvent(object sender, SharpDXOverlay.DeltaEventArgs e) { keys.Update(); pnlPanel.Y = overlay.Location.Y + overlay.Height / 2f - pnlPanel.Height; if (keys.KeyWentUp(WinAPI.VirtualKeyShort.INSERT)) chbAutoClicker.Checked = !chbAutoClicker.Checked; if (keys.KeyWentUp(WinAPI.VirtualKeyShort.DELETE)) chbMoveMouse.Checked = !chbMoveMouse.Checked; overlay.UpdateControls(e.SecondsElapsed, keys); if (keys.KeyIsDown(WinAPI.VirtualKeyShort.END)) e.Overlay.Close(); #region AutoClicker if (chbAutoClicker.Checked) { //Click-area ExternalUtilsCSharp.MathObjects.Vector2 areaSize = new ExternalUtilsCSharp.MathObjects.Vector2(clkWindow.GetSize().X, clkWindow.GetSize().Y); ExternalUtilsCSharp.MathObjects.Vector2 location = new ExternalUtilsCSharp.MathObjects.Vector2(clkWindow.GetAbsoluteLocation().X, clkWindow.GetAbsoluteLocation().Y); ExternalUtilsCSharp.MathObjects.Vector2 areaCenter = location + areaSize * 0.5f; bool sec = DateTime.Now.Second % 2 == 0; ExternalUtilsCSharp.MathObjects.Vector2 areaTop = new ExternalUtilsCSharp.MathObjects.Vector2(areaCenter.X, areaCenter.Y - areaSize.Y / (sec ? 2f : 4f)); ExternalUtilsCSharp.MathObjects.Vector2 clickPoint = areaCenter; if (chbMoveMouse.Checked) { clickPoint = MathUtils.RotatePoint(areaTop, areaCenter, DateTime.Now.Millisecond % 360); WinAPI.SetCursorPos((int)(overlay.Location.X + clickPoint.X), (int)(overlay.Location.Y + clickPoint.Y)); } int lParam = WinAPI.MakeLParam((int)clickPoint.X, (int)clickPoint.Y); lastClickerPos.X = clickPoint.X; lastClickerPos.Y = clickPoint.Y; Message(hWnd, (uint)WinAPI.WindowMessage.WM_LBUTTONDOWN, 0, lParam); Message(hWnd, (uint)WinAPI.WindowMessage.WM_LBUTTONUP, 0, lParam); } #endregion lblFpsLogic.Text = string.Format("FPS logic: {0}", overlay.LogicUpdater.LastFrameRate.ToString()); lblFpsDraw.Text = string.Format("FPS draw: {0}", overlay.DrawUpdater.LastFrameRate.ToString()); pgbFpsLogic.Value = overlay.LogicUpdater.LastFrameRate; pgbFpsDraw.Value = overlay.DrawUpdater.LastFrameRate; lblFpsDrawAverage.Text = string.Format("Average FPS: {0} ({1} ticks in {2}s)", overlay.DrawUpdater.GetAverageFPS(), MiscUtils.GetUnitFromNumber(overlay.DrawUpdater.TickCount, true), ((int)overlay.DrawUpdater.GetRuntime().TotalSeconds).ToString()); lblFpsLogicAverage.Text = string.Format("Average FPS: {0} ({1} ticks in {2}s)", overlay.LogicUpdater.GetAverageFPS(), MiscUtils.GetUnitFromNumber(overlay.LogicUpdater.TickCount, true), ((int)overlay.LogicUpdater.GetRuntime().TotalSeconds).ToString()); }
private static void overlay_TickEvent(object sender, SharpDXOverlay.DeltaEventArgs e) { keys.Update(); overlay.UpdateControls(e.SecondsElapsed, keys); segments.Width = overlay.Width; segments.Height = overlay.Height; if (keys.KeyIsDown(WinAPI.VirtualKeyShort.INSERT)) e.Overlay.Close(); #region AutoClicker if (chbAutoClicker.Checked) { //Click-area ExternalUtilsCSharp.MathObjects.Vector2 areaSize = new ExternalUtilsCSharp.MathObjects.Vector2(overlay.Width / 2f * 0.6f, overlay.Width * 0.15f); ExternalUtilsCSharp.MathObjects.Vector2 location = new ExternalUtilsCSharp.MathObjects.Vector2(overlay.Width / 2f + overlay.Width / 4f, overlay.Width / 2f * 0.7f); ExternalUtilsCSharp.MathObjects.Vector2 areaCenter = location + areaSize * 0.5f; bool sec = DateTime.Now.Second % 2 == 0; ExternalUtilsCSharp.MathObjects.Vector2 areaTop = new ExternalUtilsCSharp.MathObjects.Vector2(areaCenter.X, areaCenter.Y - areaSize.Y / (sec ? 2f : 4f)); ExternalUtilsCSharp.MathObjects.Vector2 clickPoint = MathUtils.RotatePoint(areaTop, areaCenter, DateTime.Now.Millisecond % 360) - areaSize * 0.5f; int lParam = WinAPI.MakeLParam((int)clickPoint.X, (int)clickPoint.Y); lastClickerPos.X = clickPoint.X; lastClickerPos.Y = clickPoint.Y; Message(proc.Process.MainWindowHandle, (uint)WinAPI.WindowMessage.WM_LBUTTONDOWN, 0, lParam); Message(proc.Process.MainWindowHandle, (uint)WinAPI.WindowMessage.WM_LBUTTONUP, 0, lParam); } #endregion #region Cast spells if (chbAutoSpells.Checked && overlay.LogicUpdater.TickCount % 10 == 0) { for (uint i = 0; i < 10; i++) { uint key = (uint)WinAPI.VirtualKeyShort.KEY_0 + i; uint scanCode = WinAPI.MapVirtualKey(key, 0); uint lParam = lParam = (0x00000001 | (scanCode << 16)); Message(proc.Process.MainWindowHandle, (uint)WinAPI.WindowMessage.WM_KEYDOWN, (int)key, (int)lParam); Message(proc.Process.MainWindowHandle, (uint)WinAPI.WindowMessage.WM_KEYUP, (int)key, (int)lParam); } } #endregion lblFpsLogic.Text = string.Format("FPS logic: {0}", overlay.LogicUpdater.LastFrameRate.ToString()); lblFpsDraw.Text = string.Format("FPS draw: {0}", overlay.DrawUpdater.LastFrameRate.ToString()); pgbFpsLogic.Value = overlay.LogicUpdater.LastFrameRate; pgbFpsDraw.Value = overlay.DrawUpdater.LastFrameRate; lblFpsDrawAverage.Text = string.Format("Average FPS: {0} ({1} ticks in {2}s)", overlay.DrawUpdater.GetAverageFPS(), MiscUtils.GetUnitFromNumber(overlay.DrawUpdater.TickCount, true), ((int)overlay.DrawUpdater.GetRuntime().TotalSeconds).ToString()); lblFpsLogicAverage.Text = string.Format("Average FPS: {0} ({1} ticks in {2}s)", overlay.LogicUpdater.GetAverageFPS(), MiscUtils.GetUnitFromNumber(overlay.LogicUpdater.TickCount, true), ((int)overlay.LogicUpdater.GetRuntime().TotalSeconds).ToString()); }
private Vector2[] W2S(ExternalUtilsCSharp.MathObjects.Vector3[] points) { ExternalUtilsCSharp.MathObjects.Matrix vMatrix = WithOverlay.Framework.ViewMatrix; ExternalUtilsCSharp.MathObjects.Vector2 screenSize = new ExternalUtilsCSharp.MathObjects.Vector2(WithOverlay.SHDXOverlay.Width, WithOverlay.SHDXOverlay.Height); ExternalUtilsCSharp.MathObjects.Vector3 origin = Player.m_vecOrigin; return SharpDXConverter.Vector2EUCtoSDX(MathUtils.WorldToScreen(vMatrix, screenSize, points)); }