diff --git a/flixel/FlxGame.hx b/flixel/FlxGame.hx index 19f48fd5cb..937b539cbd 100644 --- a/flixel/FlxGame.hx +++ b/flixel/FlxGame.hx @@ -223,8 +223,8 @@ class FlxGame extends Sprite /** * Instantiate a new game object. * - * @param GameSizeX The width of your game in game pixels, not necessarily final display pixels (see Zoom). - * @param GameSizeY The height of your game in game pixels, not necessarily final display pixels (see Zoom). + * @param GameSizeX The width of your game in game pixels, not necessarily final display pixels (see Zoom). If it is not a positive number, HaxeFlixel will auto detect the width according to the current window. + * @param GameSizeY The height of your game in game pixels, not necessarily final display pixels (see Zoom). If it is not a positive number, HaxeFlixel will auto detect the height according to the current window. * @param InitialState The class name of the state you want to create and switch to first (e.g. MenuState). * @param Zoom The default level of zoom for the game's cameras (e.g. 2 = all pixels are now drawn at 2x). Default = 1. * @param UpdateFramerate How frequently the game should update (default is 60 times per second). @@ -232,7 +232,7 @@ class FlxGame extends Sprite * @param SkipSplash Whether you want to skip the flixel splash screen with `FLX_NO_DEBUG`. * @param StartFullscreen Whether to start the game in fullscreen mode (desktop targets only), false by default */ - public function new(GameSizeX:Int = 640, GameSizeY:Int = 480, ?InitialState:Class, Zoom:Float = 1, UpdateFramerate:Int = 60, DrawFramerate:Int = 60, SkipSplash:Bool = false, StartFullscreen:Bool = false) + public function new(GameSizeX:Int = 0, GameSizeY:Int = 0, ?InitialState:Class, Zoom:Float = 1, UpdateFramerate:Int = 60, DrawFramerate:Int = 60, SkipSplash:Bool = false, StartFullscreen:Bool = false) { super(); @@ -243,6 +243,14 @@ class FlxGame extends Sprite // Super high priority init stuff _inputContainer = new Sprite(); + if (GameSizeX <= 0) + { + GameSizeX = Std.int(Lib.current.stage.stageWidth); + } + if (GameSizeY <= 0) + { + GameSizeY = Std.int(Lib.current.stage.stageHeight); + } // Basic display and update setup stuff FlxG.init(this, GameSizeX, GameSizeY, Zoom); diff --git a/flixel/math/FlxPoint.hx b/flixel/math/FlxPoint.hx index 83143e66ea..2ee4414094 100644 --- a/flixel/math/FlxPoint.hx +++ b/flixel/math/FlxPoint.hx @@ -151,6 +151,19 @@ class FlxPoint implements IFlxPooled return this; } + /** + * Scale this point. + * + * @param k - scale coefficient + * @return scaled point + */ + public function scale(k:Float):FlxPoint + { + x *= k; + y *= k; + return this; + } + /** * Helper function, just copies the values from the specified point. * diff --git a/flixel/math/FlxVector.hx b/flixel/math/FlxVector.hx index 71921087ce..39e5163d9d 100644 --- a/flixel/math/FlxVector.hx +++ b/flixel/math/FlxVector.hx @@ -102,7 +102,7 @@ class FlxVector extends FlxPoint * @param k - scale coefficient * @return scaled vector */ - public inline function scale(k:Float):FlxVector + public override function scale(k:Float):FlxVector { x *= k; y *= k;