Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5.  
  6. using SlimDX.Direct3D11;
  7. using SlimDX.Windows;
  8. using SlimDX;
  9.  
  10. namespace IRawrC
  11. {
  12.     static class IRawrC
  13.     {
  14.         public static RenderForm MainWindow;
  15.  
  16.         public static void RenderFrame(SlimDX.DXGI.SwapChain chain)
  17.         {
  18.  
  19.  
  20.  
  21.             chain.Present(1, SlimDX.DXGI.PresentFlags.None);
  22.         }
  23.  
  24.  
  25.  
  26.  
  27.         /// <summary>
  28.         /// The main entry point for the application.
  29.         /// </summary>
  30.  
  31.         [STAThread]
  32.         static void Main()
  33.         {
  34.             Application.EnableVisualStyles();
  35.             Application.SetCompatibleTextRenderingDefault(false);
  36.  
  37.             MainWindow = new RenderForm("IRawrC");
  38.  
  39.             SlimDX.DXGI.SwapChainDescription desc = new SlimDX.DXGI.SwapChainDescription()
  40.             {
  41.                 BufferCount = 2,
  42.                 Usage = SlimDX.DXGI.Usage.RenderTargetOutput,
  43.                 OutputHandle = MainWindow.Handle,
  44.                 IsWindowed = true,
  45.                 ModeDescription = new SlimDX.DXGI.ModeDescription(0, 0, new SlimDX.Rational(60, 1), SlimDX.DXGI.Format.B8G8R8A8_UNorm),
  46.                 SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0),
  47.                 Flags = SlimDX.DXGI.SwapChainFlags.AllowModeSwitch,
  48.                 SwapEffect = SlimDX.DXGI.SwapEffect.Discard
  49.             };
  50.  
  51.             Device device = null;
  52.             SlimDX.DXGI.SwapChain chain = null;
  53.  
  54.             SlimDX.Result res = Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.Debug, desc, out device, out chain);
  55.             if (res.IsFailure)
  56.             {
  57.                 throw new SlimDX.CompilationException();
  58.             }
  59.  
  60.  
  61.             MessagePump.Run(MainWindow, () =>
  62.             {
  63.                 RenderFrame(chain);
  64.             });
  65.         }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement