public RenderContainer(SwapChainDescription swapChainDescription, RenderControl control) { try { _swapChainDescription = swapChainDescription; using (Factory1 factory = new Factory1()) using (Adapter adapter = factory.GetAdapter(0)) { Device11 = new Dx11ChainedDevice(adapter, _swapChainDescription); Device10 = new Dx10Device(adapter); } GraphicsDevice = new GenericGraphicsDevice(Device11.Device); SpriteBatch = new SpriteBatch(GraphicsDevice); Reset(control.Width, control.Height); control.Resize += OnRenderControlResize; } catch { Dispose(); throw; } }
public FMain(SharedData data) { InitializeComponent(); var wa = SystemInformation.WorkingArea; wa.Inflate(-wa.Width / 20, -wa.Height / 20); Bounds = wa; _data = data; _data.Size = new Size(ClientSize.Width - pnRenderControlPanel.Left, ClientSize.Height - pnRenderControlPanel.Top); _data.Size = new Size(_data.Size.Width/2, _data.Size.Height/2); _data.Storage = Storage.Load(); // create the RenderControl _renderControl = new RenderControl { Dock = DockStyle.Fill, Size = data.Size, Location = Point.Empty }; pnRenderControlPanel.Size = data.Size; pnRenderControlPanel.Controls.Add(_renderControl); optAllLines.CheckedChanged += (sender, args) => uiChanged(); optNoLines.CheckedChanged += (sender, args) => uiChanged(); numSurfaceSize.Value = _data.WaterSurfaceSize; numSurfaceScale.Value = _data.WaterSurfaceScale; foreach (var ctrl in Controls.OfType<Control>()) ctrl.Visible = false; }
public MazeEngine(RenderControl target) { _graphicsDeviceManager = new GraphicsDeviceManager(this) { PreferredBackBufferWidth = target.Width, PreferredBackBufferHeight = target.Height }; _target = target; }
public UiDxControl() { Control = new RenderControl(); SwapChainDescription swapChainDescription = CreateSwapChainDescription(); RenderContainer = new RenderContainer(swapChainDescription, Control); VerticalAlignment = VerticalAlignment.Stretch; HorizontalAlignment = HorizontalAlignment.Stretch; Child = Control; Control.Paint += OnRenderControlPaint; }
protected override void OnCreateControl() { base.OnCreateControl(); this.RenderControl = new RenderControl(); if (game != null) { game.BindWithWindow(RenderControl); } this.RenderControl.Dock = DockStyle.Fill; this.splitContainer1.Panel1.Controls.Add(RenderControl); }
public Form1(ShaderData data) { InitializeComponent(); _data = data; // create the RenderControl _renderControl = new RenderControl(); pnRenderControlPanel.Controls.Add(_renderControl); // initialize the controls state from initial data cbInvert.Checked = _data.EnableInvertColor; cbGrayscale.Checked = _data.EnableGrayscale; tbHeader.Text = _data.Header; tbSource.Text = _data.Source; }
private void SwitchToNewControlAt(Point location) { if(_currentRenderControl != null) { Controls.Remove(_currentRenderControl); _currentRenderControl = null; } _currentRenderControl = new RenderControl(); Controls.Add(_currentRenderControl); _currentRenderControl.Location = location; _currentRenderControl.MaximumSize = new Size(320, 240); _currentRenderControl.MinimumSize = new Size(320, 240); _currentRenderControl.Size = new Size(320, 240); if (_game.IsRunning) _game.Switch(_currentRenderControl); else _game.Run(_currentRenderControl); }
public RenderControl CreateControlHandle(int width, int height) { RenderControl handle = new RenderControl() { ClientSize = new Size(width, height), MinimumSize = new Size(0, 0) }; handle.MouseClick += (s, e) => { GameEventListener.RunClickEvent(handle, e); }; handle.KeyDown += (s, e) => { GameEventListener.RunKeyDownEvent(handle, e); }; handle.KeyUp += (s, e) => { GameEventListener.RunKeyUpEvent(handle, e); }; handle.Resize += (s, e) => { GameEventListener.RunResizeEvent(handle, new Size(handle.Width, handle.Height)); Device.Reset(new PresentParameters(ClientSize.Width, Math.Max(1, ClientSize.Height)) { MultiSampleType = MultisampleType.EightSamples }); GameEventListener.RunDeviceResetEvent(handle, Device); ConfigDX(); }; return handle; }