コード例 #1
0
    public XnaGame()
    {
        Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

        Instance              = this;
        _graphics             = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";

        IsFixedTimeStep = true;
        IsMouseVisible  = false;

        #if WINDOWS
        _graphics.PreferredBackBufferWidth  = 960;
        _graphics.PreferredBackBufferHeight = 640;

        _mousepointer = true;
        #elif XBOX360
        _graphics.PreferredBackBufferWidth  = 1280;
        _graphics.PreferredBackBufferHeight = 720;

        _mousepointer = true;
        #elif WINDOWS_PHONE
        _graphics.PreferredBackBufferFormat = SurfaceFormat.Color;
        _mousepointer = false;
        #endif

        //Make 30 FPS or put a key limiter on KeyDown!
        TargetElapsedTime = TimeSpan.FromSeconds(1 / 60.0f);

        StorageManager = new StorageManager("EndingXNA");
        StorageManager.ShowStorageGuide();
        StorageManager.StorageDeviceAction += (sender, e) => {
            if (e.DialogAction == DialogAction.Select)
            {
                Game.LoadFromUserStorage(e.StorageContainer);
            }
        };


        FlashRenderer = new FlashRenderer();

        //Post processing effects for bloom, fisheye and scanlines...
        PostProcess = new PostProcess(this, null);
        #if WINDOWS || XBOX360
        PostProcess.AddProcessor(new BloomProcessor(this)
        {
            Active = true, Settings = BloomProcessor.BloomSettings.PresetSettings[7]
        });
        PostProcess.AddProcessor(new BarrelDistortionProcessor(this)
        {
            Active = false
        });
        PostProcess.AddProcessor(new ScanlinesProcessor(this)
        {
            Active = false, ScanlinesValue = 0.25f
        });

        Components.Add(new GamerServicesComponent(this));
        Components.Add(ThreadPoolComponent = new ThreadPoolComponent(this));
        #endif
    }