Пример #1
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();
        }
Пример #2
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);

            overlay.OnWindowBoundsChanged += Overlay_OnWindowBoundsChanged;

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

            gfx = new Direct2DRenderer(rendererOptions);

            font            = gfx.CreateFont("Arial", 22);
            brush           = gfx.CreateBrush(255, 0, 0, 255);
            backgroundBrush = gfx.CreateBrush(0xCC, 0xCC, 0xCC, 80);

            FrameTimer timer = new FrameTimer(60);

            timer.OnFrameStart += Timer_OnFrameStart;

            timer.Start();

            Console.ReadLine();

            timer.Stop();

            gfx.Dispose();
            overlay.Dispose();
        }