Exemple #1
0
        private void _frameTimer_OnFrameStarting(FrameTimer timer, D2DDevice device)
        {
            if (!_initializeGraphicObjects)
            {
                return;
            }

            if (!device.IsInitialized)
            {
                return;
            }
            if (device.IsDrawing)
            {
                return;
            }

            // colors automatically normalize values to fit. you can use 1.0f but also 255.0f.
            _blackBrush  = device.CreateSolidColorBrush(0x0, 0x0, 0x0, 0xFF);
            _redBrush    = device.CreateSolidColorBrush(0xFF, 0x0, 0x0, 0xFF);
            _greenBrush  = device.CreateSolidColorBrush(0x0, 0xFF, 0x0, 0xFF);
            _blueBrush   = device.CreateSolidColorBrush(0x0, 0x0, 0xFF, 0xFF);
            _yellowBrush = device.CreateSolidColorBrush(0xFF, 0xFF, 0x0, 0xFF);
            _gradient    = new D2DLinearGradientBrush(device, new D2DColor(0, 0, 80), new D2DColor(0x88, 0, 125), new D2DColor(0, 0, 225));

            _initializeGraphicObjects = false;
        }
Exemple #2
0
        static void Main(string[] args)
        {
            _window = new OverlayWindow(new OverlayOptions()
            {
                BypassTopmost = false,
                Height        = 600,
                Width         = 800,
                WindowTitle   = "GameOverlayExample",
                X             = 0,
                Y             = 0
            });

            _device = new D2DDevice(new DeviceOptions()
            {
                AntiAliasing  = true,
                Hwnd          = _window.WindowHandle,
                MeasureFps    = true,
                MultiThreaded = false,
                VSync         = false
            });

            _image = _device.LoadImage(@"C:\Users\Michel\Desktop\NotificationBackOrange.png");

            _backgroundBrush = _device.CreateSolidColorBrush(0xF1, 0x9A, 0x4C, 255);

            _foregroundBrush = _device.CreateSolidColorBrush(0, 0, 0, 255);

            _font = _device.CreateFont(new FontOptions()
            {
                Bold           = false,
                FontFamilyName = "Arial",
                FontSize       = 14,
                Italic         = false,
                WordWrapping   = false
            });

            _notification = new OverlayNotification(_device, _backgroundBrush, _foregroundBrush, _font)
            {
                Body       = "You earned an achievement!",
                BodySize   = 14,
                Header     = "Achievement",
                HeaderSize = 18
            };

            _frameTimer = new FrameTimer(_device, 0);

            _window.OnWindowBoundsChanged += _window_OnWindowBoundsChanged;

            _frameTimer.OnFrame += _frameTimer_OnFrame;

            _frameTimer.Start();

            Console.WriteLine("Press enter to exit");

            Console.ReadLine();
        }
Exemple #3
0
        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);

            DeviceOptions rendererOptions = new DeviceOptions()
            {
                AntiAliasing = true,
                Hwnd         = overlay.WindowHandle,
                MeasureFps   = true,
                VSync        = false
            };

            gfx = new D2DDevice(rendererOptions);

            font            = gfx.CreateFont("Arial", 22);
            red             = gfx.CreateSolidColorBrush(255, 0, 0, 255);
            black           = gfx.CreateSolidColorBrush(0, 0, 0, 255);
            green           = gfx.CreateSolidColorBrush(0, 255.0f, 0, 255.0f);
            backgroundBrush = gfx.CreateSolidColorBrush(0xCC, 0xCC, 0xCC, 80);

            skeleton = CreateSkeleton(gfx);
            radar    = CreateRadarBackground(gfx, new Rectangle(100, 100, 400, 400), 10.0f);

            overlay.OnWindowBoundsChanged += Overlay_OnWindowBoundsChanged;

            FrameTimer timer = new FrameTimer(0, gfx);

            timer.FrameStarting += Timer_OnFrameStart;

            timer.Start();

            Console.ReadLine();

            timer.Stop();

            gfx.Dispose();
            overlay.Dispose();
        }
        public static void Main(string[] args)
        {
            IntPtr handle = /*new IntPtr(0x30F98);//*/ Process.GetCurrentProcess().MainWindowHandle;

            StickyOverlayWindow window = new StickyOverlayWindow(handle);

            window.OnWindowBoundsChanged += Window_OnWindowBoundsChanged;

            device = new D2DDevice(window.WindowHandle, false, true, true);

            D2DSolidColorBrush red   = device.CreateSolidColorBrush(255, 0, 0);
            D2DSolidColorBrush green = device.CreateSolidColorBrush(0, 255, 0);
            D2DSolidColorBrush blue  = device.CreateSolidColorBrush(0, 0, 255);
            D2DSolidColorBrush black = device.CreateSolidColorBrush(0, 0, 0);

            while (true)
            {
                //RECT windowRect = new RECT();
                //RECT clientRect = new RECT();
                RECT fixedRect = new RECT();

                //User32.GetWindowRect(handle, out windowRect);
                //User32.GetClientRect(handle, out clientRect);
                HelperMethods.GetWindowClientRect(handle, out fixedRect);

                //Console.WriteLine("WindowRect: " + windowRect.Output());
                //Console.WriteLine("ClientRect: " + clientRect.Output());
                //Console.WriteLine("FixedRect: " + fixedRect.Output());

                //Console.WriteLine();

                //Console.WriteLine("WindowRect: " + windowRect.ToBounds());
                //Console.WriteLine("ClientRect: " + clientRect.ToBounds());
                //Console.WriteLine("FixedRect: " + fixedRect.ToBounds());

                using (var scene = device.UseScene())
                {
                    //device.FillRectangle(0, 0, fixedRect.Right - fixedRect.Left, fixedRect.Bottom - fixedRect.Top, red);

                    //device.DrawRectangle(0, 0, windowRect.Right - windowRect.Left, windowRect.Bottom - windowRect.Top, 16.0f, red);
                    //device.DrawRectangle(0, 0, clientRect.Right - clientRect.Left, clientRect.Bottom - clientRect.Top, 12.0f, green);
                    //device.DrawRectangle(0, 0, fixedRect.Right - fixedRect.Left, fixedRect.Bottom - fixedRect.Top, 6.0f, blue);
                }


                Console.ReadLine();
            }
        }
        public static void Main(string[] args)
        {
            OverlayWindow window = new OverlayWindow(new OverlayCreationOptions()
            {
                BypassTopmost = false,
                Height        = 1080,
                Width         = 1920,
                WindowTitle   = "test",
                X             = 0,
                Y             = 0
            });

            while (!window.IsInitialized)
            {
            }

            D2DDevice device = new D2DDevice(new DeviceOptions()
            {
                AntiAliasing = true,
                Hwnd         = window.WindowHandle,
                MeasureFps   = false,
                VSync        = false
            });

            var red = device.CreateSolidColorBrush(1.0f, 0.0f, 0.0f);

            device.BeginScene();
            device.ClearScene();

            device.DrawLine(100, 100, 800, 800, 1.0f, red);

            device.EndScene();

            Console.ReadLine();
        }
        private void _frameTimer_OnFrameStarting(FrameTimer timer, D2DDevice device)
        {
            if (!_initializeGraphicObjects)
            {
                return;
            }

            if (!device.IsInitialized)
            {
                return;
            }
            if (device.IsDrawing)
            {
                return;
            }

            _backgroundColor = new D2DColor(0x24, 0x29, 0x2E, 0xFF);

            _font = _device.CreateFont(new FontOptions()
            {
                Bold           = false,
                FontFamilyName = "Arial",
                FontSize       = 16,
                Italic         = false,
                WordWrapping   = true
            });

            // colors automatically normalize values to fit. you can use 1.0f but also 255.0f.
            _blackBrush = device.CreateSolidColorBrush(0x0, 0x0, 0x0, 0xFF);

            _redBrush   = device.CreateSolidColorBrush(0xFF, 0x0, 0x0, 0xFF);
            _greenBrush = device.CreateSolidColorBrush(0x0, 0xFF, 0x0, 0xFF);
            _blueBrush  = device.CreateSolidColorBrush(0x0, 0x0, 0xFF, 0xFF);

            _gradient = new D2DLinearGradientBrush(device, new D2DColor(0, 0, 80), new D2DColor(0x88, 0, 125), new D2DColor(0, 0, 225));

            // loads an image from resource bytes (.png in this case)
            _image = device.LoadImage(Properties.Resources.placeholder_image_bytes);

            _initializeGraphicObjects = false;
        }
        private void _frameTimer_OnFrameStarting(FrameTimer timer, D2DDevice device)
        {
            if (!_initializeGraphicObjects)
            {
                return;
            }

            if (!device.IsInitialized)
            {
                return;
            }
            if (device.IsDrawing)
            {
                return;
            }

            _backgroundColor = new D2DColor(0, 0, 0, 0);

            _font = _device.CreateFont(new FontOptions()
            {
                Bold           = false,
                FontFamilyName = "Times New Roman",
                FontSize       = 10,
                Italic         = false,
                WordWrapping   = true
            });

            // colors automatically normalize values to fit. you can use 1.0f but also 255.0f.
            _blackBrush = device.CreateSolidColorBrush(0x0, 0x0, 0x0, 0xFF);

            _redBrush   = device.CreateSolidColorBrush(0xFF, 0x0, 0x0, 0xFF);
            _greenBrush = device.CreateSolidColorBrush(0x0, 0xFF, 0x0, 0xFF);
            _blueBrush  = device.CreateSolidColorBrush(0x0, 0x0, 0xFF, 0xFF);

            _initializeGraphicObjects = false;
        }
Exemple #8
0
        private void _frameTimer_OnFrame(FrameTimer timer, D2DDevice device)
        {
            #region non drawing things
            D2DSolidColorBrush GetDXColor(Color color)
            {
                return(device.CreateSolidColorBrush(color.R, color.G, color.B, color.A));
            }

            if (!device.IsDrawing)
            {
                _initializeGraphicObjects = true;
                return;
            }
            device.ClearScene();
            #endregion
            DrawTextWithBackground("ZBase", 0, 0, 16, Color.Blue, Color.DimGray);

            if (Main.S.ESP)
            {
                foreach (Entity Player in Globals.EntityList)
                {
                    if (Player.EntityBase != Globals.LocalPlayer.EntityBase)
                    {
                        Vector2 Player2DPos     = Tools.WorldToScreen(Player.Position);
                        Vector2 Player2DHeadPos = Tools.WorldToScreen(Player.HeadPosition);
                        Vector2 Player2DNeckPos = Tools.WorldToScreen(Player.GetBonePosition(7));
                        if (!Tools.IsNullVector2(Player2DPos) && !Tools.IsNullVector2(Player2DHeadPos) && Player.Valid)
                        {
                            float FromHeadToNeck = (Player2DNeckPos.Y - Player2DHeadPos.Y);
                            Player2DHeadPos.Y -= FromHeadToNeck * 2.3f;
                            Player2DPos.Y     += FromHeadToNeck;
                            float BoxHeight = Player2DPos.Y - Player2DHeadPos.Y;
                            float BoxWidth  = (BoxHeight / 2);
                            //wierd ass calculations for box height, dont judge
                            Color drawcolor;
                            if (Player.IsTeammate)
                            {
                                drawcolor = Color.Blue;
                            }
                            else
                            {
                                drawcolor = Color.Red;
                            }
                            DrawOutlineBox(Player2DPos.X - (BoxWidth / 2), Player2DHeadPos.Y, BoxWidth, BoxHeight, drawcolor);
                            DrawLine(Main.MidScreen.X, Main.MidScreen.Y + Main.MidScreen.Y, Player2DPos.X, Player2DPos.Y, drawcolor);
                        }
                    }
                }
            }

            #region drawing functions
            void DrawBoxEdge(float x, float y, float width, float height, Color color, float thiccness = 2.0f)
            {
                device.DrawRectangleEdges(Rectangle.Create(x, y, width, height), thiccness, GetDXColor(color));
            }

            void DrawText(string text, float x, float y, int size, Color color, bool bold = false, bool italic = false)
            {
                D2DFont f = _device.CreateFont(new FontOptions()
                {
                    Bold           = bold,
                    FontFamilyName = "Arial",
                    FontSize       = size,
                    Italic         = italic,
                    WordWrapping   = true
                });

                device.DrawText(text, new Point(x, y), f, GetDXColor(color));
            }

            void DrawTextWithBackground(string text, float x, float y, int size, Color color, Color backcolor, bool bold = false, bool italic = false)
            {
                D2DFont f = _device.CreateFont(new FontOptions()
                {
                    Bold           = bold,
                    FontFamilyName = "Arial",
                    FontSize       = size,
                    Italic         = italic,
                    WordWrapping   = true
                });

                device.DrawTextWithBackground(text, new Point(x, y), f, GetDXColor(color), GetDXColor(backcolor));
            }

            void DrawLine(float fromx, float fromy, float tox, float toy, Color color, float thiccness = 2.0f)
            {
                device.DrawLine(fromx, fromy, tox, toy, thiccness, GetDXColor(color));
            }

            void DrawFilledRectangle(float x, float y, float width, float height, Color color)
            {
                device.FillRectangle(Rectangle.Create(x, y, width, height), GetDXColor(color));
            }

            void DrawCircle(float x, float y, float radius, Color color)
            {
                device.DrawCircle(new Circle(x, y, radius), 1, GetDXColor(color));
            }

            void DrawCrosshair(CrosshairStyle style, float x, float y, float size, float stroke, Color color)
            {
                device.DrawCrosshair(style, new Point(x, y), size, stroke, GetDXColor(color));
            }

            void DrawBox(float x, float y, float width, float height, Color color, float thiccness = 2.0f)
            {
                device.DrawRectangle(Rectangle.Create(x, y, width, height), thiccness, GetDXColor(color));
            }

            void DrawOutlineBox(float x, float y, float width, float height, Color color, float thiccness = 2.0f)
            {
                device.OutlineRectangle(Rectangle.Create(x, y, width, height), thiccness, GetDXColor(color), GetDXColor(Color.Black));
            }

            void DrawRoundedBox(float x, float y, float width, float height, float radius, Color color, float thiccness = 2.0f)
            {
                device.DrawRoundedRectangle(RoundedRectangle.Create(x, y, width, height, radius), thiccness, GetDXColor(color));
            }

            #endregion
        }
        // public Vector2[] points = new Vector2[Constants.Llegbones.Length + Constants.Rlegbones.Length + Constants.Spinebones.Length + Constants.Larmbones.Length + Constants.Rarmbones.Length];


        private void _frameTimer_OnFrame(FrameTimer timer, D2DDevice device)
        {
            if (!device.IsDrawing)
            {
                _initializeGraphicObjects = true;
                return;
            }

            device.ClearScene(_backgroundColor);
            //device.DrawTextWithBackground("FPS: " + device.FramesPerSecond, 0, 0, _font, _redBrush, _blackBrush);
            //device.DrawTextWithBackground(text, 0, 20, _font, _redBrush, _blackBrush);
            if (OtherCheatsRealisation.IsWallHackEspEnabled())
            {
                ESPRectangle[] Rects = OtherCheatsRealisation.Rects;

                Vector3 tempVector3 = new Vector3(), tempVector3_2 = new Vector3();

                for (int i = 0; i < Rects.Length; i++)
                {
                    if (Rects[i].topPosX != 0 && Rects[i].topPosY != 0)
                    {
                        device.DrawCircle(Rects[i].topPosX, Rects[i].topPosY, 5 * (1000 / Rects[i].lenToPlayer), 3, Rects[i].IsEnemy ? _redBrush : _greenBrush);
                    }

                    if (Rects[i].downPosX != 0 && Rects[i].downPosY != 0)
                    {
                        float   cof = (200 / Rects[i].lenToPlayer);
                        float[] newPos;
                        newPos = Сentering(Rects[i].downPosX, Rects[i].downPosY, 100 * cof, 20 * cof, device, _blackBrush);
                        device.FillRectangle(newPos[0] + 1, newPos[1] + 1, newPos[0] + (Rects[i].hp * 100 - 1) * cof, newPos[1] + (20 - 1) * cof, device.CreateSolidColorBrush(1 - Rects[i].hp, Rects[i].hp, 0));
                    }
                    //device.DrawTextWithBackground(q, Rects[i].downPosX, Rects[i].downPosY, _font, 14, _blueBrush, _greenBrush);
                }
            }
            if (aimCheats.IsNoRecoilSaveEnabled())
            {
                device.FillCircle(aimCheats.RecoilCrossX, aimCheats.RecoilCrossY, 4, _redBrush);
            }
            if (aimCheats.IsAimEnabled())
            {
                device.DrawCircle(Constants.screenWidth / 2, Constants.screenHeight / 2, aimCheats.AIM_RADIUS, 2, _blueBrush);
            }
            //DrawTSkeleton(device);
            //DrawSkeletonT(device);
            //DrawCTSkeleton(device);
            // DrawTSkeleton(device);
            //DrawSkeletonT(device);
            // DrawSkeletonCT(device);

            /*for (int i = 0; i < points.Length; i++)
             *  device.DrawTextWithBackground(i.ToString(), points[i].X, points[i].Y, _font, _redBrush, _blackBrush);*/

            /*for (int i = 0; i+1 < bones_points.Length; i += 2)
             * {
             *  device.DrawLine(bones_points[i].X, bones_points[i].Y, bones_points[i+1].X, bones_points[i+1].Y, 1, _redBrush);
             * }*/
            //DrawText(device);
        }