diff --git a/.travis.yml b/.travis.yml index 10be776f3d..68b6bb7be8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,8 @@ before_install: install: - haxelib install munit > /dev/null - haxelib install hamcrest > /dev/null - - haxelib install lime > /dev/null - - haxelib install openfl > /dev/null + - haxelib install lime 2.9.1 > /dev/null + - haxelib install openfl 3.6.1 > /dev/null - haxelib install systools > /dev/null - haxelib install nape > /dev/null - haxelib install task > /dev/null diff --git a/CHANGELOG.md b/CHANGELOG.md index 4616e5657f..ba34deaf12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +4.1.1 +------------------------------ +* fixed the check for Lime <= 2.9.1 + 4.1.0 ------------------------------ @@ -52,6 +56,9 @@ * `FlxBitmapFont`: fixed a crash related to incorrect UTF-8 handling (#1857) * `FlxAtlas`: fixed a crash when the constructor is called with `powerOfTwo == true` (#1858) * `FlxTween`: fixed nested tween chains (#1871) +* `FlxTypedGroup`: fixed recursion in `forEachOfType()` (#1876) +* `Tracker`: [Neko] fixed a crash in `setVisible()` (#1879) +* Fixed some flixel-internal fields being accessible when they shouldn't be (#1849) #### Changes and improvements: @@ -60,6 +67,7 @@ * `FlxSpriteUtil`: changed `alphaMask()` arguments from `Dynamic` to `FlxGraphicAsset` (#1806) * `FlxG.signals`: changed `preUpdate` to be dispatched _after_ `FlxG.elapsed` is updated (#1836) * `FlxG.debugger`: changed `drawDebugChanged` to be dispatched _after_ `drawDebug` is updated +* `FlxDefines`: added a check for incompatible OpenFL / Lime versions (should be < 4.0.0 / < 3.0.0 respectively) 4.0.1 ------------------------------ diff --git a/flixel/FlxCamera.hx b/flixel/FlxCamera.hx index b848a2af09..eb4e9a86ab 100644 --- a/flixel/FlxCamera.hx +++ b/flixel/FlxCamera.hx @@ -39,7 +39,6 @@ using flixel.util.FlxColorTransformUtil; * |-> canvas:Sprite (its graphics is used for rendering objects in tile render mode) * |-> debugLayer:Sprite (this sprite is used in tile render mode for rendering debug info, like bounding boxes) */ -@:allow(flixel.FlxGame) class FlxCamera extends FlxBasic { /** diff --git a/flixel/FlxG.hx b/flixel/FlxG.hx index 975c09e259..3caee2e6b3 100644 --- a/flixel/FlxG.hx +++ b/flixel/FlxG.hx @@ -59,7 +59,6 @@ import openfl.display.OpenGLView; /** * Global helper class for audio, input, the camera system, the debugger and other global properties. */ -@:allow(flixel.FlxGame) class FlxG { /** @@ -91,7 +90,7 @@ class FlxG * The HaxeFlixel version, in semantic versioning syntax. Use Std.string() * on it to get a String formatted like this: "HaxeFlixel MAJOR.MINOR.PATCH-COMMIT_SHA". */ - public static var VERSION(default, null):FlxVersion = new FlxVersion(4, 1, 0); + public static var VERSION(default, null):FlxVersion = new FlxVersion(4, 1, 1); /** * Internal tracker for game object. @@ -126,6 +125,7 @@ class FlxG /** * Represents the amount of time in seconds that passed since last frame. */ + @:allow(flixel.FlxGame.updateElapsed) public static var elapsed(default, null):Float = 0; /** * Useful when the timestep is NOT fixed (i.e. variable), to prevent jerky movement or erratic behavior at very low fps. @@ -512,6 +512,7 @@ class FlxG /** * Called by FlxGame to set up FlxG during FlxGame's constructor. */ + @:allow(flixel.FlxGame.new) private static function init(Game:FlxGame, Width:Int, Height:Int, Zoom:Float):Void { game = Game; @@ -595,6 +596,7 @@ class FlxG /** * Called whenever the game is reset, doesn't have to do quite as much work as the basic initialization stuff. */ + @:allow(flixel.FlxGame) private static function reset():Void { random.resetInitialSeed(); diff --git a/flixel/FlxGame.hx b/flixel/FlxGame.hx index 620059cc4b..97856858d7 100644 --- a/flixel/FlxGame.hx +++ b/flixel/FlxGame.hx @@ -37,7 +37,7 @@ import flixel.system.ui.FlxFocusLostScreen; * 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. */ -@:allow(flixel) +@:allow(flixel.FlxG) class FlxGame extends Sprite { /** @@ -49,10 +49,12 @@ class FlxGame extends Sprite /** * Flag for whether a replay is currently playing. */ + @:allow(flixel.system.frontEnds.VCRFrontEnd) public var replaying(default, null):Bool = false; /** * Flag for whether a new recording is being made. */ + @:allow(flixel.system.frontEnds.VCRFrontEnd) public var recording(default, null):Bool = false; #end @@ -196,14 +198,17 @@ class FlxGame extends Sprite /** * Container for a game replay object. */ + @:allow(flixel.system.frontEnds.VCRFrontEnd) private var _replay:FlxReplay; /** * Flag for whether a playback of a recording was requested. */ + @:allow(flixel.system.frontEnds.VCRFrontEnd) private var _replayRequested:Bool = false; /** * Flag for whether a new recording was requested. */ + @:allow(flixel.system.frontEnds.VCRFrontEnd) private var _recordingRequested:Bool = false; #end diff --git a/flixel/FlxObject.hx b/flixel/FlxObject.hx index 82ae43453b..6af2ef3349 100644 --- a/flixel/FlxObject.hx +++ b/flixel/FlxObject.hx @@ -680,6 +680,7 @@ class FlxObject extends FlxBasic * @param Camera Specify which game camera you want. If null getScreenPosition() will just grab the first global camera. * @return Whether or not the two objects overlap. */ + @:access(flixel.group.FlxTypedGroup) public function overlaps(ObjectOrGroup:FlxBasic, InScreenSpace:Bool = false, ?Camera:FlxCamera):Bool { var group = FlxTypedGroup.resolveGroup(ObjectOrGroup); @@ -729,6 +730,7 @@ class FlxObject extends FlxBasic * @param Camera Specify which game camera you want. If null getScreenPosition() will just grab the first global camera. * @return Whether or not the two objects overlap. */ + @:access(flixel.group.FlxTypedGroup) public function overlapsAt(X:Float, Y:Float, ObjectOrGroup:FlxBasic, InScreenSpace:Bool = false, ?Camera:FlxCamera):Bool { var group = FlxTypedGroup.resolveGroup(ObjectOrGroup); diff --git a/flixel/FlxSprite.hx b/flixel/FlxSprite.hx index ed8ac59a49..dd4782c021 100644 --- a/flixel/FlxSprite.hx +++ b/flixel/FlxSprite.hx @@ -1053,6 +1053,7 @@ class FlxSprite extends FlxObject * @param saveAnimations Whether to save animations in animation controller or not * @return This sprite with loaded frames */ + @:access(flixel.animation.FlxAnimationController) public function setFrames(Frames:FlxFramesCollection, saveAnimations:Bool = true):FlxSprite { if (saveAnimations) diff --git a/flixel/FlxSubState.hx b/flixel/FlxSubState.hx index 730e771385..e75a0f01be 100644 --- a/flixel/FlxSubState.hx +++ b/flixel/FlxSubState.hx @@ -7,7 +7,6 @@ import flixel.util.FlxColor; * This is the basic game "state" object - e.g. in a simple game you might have a menu state and a play state. * It is for all intents and purpose a fancy FlxGroup. And really, it's not even that fancy. */ -@:allow(flixel.FlxState) class FlxSubState extends FlxState { /** @@ -22,11 +21,13 @@ class FlxSubState extends FlxState /** * Helper var for close() so closeSubState() can be called on the parent. - */ + */ + @:allow(flixel.FlxState.resetSubState) private var _parentState:FlxState; private var _bgColor:FlxColor; + @:allow(flixel.FlxState.resetSubState) private var _created:Bool = false; /** diff --git a/flixel/animation/FlxAnimationController.hx b/flixel/animation/FlxAnimationController.hx index 16c6d7db00..7af3824398 100644 --- a/flixel/animation/FlxAnimationController.hx +++ b/flixel/animation/FlxAnimationController.hx @@ -70,7 +70,6 @@ class FlxAnimationController implements IFlxDestroyable /** * Internal, stores all the animation that were added to this sprite. */ - @:allow(flixel.FlxSprite) private var _animations(default, null):Map; private var _prerotated:FlxPrerotatedAnimation; diff --git a/flixel/graphics/frames/FlxFrame.hx b/flixel/graphics/frames/FlxFrame.hx index 684c1f7aea..e803b29018 100644 --- a/flixel/graphics/frames/FlxFrame.hx +++ b/flixel/graphics/frames/FlxFrame.hx @@ -78,7 +78,8 @@ class FlxFrame implements IFlxDestroyable private var blitMatrix:Vector; - @:allow(flixel) + @:allow(flixel.graphics.FlxGraphic) + @:allow(flixel.graphics.frames.FlxFramesCollection) private function new(parent:FlxGraphic, angle:FlxFrameAngle = FlxFrameAngle.ANGLE_0, flipX:Bool = false, flipY:Bool = false) { this.parent = parent; @@ -98,7 +99,8 @@ class FlxFrame implements IFlxDestroyable } } - @:allow(flixel.graphics.frames) + @:allow(flixel.graphics.frames.FlxFramesCollection) + @:allow(flixel.graphics.frames.FlxBitmapFont) private function cacheFrameMatrix():Void { prepareBlitMatrix(matrix, true); diff --git a/flixel/group/FlxGroup.hx b/flixel/group/FlxGroup.hx index e1879d7675..357d9ae5f1 100644 --- a/flixel/group/FlxGroup.hx +++ b/flixel/group/FlxGroup.hx @@ -18,8 +18,7 @@ class FlxTypedGroup extends FlxBasic /** * Helper function for overlap functions in FlxObject and FlxTilemap. */ - @:allow(flixel) - private static inline function overlaps(Callback:FlxBasic->Float->Float->Bool->FlxCamera->Bool, + private static function overlaps(Callback:FlxBasic->Float->Float->Bool->FlxCamera->Bool, Group:FlxTypedGroup, X:Float, Y:Float, InScreenSpace:Bool, Camera:FlxCamera):Bool { var result:Bool = false; @@ -43,8 +42,7 @@ class FlxTypedGroup extends FlxBasic return result; } - @:allow(flixel) - private static inline function resolveGroup(ObjectOrGroup:FlxBasic):FlxTypedGroup + private static function resolveGroup(ObjectOrGroup:FlxBasic):FlxTypedGroup { var group:FlxTypedGroup = null; if (ObjectOrGroup != null) @@ -88,9 +86,7 @@ class FlxTypedGroup extends FlxBasic super(); members = []; - maxSize = Std.int(Math.abs(MaxSize)); - flixelType = GROUP; } @@ -806,7 +802,7 @@ class FlxTypedGroup extends FlxBasic { basic = members[i++]; - if (basic != null && Std.is(basic, ObjectClass)) + if (basic != null) { if (Recurse) { @@ -817,7 +813,8 @@ class FlxTypedGroup extends FlxBasic } } - Function(cast basic); + if (Std.is(basic, ObjectClass)) + Function(cast basic); } } } diff --git a/flixel/input/FlxKeyManager.hx b/flixel/input/FlxKeyManager.hx index 592f5f0371..355b480b5b 100644 --- a/flixel/input/FlxKeyManager.hx +++ b/flixel/input/FlxKeyManager.hx @@ -4,7 +4,6 @@ import flash.events.KeyboardEvent; import flixel.FlxG; import flixel.input.FlxInput.FlxInputState; -@:allow(flixel) class FlxKeyManager implements IFlxInputManager { /** @@ -33,6 +32,7 @@ class FlxKeyManager implements IFlxInputManager /** * Internal storage of input keys as an array, for efficient iteration. */ + @:allow(flixel.input.FlxBaseKeyList) private var _keyListArray:Array> = []; /** * Internal storage of input keys as a map, for efficient indexing. diff --git a/flixel/input/FlxPointer.hx b/flixel/input/FlxPointer.hx index c1c08dfdf6..e06805edb6 100644 --- a/flixel/input/FlxPointer.hx +++ b/flixel/input/FlxPointer.hx @@ -87,6 +87,7 @@ class FlxPointer * @param Camera Specify which game camera you want. If null getScreenPosition() will just grab the first global camera. * @return Whether or not the two objects overlap. */ + @:access(flixel.group.FlxTypedGroup.resolveGroup) public function overlaps(ObjectOrGroup:FlxBasic, ?Camera:FlxCamera):Bool { var result:Bool = false; diff --git a/flixel/input/keyboard/FlxKeyboard.hx b/flixel/input/keyboard/FlxKeyboard.hx index 37efda0f98..3a1829c275 100644 --- a/flixel/input/keyboard/FlxKeyboard.hx +++ b/flixel/input/keyboard/FlxKeyboard.hx @@ -9,7 +9,6 @@ import flixel.system.replay.CodeValuePair; /** * Keeps track of what keys are pressed and how with handy Bools or strings. */ -@:allow(flixel) class FlxKeyboard extends FlxKeyManager { #if !web @@ -133,6 +132,7 @@ class FlxKeyboard extends FlxKeyManager * * @return An array of key state data. Null if there is no data. */ + @:allow(flixel.system.replay.FlxReplay) private function record():Array { var data:Array = null; @@ -161,6 +161,7 @@ class FlxKeyboard extends FlxKeyManager * * @param Record Array of data about key states. */ + @:allow(flixel.system.replay.FlxReplay) private function playback(Record:Array):Void { var i:Int = 0; diff --git a/flixel/input/mouse/FlxMouse.hx b/flixel/input/mouse/FlxMouse.hx index acd70ef864..f1627d4512 100644 --- a/flixel/input/mouse/FlxMouse.hx +++ b/flixel/input/mouse/FlxMouse.hx @@ -30,7 +30,6 @@ private class GraphicCursor extends BitmapData {} * This class helps contain and track the mouse pointer in your game. * Automatically accounts for parallax scrolling, etc. */ -@:allow(flixel) class FlxMouse extends FlxPointer implements IFlxInputManager { /** @@ -101,16 +100,19 @@ class FlxMouse extends FlxPointer implements IFlxInputManager /** * The left mouse button. */ + @:allow(flixel.input.mouse.FlxMouseButton) private var _leftButton:FlxMouseButton; #if FLX_MOUSE_ADVANCED /** * The middle mouse button. */ + @:allow(flixel.input.mouse.FlxMouseButton) private var _middleButton:FlxMouseButton; /** * The right mouse button. */ + @:allow(flixel.input.mouse.FlxMouseButton) private var _rightButton:FlxMouseButton; #end @@ -448,7 +450,6 @@ class FlxMouse extends FlxPointer implements IFlxInputManager #end } - @:allow(flixel.FlxGame) private function onGameStart():Void { // Call set_visible with the value visible has been initialized with @@ -573,6 +574,7 @@ class FlxMouse extends FlxPointer implements IFlxInputManager // Replay functions + @:allow(flixel.system.replay.FlxReplay) private function record():MouseRecord { if ((_lastX == _globalScreenX) && (_lastY == _globalScreenY) @@ -586,6 +588,7 @@ class FlxMouse extends FlxPointer implements IFlxInputManager return new MouseRecord(_lastX, _lastY, _leftButton.current, _lastWheel); } + @:allow(flixel.system.replay.FlxReplay) private function playback(Record:MouseRecord):Void { _leftButton.current = Record.button; diff --git a/flixel/input/mouse/FlxMouseEventManager.hx b/flixel/input/mouse/FlxMouseEventManager.hx index 63cef45425..290360242d 100644 --- a/flixel/input/mouse/FlxMouseEventManager.hx +++ b/flixel/input/mouse/FlxMouseEventManager.hx @@ -276,6 +276,7 @@ class FlxMouseEventManager extends FlxBasic } } + @:access(flixel.group.FlxTypedGroup.resolveGroup) private static function traverseFlxGroup(Group:FlxTypedGroup, OrderedObjects:Array>):Void { for (basic in Group.members) diff --git a/flixel/math/FlxRandom.hx b/flixel/math/FlxRandom.hx index 097fc21bba..d1f6401c51 100644 --- a/flixel/math/FlxRandom.hx +++ b/flixel/math/FlxRandom.hx @@ -455,7 +455,7 @@ class FlxRandom * * @return The new value of the state seed. */ - @:allow(flixel.FlxGame.switchState) + @:allow(flixel.FlxGame) private static inline function updateStateSeed():Int { return _stateSeed = FlxG.random.currentSeed; @@ -467,7 +467,7 @@ class FlxRandom * * @param StandardMode If true, entire game will be reset, else just the current state will be reset. */ - @:allow(flixel.system.frontEnds.VCRFrontEnd.startRecording) + @:allow(flixel.system.frontEnds.VCRFrontEnd) private static inline function updateRecordingSeed(StandardMode:Bool = true):Int { return _recordingSeed = FlxG.random.initialSeed = StandardMode ? FlxG.random.initialSeed : _stateSeed; diff --git a/flixel/system/FlxQuadTree.hx b/flixel/system/FlxQuadTree.hx index ed237585b4..9ba5696ebc 100644 --- a/flixel/system/FlxQuadTree.hx +++ b/flixel/system/FlxQuadTree.hx @@ -366,6 +366,7 @@ class FlxQuadTree extends FlxRect * @param ObjectOrGroup FlxObjects are just added, FlxGroups are recursed and their applicable members added accordingly. * @param List A int flag indicating the list to which you want to add the objects. Options are A_LIST and B_LIST. */ + @:access(flixel.group.FlxTypedGroup.resolveGroup) public function add(ObjectOrGroup:FlxBasic, list:Int):Void { _list = list; diff --git a/flixel/system/debug/Window.hx b/flixel/system/debug/Window.hx index 7294052a7c..a8690e5a8e 100644 --- a/flixel/system/debug/Window.hx +++ b/flixel/system/debug/Window.hx @@ -74,6 +74,8 @@ class Window extends Sprite private var _resizing:Bool; private var _resizable:Bool; + private var _closable:Bool; + /** * The ID of this window. */ @@ -90,7 +92,8 @@ class Window extends Sprite * @param Bounds A rectangle indicating the valid screen area for the window. * @param Closable Whether this window has a close button that removes the window. */ - public function new(Title:String, ?Icon:BitmapData, Width:Float = 0, Height:Float = 0, Resizable:Bool = true, ?Bounds:Rectangle, Closable:Bool = false) + public function new(Title:String, ?Icon:BitmapData, Width:Float = 0, Height:Float = 0, Resizable:Bool = true, + ?Bounds:Rectangle, Closable:Bool = false) { super(); @@ -101,6 +104,7 @@ class Window extends Sprite updateBounds(Bounds); _drag = new Point(); _resizable = Resizable; + _closable = Closable; _shadow = new Bitmap(new BitmapData(1, 2, true, FlxColor.BLACK)); _background = new Bitmap(new BitmapData(1, 1, true, BG_COLOR)); @@ -248,17 +252,18 @@ class Window extends Sprite public function setVisible(Value:Bool):Void { visible = Value; - FlxG.save.data.windowSettings[_id] = visible; - FlxG.save.flush(); - if (toggleButton != null) + if (!_closable) { - toggleButton.toggled = !visible; + FlxG.save.data.windowSettings[_id] = visible; + FlxG.save.flush(); } + + if (toggleButton != null) + toggleButton.toggled = !visible; + if (visible) - { putOnTop(); - } } public inline function toggleVisible():Void diff --git a/flixel/system/debug/console/Console.hx b/flixel/system/debug/console/Console.hx index f5c991b9ee..e34ac1aa20 100644 --- a/flixel/system/debug/console/Console.hx +++ b/flixel/system/debug/console/Console.hx @@ -123,6 +123,7 @@ class Console extends Window } #if (!next && sys) + @:access(flixel.FlxGame.onFocus) override public function update() { super.update(); diff --git a/flixel/system/frontEnds/CameraFrontEnd.hx b/flixel/system/frontEnds/CameraFrontEnd.hx index daf2b0d89e..e8ae1c7237 100644 --- a/flixel/system/frontEnds/CameraFrontEnd.hx +++ b/flixel/system/frontEnds/CameraFrontEnd.hx @@ -6,7 +6,6 @@ import flixel.FlxG; import flixel.util.FlxAxes; import flixel.util.FlxColor; -@:allow(flixel.FlxGame) class CameraFrontEnd { /** @@ -164,6 +163,7 @@ class CameraFrontEnd /** * Called by the game object to lock all the camera buffers and clear them for the next draw pass. */ + @:allow(flixel.FlxGame) private inline function lock():Void { for (camera in list) @@ -205,6 +205,7 @@ class CameraFrontEnd } } + @:allow(flixel.FlxGame) private inline function render():Void { if (FlxG.renderTile) @@ -222,6 +223,7 @@ class CameraFrontEnd /** * Called by the game object to draw the special FX and unlock all the camera buffers. */ + @:allow(flixel.FlxGame) private inline function unlock():Void { for (camera in list) @@ -248,6 +250,7 @@ class CameraFrontEnd /** * Called by the game object to update the cameras and their tracking/special effects logic. */ + @:allow(flixel.FlxGame) private inline function update(elapsed:Float):Void { for (camera in list) @@ -262,6 +265,7 @@ class CameraFrontEnd /** * Resizes and moves cameras when the game resizes (onResize signal). */ + @:allow(flixel.FlxGame) private function resize():Void { for (camera in list) diff --git a/flixel/system/frontEnds/HTML5FrontEnd.hx b/flixel/system/frontEnds/HTML5FrontEnd.hx index e30ef67a4d..0bbcc9f700 100644 --- a/flixel/system/frontEnds/HTML5FrontEnd.hx +++ b/flixel/system/frontEnds/HTML5FrontEnd.hx @@ -1,27 +1,36 @@ package flixel.system.frontEnds; import flixel.math.FlxPoint; +using flixel.util.FlxArrayUtil; +using flixel.util.FlxStringUtil; #if js import js.Browser; class HTML5FrontEnd { - public var browser(get, never):FlxBrowser; + public var browser(default, null):FlxBrowser; + public var platform(default, null):FlxPlatform; + public var isMobile(default, null):Bool; public var browserWidth(get, never):Int; public var browserHeight(get, never):Int; public var browserPosition(get, null):FlxPoint; @:allow(flixel.FlxG) - private function new() {} + private function new() + { + browser = getBrowser(); + platform = getPlatform(); + isMobile = getIsMobile(); + } - private function get_browser():FlxBrowser + private function getBrowser():FlxBrowser { - if (Browser.navigator.userAgent.indexOf(" OPR/") > -1) + if (userAgentContains(" OPR/")) { return OPERA; } - else if (Browser.navigator.userAgent.toLowerCase().indexOf("chrome") > -1) + else if (userAgentContains("chrome", true)) { return CHROME; } @@ -37,7 +46,68 @@ class HTML5FrontEnd { return SAFARI; } - return UNKNOWN; + return FlxBrowser.UNKNOWN; + } + + private function getPlatform():FlxPlatform + { + if (userAgentContains("Win")) + { + return WINDOWS; + } + else if (userAgentContains("Mac") && !userAgentContains("iPad")) + { + return MAC; + } + else if (userAgentContains("Linux") && !userAgentContains("Android")) + { + return LINUX; + } + else if (userAgentContains("IEMobile")) + { + return WINDOWS_PHONE; + } + else if (userAgentContains("Android")) + { + return ANDROID; + } + else if (userAgentContains("BlackBerry")) + { + return BLACKBERRY; + } + else if (userAgentContains("iPhone")) + { + return IOS(IPHONE); + } + else if (userAgentContains("iPad")) + { + return IOS(IPAD); + } + else if (userAgentContains("iPod")) + { + return IOS(IPOD); + } + else return FlxPlatform.UNKNOWN; + } + + private function getIsMobile():Bool + { + return + switch (platform) + { + case ANDROID, BLACKBERRY, WINDOWS_PHONE, IOS(_): + true; + default: + false; + }; + } + + private function userAgentContains(substring:String, toLowerCase:Bool = false) + { + var userAgent = Browser.navigator.userAgent; + if (toLowerCase) + userAgent = userAgent.toLowerCase(); + return userAgent.contains(substring); } private function get_browserPosition():FlxPoint @@ -70,4 +140,23 @@ enum FlxBrowser OPERA; UNKNOWN; } -#end \ No newline at end of file + +enum FlxPlatform +{ + WINDOWS; + LINUX; + MAC; + ANDROID; + BLACKBERRY; + WINDOWS_PHONE; + IOS(device:FlxIOSDevice); + UNKNOWN; +} + +enum FlxIOSDevice +{ + IPHONE; + IPAD; + IPOD; +} +#end diff --git a/flixel/system/frontEnds/InputFrontEnd.hx b/flixel/system/frontEnds/InputFrontEnd.hx index efc9c30b83..cf13cec838 100644 --- a/flixel/system/frontEnds/InputFrontEnd.hx +++ b/flixel/system/frontEnds/InputFrontEnd.hx @@ -4,7 +4,6 @@ import flixel.input.IFlxInputManager; import flixel.util.FlxDestroyUtil; import flixel.util.FlxStringUtil; -@:allow(flixel) class InputFrontEnd { /** @@ -100,8 +99,10 @@ class InputFrontEnd } } + @:allow(flixel.FlxG) private function new() {} + @:allow(flixel.FlxGame) private inline function update():Void { for (input in list) @@ -110,6 +111,7 @@ class InputFrontEnd } } + @:allow(flixel.FlxGame) private inline function onFocus():Void { for (input in list) @@ -118,6 +120,7 @@ class InputFrontEnd } } + @:allow(flixel.FlxGame) private inline function onFocusLost():Void { for (input in list) @@ -126,6 +129,8 @@ class InputFrontEnd } } + @:allow(flixel.FlxGame) + @:allow(flixel.FlxState.resetSubState) private function onStateSwitch():Void { if (resetOnStateSwitch) diff --git a/flixel/system/frontEnds/PluginFrontEnd.hx b/flixel/system/frontEnds/PluginFrontEnd.hx index 44d3c9887d..28d342d932 100644 --- a/flixel/system/frontEnds/PluginFrontEnd.hx +++ b/flixel/system/frontEnds/PluginFrontEnd.hx @@ -4,7 +4,6 @@ import flixel.tweens.FlxTween; import flixel.util.FlxStringUtil; import flixel.util.FlxTimer; -@:allow(flixel.FlxGame) class PluginFrontEnd { /** @@ -113,6 +112,7 @@ class PluginFrontEnd /** * Used by the game object to call update() on all the plugins. */ + @:allow(flixel.FlxGame) private inline function update(elapsed:Float):Void { for (plugin in list) @@ -127,6 +127,7 @@ class PluginFrontEnd /** * Used by the game object to call draw() on all the plugins. */ + @:allow(flixel.FlxGame) private inline function draw():Void { for (plugin in list) diff --git a/flixel/system/frontEnds/SoundFrontEnd.hx b/flixel/system/frontEnds/SoundFrontEnd.hx index 3c1ebb5333..c5d82638d5 100644 --- a/flixel/system/frontEnds/SoundFrontEnd.hx +++ b/flixel/system/frontEnds/SoundFrontEnd.hx @@ -11,7 +11,6 @@ import flixel.math.FlxMath; import flixel.input.keyboard.FlxKey; import openfl.Assets; -@:allow(flixel.FlxGame) @:allow(flixel.FlxG) class SoundFrontEnd { @@ -316,6 +315,7 @@ class SoundFrontEnd /** * Called by the game loop to make sure the sounds get updated each frame. */ + @:allow(flixel.FlxGame) private function update(elapsed:Float):Void { if (music != null && music.active) @@ -334,6 +334,7 @@ class SoundFrontEnd #end } + @:allow(flixel.FlxGame) private function onFocusLost():Void { if (music != null) @@ -350,6 +351,7 @@ class SoundFrontEnd } } + @:allow(flixel.FlxGame) private function onFocus():Void { if (music != null) diff --git a/flixel/system/macros/FlxDefines.hx b/flixel/system/macros/FlxDefines.hx index 5ee64ec19d..09dca44831 100644 --- a/flixel/system/macros/FlxDefines.hx +++ b/flixel/system/macros/FlxDefines.hx @@ -52,6 +52,17 @@ private enum HelperDefines class FlxDefines { public static function run() + { + checkDependencyCompatibility(); + checkDefines(); + defineInversions(); + defineHelperDefines(); + + if (defined("flash")) + checkSwfVersion(); + } + + private static function checkDependencyCompatibility() { #if (haxe_ver < "3.2") abort('The minimum required Haxe version for HaxeFlixel is 3.2.0. ' @@ -65,12 +76,15 @@ class FlxDefines FlxMacroUtil.here()); #end - checkDefines(); - defineInversions(); - defineHelperDefines(); + #if (openfl >= "4.0.0") + abort('Flixel is currently incompatible with OpenFL 4.0.0 or above. ' + + 'Please use version 3.6.1 or older.', FlxMacroUtil.here()); + #end - if (defined("flash")) - checkSwfVersion(); + #if ((lime >= "3.0.0") || (tools >= "3.0.0")) + abort('Flixel is currently incompatible with Lime 3.0.0 or above. ' + + 'Please use version 2.9.1 or older.', FlxMacroUtil.here()); + #end } private static function checkDefines() diff --git a/flixel/text/FlxBitmapText.hx b/flixel/text/FlxBitmapText.hx index c0d900d746..7e6c6931f7 100644 --- a/flixel/text/FlxBitmapText.hx +++ b/flixel/text/FlxBitmapText.hx @@ -467,7 +467,7 @@ class FlxBitmapText extends FlxSprite override private function set_alpha(value:Float):Float { - alpha = value; + super.set_alpha(value); if (FlxG.renderBlit) { pendingTextBitmapChange = true; diff --git a/flixel/text/FlxText.hx b/flixel/text/FlxText.hx index 52706f4151..65c8189825 100644 --- a/flixel/text/FlxText.hx +++ b/flixel/text/FlxText.hx @@ -988,7 +988,7 @@ class FlxText extends FlxSprite drawTextFieldTo(graphic); } - private inline function applyFormats(FormatAdjusted:TextFormat, UseBorderColor:Bool = false):Void + private function applyFormats(FormatAdjusted:TextFormat, UseBorderColor:Bool = false):Void { // Apply the default format copyTextFormat(_defaultFormat, FormatAdjusted, false); @@ -1052,7 +1052,7 @@ class FlxText extends FlxSprite } } -@:allow(flixel) +@:allow(flixel.text.FlxText.applyFormats) class FlxTextFormat { /** @@ -1074,7 +1074,6 @@ class FlxTextFormat } } -@:allow(flixel) private class FlxTextFormatRange { public var range(default, null):FlxRange; diff --git a/flixel/tile/FlxBaseTilemap.hx b/flixel/tile/FlxBaseTilemap.hx index ac082ed9b4..4d5e73d80a 100644 --- a/flixel/tile/FlxBaseTilemap.hx +++ b/flixel/tile/FlxBaseTilemap.hx @@ -1153,9 +1153,10 @@ class FlxBaseTilemap extends FlxObject * * @param Object The object being tested. * @param InScreenSpace Whether to take scroll factors into account when checking for overlap. - * @param Camera Specify which game camera you want. If null getScreenPosition() will just grab the first global camera. + * @param Camera Specify which game camera you want. If null, getScreenPosition() will just grab the first global camera. * @return Whether or not the two objects overlap. */ + @:access(flixel.group.FlxTypedGroup) override public function overlaps(ObjectOrGroup:FlxBasic, InScreenSpace:Bool = false, ?Camera:FlxCamera):Bool { var group = FlxTypedGroup.resolveGroup(ObjectOrGroup); @@ -1194,6 +1195,7 @@ class FlxBaseTilemap extends FlxObject * @param Camera Specify which game camera you want. If null getScreenPosition() will just grab the first global camera. * @return Whether or not the two objects overlap. */ + @:access(flixel.group.FlxTypedGroup) override public function overlapsAt(X:Float, Y:Float, ObjectOrGroup:FlxBasic, InScreenSpace:Bool = false, ?Camera:FlxCamera):Bool { var group = FlxTypedGroup.resolveGroup(ObjectOrGroup); diff --git a/flixel/tweens/FlxTween.hx b/flixel/tweens/FlxTween.hx index 2f52231594..bb021aeb04 100644 --- a/flixel/tweens/FlxTween.hx +++ b/flixel/tweens/FlxTween.hx @@ -379,6 +379,11 @@ class FlxTween implements IFlxDestroyable public var onComplete:TweenCallback; public var type(default, set):Int; + + /** + * Value between `0` and `1` that indicates how far along this tween is in its completion. + * A value of `0.33` means that the tween is `33%` complete. + */ public var percent(get, set):Float; public var finished(default, null):Bool; public var scale(default, null):Float = 0; @@ -386,7 +391,7 @@ class FlxTween implements IFlxDestroyable /** * How many times this tween has been executed / has finished so far - useful to - * stop the LOOPING and PINGPONG types after a certain amount of time + * stop the `LOOPING` and `PINGPONG` types after a certain amount of time */ public var executions(default, null):Int = 0; diff --git a/flixel/util/FlxPath.hx b/flixel/util/FlxPath.hx index 9823412d1b..89168394c7 100644 --- a/flixel/util/FlxPath.hx +++ b/flixel/util/FlxPath.hx @@ -117,7 +117,7 @@ class FlxPath implements IFlxDestroyable /** * Object which will follow this path */ - @:allow(flixel.FlxObject) + @:allow(flixel.FlxObject.set_path) private var object:FlxObject; /** diff --git a/haxelib.json b/haxelib.json index 97970a8e82..f34415fb45 100644 --- a/haxelib.json +++ b/haxelib.json @@ -4,8 +4,8 @@ "license": "MIT", "tags": ["game", "openfl", "flash", "html5", "neko", "cpp", "android", "ios", "cross"], "description": "HaxeFlixel is a 2D game engine based on OpenFL that delivers cross-platform games.", - "version": "4.0.1", - "releasenote": "Fixes for the debugger, DCE, HTML5 and more. See the CHANGELOG.md for more details.", + "version": "4.1.1", + "releasenote": "Fixed the check for Lime <= 2.9.1", "contributors": ["haxeflixel"], - "dependencies": { "lime": "", "openfl": "" } + "dependencies": { "lime": "2.9.1", "openfl": "3.6.1" } } diff --git a/tests/unit/src/flixel/graphics/frames/FlxFrameTest.hx b/tests/unit/src/flixel/graphics/frames/FlxFrameTest.hx index 097e5083bd..cb09737ac7 100644 --- a/tests/unit/src/flixel/graphics/frames/FlxFrameTest.hx +++ b/tests/unit/src/flixel/graphics/frames/FlxFrameTest.hx @@ -3,6 +3,7 @@ package flixel.graphics.frames; class FlxFrameTest extends FlxTest { @Test + @:access(flixel.graphics.frames.FlxFrame.new) function testSortByName() { var indices = [3, 5, 8, 1, 6]; diff --git a/tests/unit/src/flixel/group/FlxGroupTest.hx b/tests/unit/src/flixel/group/FlxGroupTest.hx index 03f5cb7930..b3bc70a756 100644 --- a/tests/unit/src/flixel/group/FlxGroupTest.hx +++ b/tests/unit/src/flixel/group/FlxGroupTest.hx @@ -59,6 +59,36 @@ class FlxGroupTest extends FlxTest } } + @Test + function testForEachOfTypeRecurseTrue():Void + { + forEachOfTypeGroupSetup(group); + forEachOfTypeGroupSetup(subGroup); + + var timesCalled:Int = 0; + group.forEachOfType(FlxObject, function(_) timesCalled++, true); + + Assert.areEqual(6, timesCalled); + } + + @Test + function testForEachOfTypeRecurseFalse():Void + { + forEachOfTypeGroupSetup(group); + forEachOfTypeGroupSetup(subGroup); + + var timesCalled:Int = 0; + group.forEachOfType(FlxObject, function(_) timesCalled++, false); + + Assert.areEqual(3, timesCalled); + } + + function forEachOfTypeGroupSetup(group:FlxGroup):Void + { + for (i in 0...3) + group.add(new FlxObject()); + } + @Test function testForEachExistsRecurseFalse():Void { @@ -107,4 +137,4 @@ class FlxGroupTest extends FlxTest Assert.isTrue(each.exists); }); } -} \ No newline at end of file +} diff --git a/tests/unit/src/flixel/system/debug/watch/TrackerTest.hx b/tests/unit/src/flixel/system/debug/watch/TrackerTest.hx new file mode 100644 index 0000000000..822cc6aa9d --- /dev/null +++ b/tests/unit/src/flixel/system/debug/watch/TrackerTest.hx @@ -0,0 +1,13 @@ +package flixel.system.debug.watch; + +import flixel.FlxG; +import flixel.math.FlxPoint; + +class TrackerTest extends FlxTest +{ + @Test // #1879 + function testSetVisibleCrash() + { + FlxG.debugger.track(new FlxPoint()).setVisible(true); + } +} \ No newline at end of file