Create() приватный метод

private Create ( string name, int width, int height, bool fullScreen, NamedParameterList miscParams ) : void
name string
width int
height int
fullScreen bool
miscParams NamedParameterList
Результат void
Пример #1
0
        public override RenderWindow CreateRenderWindow( string name, int width, int height, bool isFullScreen, NamedParameterList miscParams )
        {
            LogManager.Instance.Write("D3D9RenderSystem::createRenderWindow \"{0}\", {1}x{2} {3} ",
                                       name, width, height, isFullScreen ? "fullscreen" : "windowed");

            LogManager.Instance.Write( "miscParams: {0}",
                                       miscParams.Aggregate( new StringBuilder(),
                                                             ( s, kv ) =>
                                                             s.AppendFormat( "{0} = {1};", kv.Key, kv.Value ).AppendLine()
                                           ).ToString()
                );

            // Make sure we don't already have a render target of the
            // same name as the one supplied
            if (renderTargets.ContainsKey(name))
            {
                throw new Exception(String.Format("A render target of the same name '{0}' already exists." +
                                     "You cannot create a new window with this name.", name));
            }

            var window = new D3DRenderWindow(_activeD3DDriver, null);

            window.Create(name, width, height, isFullScreen, miscParams);

            _resourceManager.LockDeviceAccess();

            _deviceManager.LinkRenderWindow( window );

            _resourceManager.UnlockDeviceAccess();

            _renderWindows.Add( window );

            UpdateRenderSystemCapabilities( window );

            AttachRenderTarget( window );

            return window;
        }
        public override RenderWindow CreateRenderWindow(string name, int width, int height, bool isFullscreen, params object[] miscParams)
        {
            // Check we're not creating a secondary window when the primary
            // was fullscreen
            if (primaryWindow != null && primaryWindow.IsFullScreen) {
                throw new Exception("Cannot create secondary windows when the primary is full screen");
            } else if (primaryWindow != null && isFullscreen) {
                throw new Exception("Cannot create full screen secondary windows");
            }

            // Make sure we don't already have a render target of the
            // same name as the one supplied
            foreach (RenderTarget x in renderTargets) {
                if (x.Name == name)
                    throw new Exception("A render target of the same name '" + name +
                                        "' already exists.  You cannot create a new window with this name.");
            }

            RenderWindow win = new D3DRenderWindow(activeD3DDriver, primaryWindow != null);
            // create the window
            win.Create(name, width, height, isFullscreen, miscParams);
            // add the new render target
            AttachRenderTarget(win);

            // If this is the first window, get the D3D device and create the texture manager
            if (primaryWindow == null) {
                primaryWindow = (D3DRenderWindow)win;
                device = (Device)win.GetCustomAttribute("D3DDEVICE");

                // by creating our texture manager, singleton TextureManager will hold our implementation
                textureManager = new D3DTextureManager(device);

                // by creating our Gpu program manager, singleton GpuProgramManager will hold our implementation
                gpuProgramMgr = new D3DGpuProgramManager(device);

                // intializes the HardwareBufferManager singleton
                hardwareBufferManager = new D3DHardwareBufferManager(device);

                // Initialise the capabilities structures
                InitCapabilities();

                CreateAndApplyCache();
            } else {
                secondaryWindows.Add(win);
            }
            return win;
        }