Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows.Forms;
- using SlimDX.Direct3D11;
- using SlimDX.Windows;
- using SlimDX;
- namespace IRawrC
- {
- static class IRawrC
- {
- public static RenderForm MainWindow;
- public static void RenderFrame(SlimDX.DXGI.SwapChain chain)
- {
- chain.Present(1, SlimDX.DXGI.PresentFlags.None);
- }
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main()
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- MainWindow = new RenderForm("IRawrC");
- SlimDX.DXGI.SwapChainDescription desc = new SlimDX.DXGI.SwapChainDescription()
- {
- BufferCount = 2,
- Usage = SlimDX.DXGI.Usage.RenderTargetOutput,
- OutputHandle = MainWindow.Handle,
- IsWindowed = true,
- ModeDescription = new SlimDX.DXGI.ModeDescription(0, 0, new SlimDX.Rational(60, 1), SlimDX.DXGI.Format.B8G8R8A8_UNorm),
- SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0),
- Flags = SlimDX.DXGI.SwapChainFlags.AllowModeSwitch,
- SwapEffect = SlimDX.DXGI.SwapEffect.Discard
- };
- Device device = null;
- SlimDX.DXGI.SwapChain chain = null;
- SlimDX.Result res = Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.Debug, desc, out device, out chain);
- if (res.IsFailure)
- {
- throw new SlimDX.CompilationException();
- }
- MessagePump.Run(MainWindow, () =>
- {
- RenderFrame(chain);
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement