public void OneResize() { CreateDrawer(); const int width = 1000; const int height = 700; DirectXFormDrawer drawer1 = _drawers[0]; SetFormSize(drawer1, width, height); CheckSwapChainSize(drawer1, width, height); const double aspectRatio = width / (double)height; CheckEqual(aspectRatio, drawer1.AspectRatio); CheckEqual(aspectRatio, drawer1._camera.AspectRatio); }
public void StaticSize() { CreateDrawer(); DirectXFormDrawer drawer = _drawers[0]; var form = _forms[0]; int width = form.ClientSize.Width; int height = form.ClientSize.Height; CheckSwapChainSize(drawer, width, height); double aspectRatio = width / (double)height; CheckEqual(aspectRatio, drawer.AspectRatio); CheckEqual(aspectRatio, drawer._camera.AspectRatio); }
public void ResizeTwice() { CreateDrawer(); int width = 1000; int height = 700; SetFormSize(_drawers[0], width, height); CheckSwapChainSize(_drawers[0], width, height); double aspectRatio = width / (double)height; DirectXFormDrawer drawer1 = _drawers[0]; CheckEqual(aspectRatio, drawer1.AspectRatio); CheckEqual(aspectRatio, drawer1._camera.AspectRatio); width = 120; height = 70; SetFormSize(_drawers[0], width, height); CheckSwapChainSize(_drawers[0], width, height); CheckDeviceSize(_drawers[0], width, height); aspectRatio = width / (double)height; CheckEqual(aspectRatio, drawer1.AspectRatio); CheckEqual(aspectRatio, drawer1._camera.AspectRatio); }
// ReSharper restore UnusedParameter.Local private void SetFormSize(DirectXFormDrawer drawer, int width, int height) { _forms[_drawers.IndexOf(drawer)].EasyInvoke(x => x.ClientSize = new Size(width, height)); }
private static void CheckSwapChainSize(DirectXFormDrawer drawer, int width, int height) { Assert.AreEqual(width, drawer._swapChain.PresentParameters.BackBufferWidth); Assert.AreEqual(height, drawer._swapChain.PresentParameters.BackBufferHeight); }
private static void CheckDeviceSize(DirectXFormDrawer drawer, int width, int height) { Assert.AreEqual(width, drawer._deviceWorker.DeviceSize.Width); Assert.AreEqual(height, drawer._deviceWorker.DeviceSize.Height); }