Skip to content

Commit

Permalink
Merge branch 'dev' into release6
Browse files Browse the repository at this point in the history
  • Loading branch information
Geokureli committed Jul 30, 2024
2 parents 112f19a + 8406274 commit 01ce3a1
Show file tree
Hide file tree
Showing 31 changed files with 764 additions and 258 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ jobs:
haxelib install haxelib 4.0.3
haxelib dev flixel .
- uses: HaxeFlixel/setup-flixel@v1
- uses: HaxeFlixel/setup-flixel@master
with:
haxe-version: current
flixel-versions: dev
test-location: local
target: ${{matrix.target}}
run-tests: true
run-tests: true
16 changes: 10 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ We removed many features and utilities that were previously deprecated
- `FlxUnicodeUtil`: Use `UnicodeString`, instead

5.9.0 (TBD)

------------------------------
#### New features:
- `FlxReplay`: Add `getDuration` ([#3135](https://github.com/HaxeFlixel/flixel/pull/3135))
- `InputFrontEnd`: ([#3134](https://github.com/HaxeFlixel/flixel/pull/3134))
Expand Down Expand Up @@ -86,7 +86,7 @@ We removed many features and utilities that were previously deprecated
- `FlxGraphic`: Prevent null ref in `getFramesCollections` with destroyed graphics ([#3180](https://github.com/HaxeFlixel/flixel/pull/3180))

5.8.0 (April 19, 2024)

------------------------------
#### New features:
- `FlxBitmapText`: Add `getRenderedText` ([#3120](https://github.com/HaxeFlixel/flixel/pull/3120))

Expand All @@ -95,16 +95,18 @@ We removed many features and utilities that were previously deprecated
- `FlxBitmapText`: Fix wrap issues caused from kerning ([#3120](https://github.com/HaxeFlixel/flixel/pull/3120))

5.7.2 (April 17, 2024)
------------------------------
#### Bugfixes:
- `FlxSpriteGroup`: Better long term fix for members cameras ([#3116](https://github.com/HaxeFlixel/flixel/pull/3116))

5.7.1 (April 16, 2024)
------------------------------
#### Bugfixes:
- `FlxImageFrame`: Prevent null ref from destroyed graphics ([#3113](https://github.com/HaxeFlixel/flixel/pull/3113))
- `FlxSpriteGroup`: Fix issue where members draw to the wrong cameras ([#3113](https://github.com/HaxeFlixel/flixel/pull/3113))

5.7.0 (April 16, 2024)

------------------------------
#### New features:
- `FlxBitmapFont`: Added `setCharFrame` ([#3037](https://github.com/HaxeFlixel/flixel/pull/3037))
- `FlxTimer`: Added static `wait` and `loops` methods ([#3040](https://github.com/HaxeFlixel/flixel/pull/3040))
Expand Down Expand Up @@ -143,16 +145,18 @@ We removed many features and utilities that were previously deprecated
- `FlxSound`: Fix sound panning ([#2863](https://github.com/HaxeFlixel/flixel/pull/2863))

5.6.2 (February 10, 2024)
------------------------------
#### Changes and improvements:
- `FlxBitmapFont`: Prevent crashes from missing xml fields in `fromAngelCode` ([#3029](https://github.com/HaxeFlixel/flixel/pull/3029))

5.6.1 (February 9, 2024)
------------------------------
#### Changes and improvements:
- `FlxBitmapFont`: Downgraded crashes of missing xml fields to warnings in `fromAngelCode` ([#3025](https://github.com/HaxeFlixel/flixel/pull/3025))
- Corrected documenation for the recent `FlxG.switchstate` arg changes

5.6.0 (February 2, 2024)

------------------------------
#### New features:
- `FlxGraphic`: Added `isDestroyed` ([#2974](https://github.com/HaxeFlixel/flixel/pull/2974))
- `FlxBitmapFont`: Support for all BMFont output file types ([#2949](https://github.com/HaxeFlixel/flixel/pull/2949))
Expand Down Expand Up @@ -192,7 +196,7 @@ We removed many features and utilities that were previously deprecated
- `QuadPath`: Prevent crash by avoiding divide by zero in `getCurveLength` ([#3019](https://github.com/HaxeFlixel/flixel/pull/3019))

5.5.0 (November 8, 2023)

------------------------------
#### New features:
- `FlxG`: Added `animationTimeScale` ([#2937](https://github.com/HaxeFlixel/flixel/pull/2937))

Expand All @@ -207,7 +211,7 @@ We removed many features and utilities that were previously deprecated


5.4.1 (October 4, 2023)

------------------------------
#### Changes and improvements:
- Various improvements and new features for animations ([#2930](https://github.com/HaxeFlixel/flixel/pull/2930))
- `FlxAnimation`: Make `frameDuration` and `looped` public
Expand Down
3 changes: 2 additions & 1 deletion checkstyle.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"STATIC",
"MACRO",
"INLINE",
"DYNAMIC"
"DYNAMIC",
"FINAL"
]
}
},
Expand Down
29 changes: 17 additions & 12 deletions flixel/FlxCamera.hx
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ class FlxCamera extends FlxBasic
&& _headTriangles.antialiasing == smoothing
&& _headTriangles.colored == isColored
&& _headTriangles.blending == blendInt
&& _headTriangles.blend == blend
#if !flash
&& _headTriangles.hasColorOffsets == hasColorOffsets
&& _headTriangles.shader == shader
Expand Down Expand Up @@ -682,6 +683,7 @@ class FlxCamera extends FlxBasic
itemToReturn.antialiasing = smoothing;
itemToReturn.colored = isColored;
itemToReturn.blending = blendInt;
itemToReturn.blend = blend;
#if !flash
itemToReturn.hasColorOffsets = hasColorOffsets;
itemToReturn.shader = shader;
Expand Down Expand Up @@ -1672,8 +1674,11 @@ class FlxCamera extends FlxBasic
if (FxAlpha == 0)
return;

var targetGraphics:Graphics = (graphics == null) ? canvas.graphics : graphics;
final targetGraphics = (graphics == null) ? canvas.graphics : graphics;

#if (openfl > "8.7.0")
targetGraphics.overrideBlendMode(null);
#end
targetGraphics.beginFill(Color, FxAlpha);
// i'm drawing rect with these parameters to avoid light lines at the top and left of the camera,
// which could appear while cameras fading
Expand All @@ -1688,35 +1693,35 @@ class FlxCamera extends FlxBasic
@:allow(flixel.system.frontEnds.CameraFrontEnd)
function drawFX():Void
{
var alphaComponent:Float;

// Draw the "flash" special effect onto the buffer
if (_fxFlashAlpha > 0.0)
{
alphaComponent = _fxFlashColor.alpha;

if (FlxG.renderBlit)
{
fill((Std.int(((alphaComponent <= 0) ? 0xff : alphaComponent) * _fxFlashAlpha) << 24) + (_fxFlashColor & 0x00ffffff));
var color = _fxFlashColor;
color.alphaFloat *= _fxFlashAlpha;
fill(color);
}
else
{
fill((_fxFlashColor & 0x00ffffff), true, ((alphaComponent <= 0) ? 0xff : alphaComponent) * _fxFlashAlpha / 255, canvas.graphics);
final alpha = color.alphaFloat * _fxFlashAlpha;
fill(_fxFlashColor.rgb, true, alpha, canvas.graphics);
}
}

// Draw the "fade" special effect onto the buffer
if (_fxFadeAlpha > 0.0)
{
alphaComponent = _fxFadeColor.alpha;

if (FlxG.renderBlit)
{
fill((Std.int(((alphaComponent <= 0) ? 0xff : alphaComponent) * _fxFadeAlpha) << 24) + (_fxFadeColor & 0x00ffffff));
var color = _fxFadeColor;
color.alphaFloat *= _fxFadeAlpha;
fill(color);
}
else
{
fill((_fxFadeColor & 0x00ffffff), true, ((alphaComponent <= 0) ? 0xff : alphaComponent) * _fxFadeAlpha / 255, canvas.graphics);
final alpha = _fxFadeColor.alphaFloat * _fxFadeAlpha;
fill(_fxFadeColor.rgb, true, alpha, canvas.graphics);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion flixel/FlxSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class FlxSprite extends FlxObject

/**
* Load graphic from another `FlxSprite` and copy its tile sheet data.
* This method can useful for non-flash targets.
* This method can be useful for non-flash targets.
*
* @param Sprite The `FlxSprite` from which you want to load graphic data.
* @return This `FlxSprite` instance (nice for chaining stuff together, if you're into that).
Expand Down
10 changes: 10 additions & 0 deletions flixel/animation/FlxAnimation.hx
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,26 @@ class FlxAnimation extends FlxBaseAnimation
if (reversed)
{
if (looped && curFrame == loopPoint)
{
curFrame = numFrames - 1;
parent.fireLoopCallback(name);
}
else
{
curFrame--;
}
}
else
{
if (looped && curFrame == numFrames - 1)
{
curFrame = loopPoint;
parent.fireLoopCallback(name);
}
else
{
curFrame++;
}
}

// prevents null ref when the sprite is destroyed on finishCallback (#2782)
Expand Down
76 changes: 64 additions & 12 deletions flixel/animation/FlxAnimationController.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package flixel.animation;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxFrame;
import flixel.util.FlxDestroyUtil.IFlxDestroyable;
import flixel.util.FlxDestroyUtil;
import flixel.util.FlxSignal;

using StringTools;

Expand Down Expand Up @@ -48,17 +49,50 @@ class FlxAnimationController implements IFlxDestroyable
public var numFrames(get, never):Int;

/**
* If assigned, will be called each time the current animation's frame changes.
* A function that has 3 parameters: a string name, a frame number, and a frame index.
* If assigned, will be called each time the current animation's frame changes
*
* @param animName The name of the current animation
* @param frameNumber The progress of the current animation, in frames
* @param frameIndex The current animation's frameIndex in the tile sheet
*/
public var callback:(name:String, frameNumber:Int, frameIndex:Int) -> Void;

@:deprecated('callback is deprecated, use onFrameChange.add') // 5.9.0
public var callback:(animName:String, frameNumber:Int, frameIndex:Int)->Void;

/**
* If assigned, will be called each time the current animation finishes.
* A function that has 1 parameter: a string name - animation name.
*
* @param animName The name of the current animation
*/
public var finishCallback:(name:String) -> Void;

@:deprecated('finishCallback is deprecated, use onFinish.add') // 5.9.0
public var finishCallback:(animName:String) -> Void;

/**
* Dispatches each time the current animation's frame changes
*
* @param animName The name of the current animation
* @param frameNumber The progress of the current animation, in frames
* @param frameIndex The current animation's frameIndex in the tile sheet
* @since 5.9.0
*/
public final onFrameChange = new FlxTypedSignal<(animName:String, frameNumber:Int, frameIndex:Int)->Void>();

/**
* Dispatches each time the current animation finishes.
*
* @param animName The name of the current animation
* @since 5.9.0
*/
public final onFinish = new FlxTypedSignal<(animName:String)->Void>();

/**
* Dispatches each time the current animation's loop is complete.
* Works only with looped animations.
*
* @param animName The name of the current animation
* @since 5.9.0
*/
public final onLoop = new FlxTypedSignal<(animName:String)->Void>();

/**
* How fast or slow time should pass for this animation controller
*/
Expand Down Expand Up @@ -137,11 +171,17 @@ class FlxAnimationController implements IFlxDestroyable
clearPrerotated();
}

@:haxe.warning("-WDeprecated")
public function destroy():Void
{
FlxDestroyUtil.destroy(onFrameChange);
FlxDestroyUtil.destroy(onFinish);
FlxDestroyUtil.destroy(onLoop);

destroyAnimations();
_animations = null;
callback = null;
finishCallback = null;
_sprite = null;
}

Expand Down Expand Up @@ -661,23 +701,35 @@ class FlxAnimationController implements IFlxDestroyable
frameIndex = FlxG.random.int(0, numFrames - 1);
}

inline function fireCallback():Void
@:haxe.warning("-WDeprecated")
function fireCallback():Void
{
final name = (_curAnim != null) ? (_curAnim.name) : null;
final number = (_curAnim != null) ? (_curAnim.curFrame) : frameIndex;
if (callback != null)
{
var name:String = (_curAnim != null) ? (_curAnim.name) : null;
var number:Int = (_curAnim != null) ? (_curAnim.curFrame) : frameIndex;
callback(name, number, frameIndex);
}

onFrameChange.dispatch(name, number, frameIndex);
}

@:allow(flixel.animation)
inline function fireFinishCallback(?name:String):Void
@:haxe.warning("-WDeprecated")
function fireFinishCallback(?name:String):Void
{
if (finishCallback != null)
{
finishCallback(name);
}

onFinish.dispatch(name);
}

@:allow(flixel.animation)
function fireLoopCallback(?name:String):Void
{
onLoop.dispatch(name);
}

function byNamesHelper(addTo:Array<Int>, frameNames:Array<String>):Void
Expand Down
Loading

0 comments on commit 01ce3a1

Please sign in to comment.