Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlxGroup cameras again, this time without breaking FlxSpriteGroup #2232

Merged
merged 1 commit into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flixel/FlxCamera.hx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class FlxCamera extends FlxBasic
/**
* Which cameras a `FlxBasic` uses to be drawn on when nothing else has been specified.
* By default, this is just a reference to `FlxG.cameras.list` / all cameras, but it can be very useful to change.
* This may be temporarily modified during a `draw` call.
*/
public static var defaultCameras:Array<FlxCamera>;

Expand Down
10 changes: 9 additions & 1 deletion flixel/group/FlxGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@ class FlxTypedGroup<T:FlxBasic> extends FlxBasic
{
var i:Int = 0;
var basic:FlxBasic = null;


var oldDefaultCameras = FlxCamera.defaultCameras;
if (cameras != null)
{
FlxCamera.defaultCameras = cameras;
}

while (i < length)
{
basic = members[i++];
Expand All @@ -189,6 +195,8 @@ class FlxTypedGroup<T:FlxBasic> extends FlxBasic
basic.draw();
}
}

FlxCamera.defaultCameras = oldDefaultCameras;
}

/**
Expand Down