Пример #1
0
        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();
        }
Пример #2
0
        public void DestroyInstance()
        {
            _frameTimer.Stop();

            //Begin and clear scene to stop last draw sticking on screen
            _device.BeginScene();
            _device.ClearScene();

            _frameTimer.Dispose();
            _device.Dispose();
            _window.Dispose();

            _window     = null;
            _device     = null;
            _frameTimer = null;
        }
Пример #3
0
        private static void Timer_OnFrameStart(FrameTimer timer, D2DDevice device)
        {
            device.BeginScene();
            device.ClearScene();

            device.DrawTextWithBackground(device.FPS.ToString(), new Point(10, 20), font, red, backgroundBrush);

            DrawRadarBackground(device, new Rectangle(100, 100, 400, 400), 10.0f);

            //for (int i = 0; i < 100; i++)
            //{
            //    DrawRadarBackground(device, new Rectangle(100, 100, 400, 400), 10.0f);
            //}

            device.EndScene();
        }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="D2DScene"/> class.
 /// </summary>
 /// <param name="device">The renderer.</param>
 public D2DScene(D2DDevice device)
 {
     Device = device ?? throw new ArgumentNullException(nameof(device));
     device.BeginScene();
 }