示例#1
0
        /// <summary>
        /// Change graphic information
        /// </summary>
        public void ChangeGraphics(GraphicsInfo info)
        {
            graphicsInfo = info;

            // Check all available adapters on the system.
            foreach (GraphicsAdapter adapter in GraphicsAdapter.Adapters)
            {
                // Get the capabilities of the hardware device.
                GraphicsDeviceCapabilities caps =
                    adapter.GetCapabilities(DeviceType.Hardware);

                if (caps.MaxPixelShaderProfile < info.pixelShaderProfile)
                {
                    // This adapter does not support Shader Model
                    throw new NotSupportedException(
                              "This adapter does not support Shader Model (" +
                              info.pixelShaderProfile.ToString() + ")");
                }
            }

            //  Initialize Graphics Device setting
            graphicsDeviceManager.PreferredBackBufferWidth =
                graphicsInfo.screenWidth;
            graphicsDeviceManager.PreferredBackBufferHeight =
                graphicsInfo.screenHeight;
            graphicsDeviceManager.MinimumVertexShaderProfile =
                graphicsInfo.vertexShaderProfile;
            graphicsDeviceManager.MinimumPixelShaderProfile =
                graphicsInfo.pixelShaderProfile;
            graphicsDeviceManager.PreferMultiSampling         = graphicsInfo.isMultiSampling;
            graphicsDeviceManager.PreferredDepthStencilFormat = SelectStencilMode();

            //  Apply preparing device setting
#if XBOX
            graphicsDeviceManager.IsFullScreen             = true;
            graphicsDeviceManager.PreparingDeviceSettings +=
                new EventHandler <PreparingDeviceSettingsEventArgs>
                    (graphics_PreparingDeviceSettings);
#else
            graphicsDeviceManager.IsFullScreen = false;
#endif

            graphicsDeviceManager.ApplyChanges();

            //  Set to new default viewport
            Viewer.DefaultViewport = GraphicsDevice.Viewport;

            OnSize();
        }
示例#2
0
        /// <summary>
        /// Change graphic information
        /// </summary>
        public void ChangeGraphics(GraphicsInfo info)
        {
            graphicsInfo = info;

            // Check all available adapters on the system.
            foreach (GraphicsAdapter adapter in GraphicsAdapter.Adapters)
            {
                // Get the capabilities of the hardware device.
                GraphicsDeviceCapabilities caps = 
                    adapter.GetCapabilities(DeviceType.Hardware);

                if (caps.MaxPixelShaderProfile < info.pixelShaderProfile)
                {
                    // This adapter does not support Shader Model
                    throw new NotSupportedException(
                            "This adapter does not support Shader Model (" + 
                            info.pixelShaderProfile.ToString() + ")");
                }
            }

            //  Initialize Graphics Device setting
            graphicsDeviceManager.PreferredBackBufferWidth = 
                graphicsInfo.screenWidth;
            graphicsDeviceManager.PreferredBackBufferHeight = 
                graphicsInfo.screenHeight;
            graphicsDeviceManager.MinimumVertexShaderProfile = 
                graphicsInfo.vertexShaderProfile;
            graphicsDeviceManager.MinimumPixelShaderProfile = 
                graphicsInfo.pixelShaderProfile;
            graphicsDeviceManager.PreferMultiSampling = graphicsInfo.isMultiSampling;
            graphicsDeviceManager.PreferredDepthStencilFormat = SelectStencilMode();
            
            //  Apply preparing device setting
#if XBOX
            graphicsDeviceManager.IsFullScreen = true;
            graphicsDeviceManager.PreparingDeviceSettings +=
                    new EventHandler<PreparingDeviceSettingsEventArgs>
                    (graphics_PreparingDeviceSettings);
#else
            graphicsDeviceManager.IsFullScreen = false;
#endif

            graphicsDeviceManager.ApplyChanges();

            //  Set to new default viewport
            Viewer.DefaultViewport = GraphicsDevice.Viewport;

            OnSize();
        }    
示例#3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public RobotGameGame() : base()
        {
            //  Set to window title name
            Window.Title = "Robot Game";

            //  Initialize a graphics information
            GraphicsInfo graphicsInfo = new GraphicsInfo();

#if XBOX
            graphicsInfo.screenWidth = (int)ViewerWidth.Width1080;
            graphicsInfo.screenHeight = (int)ViewerHeight.Height1080;
#else
            graphicsInfo.screenWidth = (int)ViewerWidth.Width720;
            graphicsInfo.screenHeight = (int)ViewerHeight.Height720;
#endif
            //  Set to shader info
            graphicsInfo.pixelShaderProfile = ShaderProfile.PS_2_0;
            graphicsInfo.vertexShaderProfile = ShaderProfile.VS_2_0;

            //  Must be call in this constructor
            ChangeGraphics(graphicsInfo);  
        }