Ejemplo n.º 1
0
 public Graphics(RenderForm form, int width, int height)
 {
     reset = () => form.Invoke(new Action(() =>
     {
         device.Reset(presentParameters);
         fontRenderer.Flush();
         textureRenderer.Flush();
         resized = false;
     }));
     form.UserResized += (sender, args) => Resize(form.ClientSize.Width, form.ClientSize.Height);
     presentParameters = new PresentParameters
     {
         Windowed             = true,
         SwapEffect           = SwapEffect.Discard,
         BackBufferFormat     = Format.A8R8G8B8,
         BackBufferCount      = 1,
         BackBufferWidth      = width,
         BackBufferHeight     = height,
         PresentationInterval = PresentInterval.One,
         MultiSampleType      = MultisampleType.None,
         MultiSampleQuality   = 0,
         PresentFlags         = PresentFlags.LockableBackBuffer
     };
     direct3D        = new Direct3DEx();
     device          = new DeviceEx(direct3D, 0, DeviceType.Hardware, form.Handle, CREATE_FLAGS, presentParameters);
     fontRenderer    = new FontRenderer(device);
     textureRenderer = new TextureRenderer(device);
     renderLocker.Reset();
 }