FlxGame is the heart of all flixel games, and contains a bunch of basic game loops and things. It is a long and sloppy file that you shouldn't have to worry about too much! It is basically only used to create your game object in the first place, after that FlxG and FlxState have all the useful stuff you actually need.
Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            FlxS.GraphicsDevice          = GraphicsDevice;
            FlxS.GraphicsDevice.Viewport = new Viewport(0, 0, _screenSizeX, _screenSizeY);

            FlxS.RenderTarget = new RenderTarget2D(
                FlxS.GraphicsDevice,
                _gameSizeX,
                _gameSizeY,
                false,
                FlxS.GraphicsDevice.DisplayMode.Format,
                DepthFormat.None,
                0,
                RenderTargetUsage.DiscardContents);

            _fxHelperTexture = new Texture2D(FlxS.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            _fxHelperTexture.SetData(new [] { Color.White });

            FlxS.SpriteBatch = new SpriteBatch(GraphicsDevice);

            _flxGame = new FlxGame(
                _gameSizeX,
                _gameSizeY,
                _initialState,
                _zoom,
                _gameFramerate,
                _flashFramerate,
                _useSystemCursor);
        }
Пример #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            FlxS.GraphicsDevice = GraphicsDevice;
            FlxS.GraphicsDevice.Viewport = new Viewport(0, 0, _screenSizeX, _screenSizeY);

            FlxS.RenderTarget = new RenderTarget2D(
                FlxS.GraphicsDevice,
                _gameSizeX,
                _gameSizeY,
                false,
                FlxS.GraphicsDevice.DisplayMode.Format,
                DepthFormat.None,
                0,
                RenderTargetUsage.DiscardContents);

            _fxHelperTexture = new Texture2D(FlxS.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            _fxHelperTexture.SetData(new [] { Color.White });

            FlxS.SpriteBatch = new SpriteBatch(GraphicsDevice);

            _flxGame = new FlxGame(
                _gameSizeX,
                _gameSizeY,
                _initialState,
                _zoom,
                _gameFramerate,
                _flashFramerate,
                _useSystemCursor);
        }