protected virtual void OnInitialize(InitializeDirectXEventArgs e) { var handler = Initialize; if (handler != null) { handler(this, e); } }
protected override void OnInitialize(InitializeDirectXEventArgs e) { IDirect2DProvider direct2D = e.DirectX.Direct2D; BitmapProperties1 bitmapProperties = new BitmapProperties1() { DpiX = e.Settings.Dpi, DpiY = e.Settings.Dpi, PixelFormat = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.B8G8R8A8_UNorm, SharpDX.Direct2D1.AlphaMode.Premultiplied), BitmapOptions = BitmapOptions.Target, }; uiSurface = ToDispose(new Bitmap1(direct2D.Context, new Size2(e.Settings.ScreenWidth, e.Settings.ScreenHeight), bitmapProperties)); Overlay = ToDispose(Overlay.FromDescription( new OverlayDescription(width: e.Settings.ScreenWidth, height: e.Settings.ScreenHeight))); Overlay.BeginDesign(); Panel panel = new Panel() { Position = new SharpDX.Vector2(512, 192), Width = 320, Height = 92 }; Label label = new Label() { Position = new SharpDX.Vector2(8, 8), Text = "stereo" }; panel.Add(label); Overlay.Add(panel); Overlay.EndDesign(e.DirectX); effectGraph = CreateEffectGraph(direct2D); direct2D.Context.TextAntialiasMode = SharpDX.Direct2D1.TextAntialiasMode.Grayscale; }