/// <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); }
/// <summary> /// Called by <code>FlxGame</code> to set up <code>FlxG</code> during <code>FlxGame</code>'s constructor. /// </summary> internal static void init(FlxGame game, int width, int height, float zoom) { FlxG._game = game; FlxG.width = width; FlxG.height = height; FlxG.mute = false; FlxG.volume = 1.0f; FlxG.sounds = new FlxGroup(); FlxG.volumeHandler = delegate { }; //FlxG.clearBitmapCache(); //if(flashGfxSprite == null) //{ // flashGfxSprite = new Sprite(); // flashGfx = flashGfxSprite.graphics; //} FlxCamera.DefaultZoom = zoom; //FlxG._cameraRect = new Rectangle(); FlxG.cameras = new List<FlxCamera>(); //FlxG.UseBufferLocking = false; FlxG.plugins = new List<FlxBasic>(); //addPlugin(new DebugPathDisplay()); //addPlugin(new TimerManager()); FlxG.mouse = new FlxMouse(); FlxG.keys = new FlxKeyboard(); //FlxG.mobile = false; FlxG.levels = null; FlxG.scores = null; FlxG.visualDebug = false; // flx# stuff FlxG.cameras = new List<FlxCamera>(); //FlxG.width = FlxG.graphics.PreferredBackBufferWidth; //FlxG.height = FlxG.graphics.PreferredBackBufferHeight; FlxG.bgColor = Color.Black; FlxG.mute = false; FlxG.sounds = new FlxGroup(); FlxG.worldBounds = new FlxRect(); FlxG.defaultFont = FlxS.ContentManager.Load<SpriteFont>("deffont"); //FlxG.zoom = 1f; FlxG.pad1 = new FlxGamepad(PlayerIndex.One); FlxG.pad2 = new FlxGamepad(PlayerIndex.Two); FlxG.pad3 = new FlxGamepad(PlayerIndex.Three); FlxG.pad4 = new FlxGamepad(PlayerIndex.Four); FlxG.keys = new FlxKeyboard(); FlxG.mouse = new FlxMouse(); FlxCamera defaultCam = new FlxCamera(0, 0, FlxG.width, FlxG.height, FlxG.zoom); FlxG.addCamera(defaultCam); //Thread tCreate = new Thread(FlxG.state.create); //tCreate.Start(); //create state last //FlxG.State.create(); }