public Initialize ( |
||
outputHandle | ||
return | void |
public void Initialize(IntPtr outputHandle) {
Debug.Assert(Initialized == false);
if (UseMsaa) {
InitializeDevice().Dispose();
}
_swapChainDescription = new SwapChainDescription {
BufferCount = 2,
ModeDescription = new ModeDescription(0, 0, new Rational(60, 1), Format.R8G8B8A8_UNorm),
IsWindowed = true,
OutputHandle = outputHandle,
SampleDescription = SampleDescription,
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput
};
Device device;
Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.None, _swapChainDescription, out device, out _swapChain);
_deviceContextHolder = new DeviceContextHolder(device);
using (var factory = _swapChain.GetParent<Factory>()) {
factory.SetWindowAssociation(outputHandle, WindowAssociationFlags.IgnoreAll);
}
InitializeInner();
Initialized = true;
}
BaseRenderer::Initialize ( ) : void | |
BaseRenderer::Initialize ( DeviceContextHolder existingHolder ) : void |
public BaseFormWrapper(BaseRenderer renderer, string title, int width, int height) { _title = title; Form = new RenderForm(title) { Width = width, Height = height, StartPosition = FormStartPosition.CenterScreen }; Renderer = renderer; Renderer.Initialize(Form.Handle); Renderer.Width = Form.ClientSize.Width; Renderer.Height = Form.ClientSize.Height; Form.UserResized += OnResize; Form.KeyDown += OnKeyDown; Form.KeyUp += OnKeyUp; Form.GotFocus += OnGotFocus; Form.LostFocus += OnLostFocus; renderer.Tick += OnTick; }