Skip to content

Commit

Permalink
Merge branch 'release6' into george-6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Geokureli committed May 9, 2024
2 parents 4d51f0c + 32e3ee1 commit ed33afd
Show file tree
Hide file tree
Showing 45 changed files with 1,037 additions and 348 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
build:
strategy:
matrix:
haxe-version: ["4.2.5", "4.3.3", latest]
haxe-version: ["4.2.5", "4.3.3"]
target: [html5, hl, neko, flash, cpp]
fail-fast: false
runs-on: ubuntu-latest
Expand Down
50 changes: 48 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,34 @@ We removed many features and utilities that were previously deprecated
- `FlxAssets.FlxTexturePackerSource`: Use `FlxTexturePackerJsonAsset`, instead
- `FlxUnicodeUtil`: Use `UnicodeString`, instead

5.7.0 (TBD)
5.8.1 (TBD)

#### Changes and improvements:
- `FlxKey`: Add `NONE` to `fromStringMap` and `toStringMap` ([#3119](https://github.com/HaxeFlixel/flixel/pull/3119))
- `FlxPreloader`: Improve documentation ([#3119](https://github.com/HaxeFlixel/flixel/pull/3119))

#### Bugfixes:
-

5.8.0 (April 19, 2024)

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

#### Bugfixes:
- `FlxSpriteGroup`: Fix propegation of `cameras` field to members ([#3118](https://github.com/HaxeFlixel/flixel/pull/3118))
- `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))
Expand All @@ -45,7 +72,10 @@ We removed many features and utilities that were previously deprecated
- `FlxG.plugins`: Added `drawOnTop` field ([#3057](https://github.com/HaxeFlixel/flixel/pull/3057))
- `FlxCamera`: Added `stopFade`, `stopFlash`, and `stopShake` ([#3063](https://github.com/HaxeFlixel/flixel/pull/3063))
- `FlxRect`: Added `containsXY` ([#3069](https://github.com/HaxeFlixel/flixel/pull/3069))

- `FlxDebugger`: Added button to toggle `ignoreDrawDebug` on selected objects ([#3071](https://github.com/HaxeFlixel/flixel/pull/3071))
- `FlxTween`: Add tween-based `flicker()` system ([#3086](https://github.com/HaxeFlixel/flixel/pull/3086))
- `FlxButton`: Add `DISABLED` state ([#3087](https://github.com/HaxeFlixel/flixel/pull/3087))
- `FlxBitmapFont`: Honor kerning data from BMFont files ([#3035](https://github.com/HaxeFlixel/flixel/pull/3035))

#### Changes and improvements:
- `FlxBitmapText`: Honor `scale` when changing `width` and `height` ([#3037](https://github.com/HaxeFlixel/flixel/pull/3037))
Expand All @@ -54,6 +84,22 @@ We removed many features and utilities that were previously deprecated
- `FlxText`: Removed references to `FlxUnicodeUtil` ([#3049](https://github.com/HaxeFlixel/flixel/pull/3049))
- `FlxObject`: Deprecated `health` and `hurt` ([#3065](https://github.com/HaxeFlixel/flixel/pull/3065))
- Added compiler flag `FLX_NO_HEALTH` to create your own replacement, if needed ([#3067](https://github.com/HaxeFlixel/flixel/pull/3067))
- Prevent building debug bitmaps in release mode ([#3077](https://github.com/HaxeFlixel/flixel/pull/3077))
- `FlxUnicodeUtil`: Deprecated ([#3078](https://github.com/HaxeFlixel/flixel/pull/3078))
- Various Changes brought up by EliteMasterEric ([#3085](https://github.com/HaxeFlixel/flixel/pull/3085))
- `FlxGraphic`: Check `isDestroyed` for better error messages when using destroyed graphics
- `FlxGraphic`: Prevent double destroy, and double adding of frame collections
- `FlxFlicker`: Prevent double `release()` calls
- `FlxDebugger`: Updated the URL to HaxeFlixel site ([#3102](https://github.com/HaxeFlixel/flixel/pull/3102))

#### Bugfixes:
- `FlxKeyboard`: Fix `PLUS` key on windows ([#3093](https://github.com/HaxeFlixel/flixel/pull/3093))
- `FlxSpriteContainer`: Fix error in `destroy` ([#3095](https://github.com/HaxeFlixel/flixel/pull/3095))
- `FlxSprite`: Fix `getGraphicMidpoint()` ([#3101](https://github.com/HaxeFlixel/flixel/pull/3101))
- `FlxPool`: Fix various point and rect pooling leaks ([#3103](https://github.com/HaxeFlixel/flixel/pull/3103))
([#3108](https://github.com/HaxeFlixel/flixel/pull/3108))
- `FlxAtlasFrames`: Prevent errors when adding frames of size 0 ([#3096](https://github.com/HaxeFlixel/flixel/pull/3096))
- `FlxSound`: Fix sound panning ([#2863](https://github.com/HaxeFlixel/flixel/pull/2863))

5.6.2 (February 10, 2024)
#### Changes and improvements:
Expand Down
Binary file modified assets/images/ui/button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 17 additions & 13 deletions flixel/FlxCamera.hx
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,10 @@ class FlxCamera extends FlxBasic
{
itemToReturn = new FlxDrawItem();
}

// TODO: catch this error when the dev actually messes up, not in the draw phase
if (graphic.isDestroyed)
throw 'Attempted to queue an invalid FlxDrawItem, did you destroy a cached sprite?';

if (graphic.isDestroyed) throw 'Attempted to queue an invalid FlxDrawItem, did you destroy a cached sprite?';

Expand Down Expand Up @@ -1255,15 +1259,15 @@ class FlxCamera extends FlxBasic

function updateLerp(elapsed:Float)
{
final boundLerp = FlxMath.bound(followLerp, 0, 1);
// Adjust lerp based on the current frame rate so lerp is less framerate dependant
final adjustedLerp = 1.0 - Math.pow(1.0 - boundLerp, elapsed * 60);
if (adjustedLerp >= 1)
if (followLerp >= 1.0)
{
scroll.copyFrom(_scrollTarget); // no easing
}
else
else if (followLerp > 0.0)
{
// Adjust lerp based on the current frame rate so lerp is less framerate dependant
final adjustedLerp = 1.0 - Math.pow(1.0 - followLerp, elapsed * 60);

scroll.x += (_scrollTarget.x - scroll.x) * adjustedLerp;
scroll.y += (_scrollTarget.y - scroll.y) * adjustedLerp;
}
Expand Down Expand Up @@ -1453,14 +1457,14 @@ class FlxCamera extends FlxBasic
this.style = style;
this.target = target;
followLerp = lerp;
var helper:Float;
var w:Float = 0;
var h:Float = 0;
_lastTargetPosition = null;
_lastTargetPosition = FlxDestroyUtil.put(_lastTargetPosition);
deadzone = FlxDestroyUtil.put(deadzone);

switch (style)
{
case LOCKON:
var w:Float = 0;
var h:Float = 0;
if (target != null)
{
w = target.width;
Expand All @@ -1469,16 +1473,16 @@ class FlxCamera extends FlxBasic
deadzone = FlxRect.get((width - w) / 2, (height - h) / 2 - h * 0.25, w, h);

case PLATFORMER:
var w:Float = (width / 8);
var h:Float = (height / 3);
final w:Float = (width / 8);
final h:Float = (height / 3);
deadzone = FlxRect.get((width - w) / 2, (height - h) / 2 - h * 0.25, w, h);

case TOPDOWN:
helper = Math.max(width, height) / 4;
final helper = Math.max(width, height) / 4;
deadzone = FlxRect.get((width - helper) / 2, (height - helper) / 2, helper, helper);

case TOPDOWN_TIGHT:
helper = Math.max(width, height) / 8;
final helper = Math.max(width, height) / 8;
deadzone = FlxRect.get((width - helper) / 2, (height - helper) / 2, helper, helper);

case SCREEN_BY_SCREEN:
Expand Down
2 changes: 1 addition & 1 deletion flixel/FlxG.hx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,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(5, 7, 0);
public static var VERSION(default, null):FlxVersion = new FlxVersion(5, 8, 1);

/**
* Internal tracker for game object.
Expand Down
9 changes: 8 additions & 1 deletion flixel/FlxGame.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package flixel;
import flixel.graphics.tile.FlxDrawBaseItem;
import flixel.system.FlxSplash;
import flixel.util.FlxArrayUtil;
import flixel.util.FlxDestroyUtil;
import flixel.util.typeLimit.NextState;
import openfl.Assets;
import openfl.Lib;
Expand Down Expand Up @@ -757,7 +758,13 @@ class FlxGame extends Sprite
#end

#if FLX_POINTER_INPUT
FlxArrayUtil.clearArray(FlxG.swipes);
var len = FlxG.swipes.length;
while(len-- > 0)
{
final swipe = FlxG.swipes.pop();
if (swipe != null)
swipe.destroy();
}
#end

filters = filtersEnabled ? _filters : null;
Expand Down
2 changes: 1 addition & 1 deletion flixel/FlxSprite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ class FlxSprite extends FlxObject
{
if (point == null)
point = FlxPoint.get();
return point.set(x + frameWidth * 0.5, y + frameHeight * 0.5);
return point.set(x + frameWidth * 0.5 * scale.x, y + frameHeight * 0.5 * scale.y);
}

/**
Expand Down
19 changes: 6 additions & 13 deletions flixel/effects/FlxFlicker.hx
Original file line number Diff line number Diff line change
Expand Up @@ -176,28 +176,21 @@ class FlxFlicker implements IFlxDestroyable
/**
* Just a helper function for flicker() to update object's visibility.
*/
function flickerProgress(Timer:FlxTimer):Void
function flickerProgress(timer:FlxTimer):Void
{
object.visible = !object.visible;

if (progressCallback != null)
{
progressCallback(this);
}

if (Timer.loops > 0 && Timer.loopsLeft == 0)

if (timer.loops > 0 && timer.loopsLeft == 0)
{
object.visible = endVisibility;
if (completionCallback != null)
{
completionCallback(this);
}

// NOTE: Calling `flicker` in the completion callback will call release() on this object before reinstantiating it.
// If that happens, we don't want to call release() again! So we check if the flicker is still done before releasing.
if (this.timer == Timer) {

if (this.timer == timer)
release();
}
}
}

Expand Down
10 changes: 6 additions & 4 deletions flixel/graphics/FlxGraphic.hx
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ class FlxGraphic implements IFlxDestroyable
key = null;
assetsKey = null;
assetsClass = null;
imageFrame = null; // no need to dispose _imageFrame since it exists in imageFrames
imageFrame = FlxDestroyUtil.destroy(imageFrame);

if (frameCollections == null) // no need to destroy frame collections if it's already null
return;
Expand All @@ -498,8 +498,10 @@ class FlxGraphic implements IFlxDestroyable
{
if (collection.type != null)
{
var collections:Array<Dynamic> = getFramesCollections(collection.type);
if (collections.indexOf(collection) == -1)
final collections = getFramesCollections(collection.type);
if (collections.contains(collection))
FlxG.log.warn('Attempting to add already added collection');
else
collections.push(collection);
}
}
Expand Down Expand Up @@ -602,7 +604,7 @@ class FlxGraphic implements IFlxDestroyable
function get_imageFrame():FlxImageFrame
{
if (imageFrame == null)
imageFrame = FlxImageFrame.fromRectangle(this, FlxRect.get(0, 0, bitmap.width, bitmap.height));
imageFrame = FlxImageFrame.fromRectangle(this);

return imageFrame;
}
Expand Down
26 changes: 22 additions & 4 deletions flixel/graphics/frames/FlxAtlasFrames.hx
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ class FlxAtlasFrames extends FlxFramesCollection

for (texture in data.nodes.SubTexture)
{
if (!texture.has.width && texture.has.w)
throw "Sparrow v1 is not supported, use Sparrow v2";

var name = texture.att.name;
var trimmed = texture.has.frameX;
var rotated = (texture.has.rotated && texture.att.rotated == "true");
Expand All @@ -262,25 +265,40 @@ class FlxAtlasFrames extends FlxFramesCollection

var rect = FlxRect.get(Std.parseFloat(texture.att.x), Std.parseFloat(texture.att.y), Std.parseFloat(texture.att.width),
Std.parseFloat(texture.att.height));

var size = if (trimmed)
{
new Rectangle(Std.parseInt(texture.att.frameX), Std.parseInt(texture.att.frameY), Std.parseInt(texture.att.frameWidth),
FlxRect.get(Std.parseInt(texture.att.frameX), Std.parseInt(texture.att.frameY), Std.parseInt(texture.att.frameWidth),
Std.parseInt(texture.att.frameHeight));
}
else
{
new Rectangle(0, 0, rect.width, rect.height);
FlxRect.get(0, 0, rect.width, rect.height);
}


var angle = rotated ? FlxFrameAngle.ANGLE_NEG_90 : FlxFrameAngle.ANGLE_0;

var offset = FlxPoint.get(-size.left, -size.top);
var offset = FlxPoint.get(-size.x, -size.y);
var sourceSize = FlxPoint.get(size.width, size.height);

if (rotated && !trimmed)
sourceSize.set(size.height, size.width);

// Prevents issues caused by adding frames of size 0
if (rect.width == 0 || rect.height == 0)
{
if (!trimmed)
size.setSize(1,1);

var frame = frames.addEmptyFrame(size);

frame.name = name;
frame.offset.copyFrom(offset);

continue;
}

frames.addAtlasFrame(rect, sourceSize, offset, name, angle, flipX, flipY);
}

Expand Down
Loading

0 comments on commit ed33afd

Please sign in to comment.