예제 #1
0
        public DeviceContextWpf(DeviceSettings settings)
        {
            Contract.Requires(settings != null);

            Settings = settings;
            LogEvent.Engine.Log(settings.ToString());

            eventHandlerList = new EventHandlerList();

            LogEvent.Engine.Log(Resources.INFO_OE_DeviceCreating);
            //SwapChainDescription swapChainDesc = new SwapChainDescription
            //                                         {
            //                                             BufferCount = 1,
            //                                             ModeDescription =
            //                                                 new ModeDescription(Settings.ScreenWidth, Settings.ScreenHeight,
            //                                                                     new Rational(120, 1), Settings.Format),
            //                                             IsWindowed = true,
            //                                             OutputHandle =(new System.Windows.Interop.WindowInteropHelper(Global.Window)).Handle,
            //                                             SampleDescription = Settings.SampleDescription,
            //                                             SwapEffect = SwapEffect.Discard,
            //                                             Usage = Usage.RenderTargetOutput,
            //                                         };

            //LogEvent.Engine.Log(Resources.INFO_OE_DeviceCreating);
            //Device.CreateWithSwapChain(DriverType.Hardware, Settings.CreationFlags, swapChainDesc, out device, out swapChain);
            device = new Device(DriverType.Hardware, Settings.CreationFlags, FeatureLevel.Level_11_0);

            //if (!Settings.IsWindowed)

            immediate = device.ImmediateContext;

            CreateTargets();
            LogEvent.Engine.Log(Resources.INFO_OE_DeviceCreated);
            device.ImmediateContext.Flush();
        }
예제 #2
0
        public DeviceContext11(IntPtr handle, DeviceSettings settings)
        {
            Contract.Requires(handle != IntPtr.Zero);
            Contract.Requires(settings != null);

            Settings = settings;
            LogEvent.Engine.Log(settings.ToString());

            eventHandlerList = new EventHandlerList();
            SwapChainDescription swapChainDesc = new SwapChainDescription
                                                     {
                                                         BufferCount = 1,
                                                         IsWindowed = Settings.IsWindowed,
                                                         ModeDescription =
                                                             new ModeDescription{
                                                                 Width = Settings.ScreenWidth,
                                                                 Height = Settings.ScreenHeight,
                                                                 RefreshRate= new Rational(0, 1),
                                                                 Format = Settings.Format,
                                                                 Scaling = DisplayModeScaling.Unspecified,
                                                                 ScanlineOrdering = DisplayModeScanlineOrdering.Unspecified,
                                                             },

                                                         //new Rational(120, 1), Settings.Format),
                                                         OutputHandle = handle,
                                                         SampleDescription = Settings.SampleDescription,
                                                         Flags = SwapChainFlags.AllowModeSwitch,
                                                         SwapEffect = SwapEffect.Discard,
                                                         Usage = Usage.RenderTargetOutput,
                                                     };

            FeatureLevel[] featureLevels = new FeatureLevel[] { FeatureLevel.Level_11_0, FeatureLevel.Level_10_1, FeatureLevel.Level_10_0 };
            LogEvent.Engine.Log(Resources.INFO_OE_DeviceCreating);
            Device.CreateWithSwapChain(DriverType.Hardware, Settings.CreationFlags, featureLevels, swapChainDesc, out device, out swapChain);

            factory = swapChain.GetParent<Factory>();
            factory.SetWindowAssociation(handle, WindowAssociationFlags.IgnoreAltEnter | WindowAssociationFlags.IgnoreAll);

            immediate = device.ImmediateContext;

            CreateTargets();
            LogEvent.Engine.Log(Resources.INFO_OE_DeviceCreated);
        }
예제 #3
0
 public D3DImageSlimDX(DeviceSettings settings)
 {
     this.settings = settings;
     InitD3D9();
     NumActiveImages++;
 }
예제 #4
0
파일: Main.cs 프로젝트: yong-ja/starodyssey
        void InitDX11()
        {
            DeviceSettings settings = new DeviceSettings
                                          {
                                              AdapterOrdinal = 0,
                                              CreationFlags = DeviceCreationFlags.Debug,
                                              ScreenWidth = 1024,
                                              ScreenHeight = 768,
                                              SampleDescription = new SampleDescription(1,0)
                                          };

            DeviceContext11 deviceContext11 = new DeviceContext11(renderPanel.Handle, settings);

            Game.Context = deviceContext11;
            Game.HookEvents();

            UIRenderer = new UIRenderer(deviceContext11);
            Game.ChangeRenderer(UIRenderer);
            OdysseyUI.SetupHooks(renderPanel);

            Toolbox.MainForm = this;
        }
예제 #5
0
파일: Game.cs 프로젝트: yong-ja/starodyssey
        public static void InitWPF()
        {
            ResourceManager.PerformIntegrityCheck();
            ResourceManager.LoadDefaultStyles();

            LogEvent.Engine.Log(Resources.INFO_OE_Starting);

            DeviceSettings deviceSettings = new DeviceSettings
                                          {
                                              AdapterOrdinal = 0,
                                              CreationFlags = DeviceCreationFlags.BgraSupport,
                                              ScreenWidth = 1920,
                                              ScreenHeight = 1080,
                                              SampleDescription = new SampleDescription(1,0),
                                              Format = Format.R8G8B8A8_UNorm,
                                          };

            Context = new DeviceContextWpf(deviceSettings);

            LogEvent.Engine.Log(Resources.INFO_OE_Started);
        }
예제 #6
0
파일: Game.cs 프로젝트: yong-ja/starodyssey
        /// <summary>
        /// Init method for Windows.Forms applications
        /// </summary>
        public static void Init()
        {
            Global.ExecutingDir = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            ResourceManager.PerformIntegrityCheck();
            ResourceManager.LoadDefaultStyles();

            LogEvent.Engine.Log(Resources.INFO_OE_Starting);

            DeviceSettings deviceSettings = new DeviceSettings
                                          {
                                              AdapterOrdinal = 0,
                                              CreationFlags = DeviceCreationFlags.Debug,
                                              ScreenWidth = 1920,
                                              ScreenHeight = 1080,
                                              SampleDescription = new SampleDescription(1,0),
                                              Format = Format.R8G8B8A8_UNorm,
                                              IsStereo = false,
                                              IsWindowed = true
                                          };

            RenderForm form = new RenderForm
                                  {
                                      ClientSize = new Size(deviceSettings.ScreenWidth, deviceSettings.ScreenHeight),
                                      WindowState = FormWindowState.Maximized,
                                      Text = "Odyssey11 Demo" ,
                                  };

            form.Activated += delegate { IsInputEnabled = true; };
            Global.Form = form;
            Context = new DeviceContext11(form.Handle, deviceSettings);
            OdysseyUI.SetupHooks(form);
            HookEvents();

            LogEvent.Engine.Log(Resources.INFO_OE_Started);
            Logger.Init();
        }