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

use FlxContainer and getCameras #424

Merged
merged 1 commit into from
Mar 10, 2024
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
6 changes: 6 additions & 0 deletions flixel/addons/display/FlxBackdrop.hx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ class FlxBackdrop extends FlxSprite
drawToLargestCamera();
}

#if (flixel >= "5.7.0")
final cameras = getCamerasLegacy();
#end
for (camera in cameras)
{
if (!camera.visible || !camera.exists || !isOnScreen(camera))
Expand Down Expand Up @@ -156,6 +159,9 @@ class FlxBackdrop extends FlxSprite
{
var largest:FlxCamera = null;
var largestArea = 0.0;
#if (flixel >= "5.7.0")
final cameras = getCamerasLegacy(); // else use this.cameras
#end
for (camera in cameras)
{
if (!camera.visible || !camera.exists || !isOnScreen(camera))
Expand Down
2 changes: 1 addition & 1 deletion flixel/addons/display/FlxSliceSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ class FlxSliceSprite extends FlxStrip
renderSprite.y = y;
renderSprite.scale.copyFrom(scale);
renderSprite.scrollFactor.set(scrollFactor.x, scrollFactor.y);
renderSprite.cameras = cameras;
renderSprite._cameras = _cameras;
renderSprite.draw();
}
else
Expand Down
2 changes: 1 addition & 1 deletion flixel/addons/display/FlxTiledSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class FlxTiledSprite extends FlxStrip
renderSprite.x = x;
renderSprite.y = y;
renderSprite.scrollFactor.set(scrollFactor.x, scrollFactor.y);
renderSprite.cameras = cameras;
renderSprite._cameras = _cameras;
renderSprite.draw();
}
else
Expand Down
2 changes: 1 addition & 1 deletion flixel/addons/editors/spine/FlxSpine.hx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class FlxSpine extends FlxSprite
{
wrapper.x = 0;
wrapper.y = 0;
wrapper.cameras = cameras;
wrapper._cameras = _cameras;

#if (flash || openfl >= "4.0.0")
wrapper.vertices.length = verticesLength;
Expand Down
4 changes: 2 additions & 2 deletions flixel/addons/effects/FlxTrail.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import flixel.animation.FlxAnimation;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.group.FlxGroup;
import flixel.group.FlxSpriteGroup;
import flixel.group.*;
import flixel.system.FlxAssets;
import flixel.util.FlxArrayUtil;
import flixel.util.FlxDestroyUtil;
Expand All @@ -17,7 +17,7 @@ import flixel.math.FlxPoint;
* Feel free to use this class and adjust it to your needs.
* @author Gama11
*/
class FlxTrail extends FlxSpriteGroup
class FlxTrail extends #if (flixel < "5.7.0") FlxSpriteGroup #else FlxSpriteContainer #end
{
/**
* Stores the FlxSprite the trail is attached to.
Expand Down
4 changes: 2 additions & 2 deletions flixel/addons/transition/TransitionEffect.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package flixel.addons.transition;
import flixel.addons.transition.FlxTransitionSprite.TransitionStatus;
import flixel.addons.transition.TransitionData;
import flixel.group.FlxGroup;
import flixel.group.FlxSpriteGroup;
import flixel.group.*;
import flixel.util.FlxTimer;

/**
* @author larsiusprime
*/
@:allow(flixel.addons.transition.Transition)
class TransitionEffect extends FlxSpriteGroup
class TransitionEffect extends #if (flixel < "5.7.0") FlxSpriteGroup #else FlxSpriteContainer #end
{
public var finishCallback:Void->Void;
public var finished(default, null):Bool = false;
Expand Down
4 changes: 2 additions & 2 deletions flixel/addons/ui/FlxButtonPlus.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import flixel.FlxCamera;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.graphics.FlxGraphic;
import flixel.group.FlxSpriteGroup;
import flixel.group.*;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import flixel.util.FlxDestroyUtil;
Expand All @@ -24,7 +24,7 @@ import flixel.math.FlxMath;
* @link http://www.photonstorm.com
* @author Richard Davey / Photon Storm
*/
class FlxButtonPlus extends FlxSpriteGroup
class FlxButtonPlus extends #if (flixel < "5.7.0") FlxSpriteGroup #else FlxSpriteContainer #end
{
public static inline var NORMAL:Int = 0;
public static inline var HIGHLIGHT:Int = 1;
Expand Down
3 changes: 3 additions & 0 deletions flixel/addons/ui/FlxClickArea.hx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ class FlxClickArea extends FlxObject
if (continueUpdate)
{
var offAll:Bool = true;
#if (flixel >= "5.7.0")
final cameras = getCameras(); // else use this.cameras
#end
for (camera in cameras)
{
#if FLX_MOUSE
Expand Down
16 changes: 10 additions & 6 deletions flixel/addons/ui/FlxSlider.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ package flixel.addons.ui;
#if FLX_MOUSE
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.group.FlxSpriteGroup;
import flixel.text.FlxText;
import flixel.util.FlxDestroyUtil;
import flixel.group.*;
import flixel.math.FlxMath;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.util.FlxSpriteUtil;
import flixel.text.FlxText;
import flixel.util.FlxColor;
import flixel.util.FlxDestroyUtil;
import flixel.util.FlxSpriteUtil;

/**
* A slider GUI element for float and integer manipulation.
* @author Gama11
*/
class FlxSlider extends FlxSpriteGroup
class FlxSlider extends #if (flixel < "5.7.0") FlxSpriteGroup #else FlxSpriteContainer #end
{
/**
* The horizontal line in the background.
Expand Down Expand Up @@ -271,7 +271,11 @@ class FlxSlider extends FlxSpriteGroup
override public function update(elapsed:Float):Void
{
// Clicking and sound logic
if (FlxMath.mouseInFlxRect(false, _bounds))
#if (flixel >= "5.7.0")
final camera = getCameras()[0];// else use this.camera
#end
final mouse = FlxG.mouse.getScreenPosition(camera);
if (FlxMath.pointInFlxRect(mouse.x, mouse.y, _bounds))
{
if (hoverAlpha != 1)
{
Expand Down
Loading