protected override void LoadContent() { //load up graphical content used for the flixel engine targetWidth = (int)(GraphicsDevice.Viewport.Height * ((float)FlxG.width / (float)FlxG.height)); targetLeft = (GraphicsDevice.Viewport.Width - targetWidth) / 2; FlxG.LoadContent(GraphicsDevice); //_sndBeep = FlxG.Content.Load<SoundEffect>("Flixel/beep"); initConsole(); if (_firstScreen != null) { FlxG.state = _firstScreen; _firstScreen = null; } }
//@desc Switch from one FlxState to another //@param State The class name of the state you want (e.g. PlayState) public void switchState(FlxState newscreen) { FlxG.camera.unfollow(); FlxG.keys.reset(); FlxG.gamepads.reset(); FlxG.mouse.reset(); FlxG.flash.stop(); FlxG.fade.stop(); FlxG.quake.stop(); if (_state != null) { _state.destroy(); } _state = newscreen; _state.create(); }
//@desc Constructor //@param GameSizeX The width of your game in pixels (e.g. 320) //@param GameSizeY The height of your game in pixels (e.g. 240) //@param InitialState The class name of the state you want to create and switch to first (e.g. MenuState) //@param BGColor The color of the app's background //@param FlixelColor The color of the great big 'f' in the flixel logo public void initGame(int GameSizeX, int GameSizeY, FlxState InitialState, Color BGColor, bool showFlixelLogo, Color logoColor) { FlxG.backColor = BGColor; FlxG.setGameData(this, GameSizeX, GameSizeY); _paused = false; //activate the first screen. if (showFlixelLogo == false) { _firstScreen = InitialState; } else { FlxSplash.setSplashInfo(logoColor, InitialState); _firstScreen = new FlxSplash(); } }
public static void setSplashInfo(Color flixelColor, FlxState nextScreen) { _fc = flixelColor; _nextScreen = nextScreen; }
protected override void LoadContent() { //load up graphical content used for the flixel engine targetWidth = (int)(GraphicsDevice.Viewport.Height * ((float)FlxG.width / (float)FlxG.height)); targetLeft = (GraphicsDevice.Viewport.Width - targetWidth) / 2; FlxG.LoadContent(GraphicsDevice); _sndBeep = FlxG.Content.Load<SoundEffect>("Flixel/beep"); initConsole(); if (_firstScreen != null) { FlxG.state = _firstScreen; _firstScreen = null; } }
//@desc Switch from one FlxState to another //@param State The class name of the state you want (e.g. PlayState) public void switchState(FlxState newscreen) { FlxG.unfollow(); FlxG.keys.reset(); FlxG.gamepads.reset(); FlxG.mouse.reset(); FlxG.flash.stop(); FlxG.fade.stop(); FlxG.quake.stop(); if (_state != null) { _state.destroy(); } _state = newscreen; _state.create(); }