Esempio n. 1
0
        public void Dispose()
        {
            _hWnd = IntPtr.Zero;

            if (D2DDeviceContext != null)
            {
                D2DDeviceContext.Dispose();
                D2DDeviceContext = null;
            }

            if (D2DDevice != null)
            {
                D2DDevice.Dispose();
                D2DDevice = null;
            }

            if (SwapChain != null)
            {
                SwapChain.Dispose();
                SwapChain = null;
            }
            if (Context != null)
            {
                Context.Dispose();
                Context = null;
            }
            if (Device != null)
            {
                Device.Dispose();
                Device = null;
            }
        }
Esempio n. 2
0
        public void Dispose()
        {
            _hWnd = IntPtr.Zero;

            if (D2DDeviceContext != null)
            {
                D2DDeviceContext.Dispose();
                D2DDeviceContext = null;
            }

            if (D2DDevice != null)
            {
                D2DDevice.Dispose();
                D2DDevice = null;
            }

            if (DXGIDevice != null)
            {
                DXGIDevice.Dispose();
                DXGIDevice = null;
            }

            if (Context != null)
            {
                Context.Dispose();
                Context = null;
            }
            if (Device != null)
            {
                Device.Dispose();
                Device = null;
            }
        }
Esempio n. 3
0
        public void DestroyInstance()
        {
            _frameTimer.Stop();

            _frameTimer.Dispose();
            _device.Dispose();
            _window.Dispose();
            _device     = null;
            _frameTimer = null;
        }
Esempio n. 4
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();
        }
Esempio n. 5
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;
        }
Esempio n. 6
0
        public void Dispose()
        {
            foreach (KeyValuePair <string, D2D1.Brush> p in Brushes)
            {
                p.Value.Dispose();
            }
            DashStyle.Dispose();

            D2DTarget.Dispose();
            D2DDevice.Dispose();
            D2DContext.Dispose();
            D2DFactory.Dispose();

            BlackTextureView.Dispose();
            WhiteTextureView.Dispose();
            AnisotropicSampler.Dispose();

            blendStateOpaque.Dispose();
            blendStateTransparent.Dispose();

            rasterizerStateSolidCullBack.Dispose();
            rasterizerStateWireframeCullBack.Dispose();
            rasterizerStateSolidNoCull.Dispose();
            rasterizerStateWireframeNoCull.Dispose();
            depthStencilStateDefault.Dispose();
            depthStencilStateNoDepth.Dispose();

            foreach (Camera c in Cameras)
            {
                c.Dispose();
            }
            constantBuffer.Dispose();

            swapChain.Dispose();
            Device.Dispose();
            Context.Dispose();
        }