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 Dec 10, 2024
2 parents 4602462 + 2f1e446 commit 073fa1a
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 24 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ We removed many features and utilities that were previously deprecated
- `FlxAnimationController`: Add `onLoop`, `onFrameChange` and `onFinish`, to replace `callback` and `finishCallback` ([#3205](https://github.com/HaxeFlixel/flixel/pull/3205)) ([#3216](https://github.com/HaxeFlixel/flixel/pull/3216))
- `FlxStrip`: Add support for blendmodes ([#3213](https://github.com/HaxeFlixel/flixel/pull/3213))
- `FlxTextBorderStyle`: Add SHADOW_XY, prevent border clipping ([#3236](https://github.com/HaxeFlixel/flixel/pull/3236))
- `LogStyle`: Add `callback` to replace `callbackFunction` ([#3239](https://github.com/HaxeFlixel/flixel/pull/3239))
- `LogStyle`: Add `onLog` signal to replace `callbackFunction` ([#3239](https://github.com/HaxeFlixel/flixel/pull/3239))([#3307](https://github.com/HaxeFlixel/flixel/pull/3307))
- `FlxBar`: Add custom border sizes ([#3234](https://github.com/HaxeFlixel/flixel/pull/3234))
- Gamepads: Add `acceptMode` and "mapped inputs" ([#3276](https://github.com/HaxeFlixel/flixel/pull/3276)) ([#3280](https://github.com/HaxeFlixel/flixel/pull/3280))
- Add `ACCEPT` and `CANCEL` input IDs that conditionally map to either `A` or `B` depending on `FlxG.gamepads.acceptMode`
Expand Down Expand Up @@ -101,6 +101,7 @@ We removed many features and utilities that were previously deprecated
- Reduce memory of Flixel's embedded assets via oxipng ([#3257](https://github.com/HaxeFlixel/flixel/pull/3257))
- Debug Stats: Improve accuracy of "Total Memory" in OpenFL 9.4.0 ([#3266](https://github.com/HaxeFlixel/flixel/pull/3266))
- `FlxGraphic`: Improve checks for max texture size ([#3279](https://github.com/HaxeFlixel/flixel/pull/3279))
- Debugging: Stop dispatching onFocus event when closing debugger ([#3271](https://github.com/HaxeFlixel/flixel/pull/3271))

#### Bugfixes:
- `FlxFlickerTween`: Fix "Unsupported recursive type" error on hl ([#3170](https://github.com/HaxeFlixel/flixel/pull/3170))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ Thanks to being built on top of [Haxe](https://haxe.org/) and [OpenFL](http://ww

HaxeFlixel has its roots in the original [ActionScript 3 version of Flixel](https://github.com/AdamAtomic/flixel), created by [Adam “Atomic” Saltsman](http://www.adamatomic.com/). It was started by [Alexander Hohlov](https://github.com/beeblerox) in 2011, initially as a straightforward Haxe port of the AS3 codebase and Richard Davey's [Flixel Power Tools](http://www.photonstorm.com/flixel-power-tools).

Thanks to the efforts of the [core team](https://github.com/orgs/HaxeFlixel/people) as well as [over 100 contributors](https://github.com/HaxeFlixel/flixel/graphs/contributors), today's version of HaxeFlixel far surpasses the capabilities of the original. Not only has the core engine seen many substantial improvements and new features, there is also a far richer ecosystem with additional libaries and [over 80 demo projects](https://github.com/HaxeFlixel/flixel-demos) to learn from.
Thanks to the efforts of the [core team](https://github.com/orgs/HaxeFlixel/people) as well as [over 100 contributors](https://github.com/HaxeFlixel/flixel/graphs/contributors), today's version of HaxeFlixel far surpasses the capabilities of the original. Not only has the core engine seen many substantial improvements and new features, there is also a far richer ecosystem with additional libraries and [over 80 demo projects](https://github.com/HaxeFlixel/flixel-demos) to learn from.
2 changes: 1 addition & 1 deletion flixel/graphics/FlxGraphic.hx
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ class FlxGraphic implements IFlxDestroyable

#if FLX_OPENGL_AVAILABLE
var max:Int = FlxG.bitmap.maxTextureSize;
if (max != -1)
if (max > 0)
{
if (width > max || height > max)
FlxG.log.warn('Graphic dimensions (${width}x${height}) exceed the maximum allowed size (${max}x${max}), which may cause rendering issues.');
Expand Down
3 changes: 3 additions & 0 deletions flixel/input/FlxKeyManager.hx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ class FlxKeyManager<Key:Int, KeyList:FlxBaseKeyList> implements IFlxInputManager
*/
public function destroy():Void
{
FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);

_keyListArray = null;
_keyListMap = null;
}
Expand Down
9 changes: 7 additions & 2 deletions flixel/system/debug/log/LogStyle.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package flixel.system.debug.log;

import flixel.util.FlxSignal;

using flixel.util.FlxStringUtil;

/**
Expand Down Expand Up @@ -43,8 +45,10 @@ class LogStyle

/**
* A callback function that is called when this LogStyle is used
* **Note:** Unlike the deprecated `callbackFunction`, this is called every time,
* even when logged with `once = true` and even in release mode.
*/
public var callback:(data:Any)->Void;
public final onLog = new FlxTypedSignal<(data:Any)->Void>();

/**
* Whether an exception is thrown when this LogStyle is used.
Expand Down Expand Up @@ -81,7 +85,8 @@ class LogStyle
this.errorSound = errorSound;
this.openConsole = openConsole;
this.callbackFunction = callbackFunction;
this.callback = callback;
if (callback != null)
onLog.add(callback);
this.throwException = throwException;
}

Expand Down
9 changes: 4 additions & 5 deletions flixel/system/frontEnds/AssetFrontEnd.hx
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@ class AssetFrontEnd
public function new ()
{
final rawPath = '${haxe.macro.Compiler.getDefine("FLX_CUSTOM_ASSETS_DIRECTORY")}';
// Remove final slash and accepts backslashes and removes redundancies
directory = Path.normalize(rawPath);
directory = '${haxe.macro.Compiler.getDefine("FLX_CUSTOM_ASSETS_DIRECTORY_ABS")}';
// Verify valid directory
if (sys.FileSystem.exists(directory) == false)
throw 'Invalid value:"$directory" of FLX_CUSTOM_ASSETS_DIRECTORY, expecting relative or absolute path';
throw 'Error finding custom asset directory:"$directory" from given path: $rawPath';
// remove final "/assets" since the id typically contains it
final split = sys.FileSystem.absolutePath(directory).split("/");
final split = directory.split("/");
split.pop();
parentDirectory = split.join("/");
}
Expand Down Expand Up @@ -284,7 +283,7 @@ class AssetFrontEnd
for (path in sys.FileSystem.readDirectory(directory))
{
if (sys.FileSystem.isDirectory('$directory/$path'))
addFiles('$directory/$path',path + '/');
addFiles('$directory/$path', prefix + path + '/');
else
list.push(prefix + path);
}
Expand Down
2 changes: 0 additions & 2 deletions flixel/system/frontEnds/DebuggerFrontEnd.hx
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ class DebuggerFrontEnd
if (!Value)
{
FlxG.stage.focus = null;
// setting focus to null will trigger a focus lost event, let's undo that
FlxG.game.onFocus(null);

#if FLX_MOUSE
FlxG.mouse.enabled = true;
Expand Down
14 changes: 6 additions & 8 deletions flixel/system/frontEnds/LogFrontEnd.hx
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ class LogFrontEnd
if (style == null)
style = LogStyle.NORMAL;

if (!(data is Array))
data = [data];
final arrayData = (!(data is Array) ? [data] : cast data);

#if FLX_DEBUG
// Check null game since `FlxG.save.bind` may be called before `new FlxGame`
if (FlxG.game == null || FlxG.game.debugger == null)
{
_standardTraceFunction(data);
_standardTraceFunction(arrayData);
}
else if (FlxG.game.debugger.log.add(data, style, fireOnce))
else if (FlxG.game.debugger.log.add(arrayData, style, fireOnce))
{
#if (FLX_SOUND_SYSTEM && !FLX_UNIT_TEST)
if (style.errorSound != null)
Expand All @@ -75,14 +74,13 @@ class LogFrontEnd

if (style.callbackFunction != null)
style.callbackFunction();

if (style.callback != null)
style.callback(data);
}
#end

style.onLog.dispatch(data);

if (style.throwException)
throw style.toLogString(data);
throw style.toLogString(arrayData);
}

/**
Expand Down
11 changes: 7 additions & 4 deletions flixel/system/macros/FlxDefines.hx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package flixel.system.macros;

import haxe.io.Path;
import haxe.macro.Compiler;
import haxe.macro.Context;
import haxe.macro.Expr.Position;
import haxe.io.Path;
#if (flixel_addons >= "3.2.2")
import flixel.addons.system.macros.FlxAddonDefines;
#end
Expand Down Expand Up @@ -98,6 +98,8 @@ private enum HelperDefines
FLX_OPENGL_AVAILABLE;
/** Defined to `1`(or `true`) if `FLX_CUSTOM_ASSETS_DIRECTORY` is not defined */
FLX_STANDARD_ASSETS_DIRECTORY;
/** The normalized, absolute path of `FLX_CUSTOM_ASSETS_DIRECTORY`, used internally */
FLX_CUSTOM_ASSETS_DIRECTORY_ABS;
}

class FlxDefines
Expand Down Expand Up @@ -283,12 +285,13 @@ class FlxDefines
// Todo: check sys targets
final rawDirectory = Path.normalize(definedValue(FLX_CUSTOM_ASSETS_DIRECTORY));
final directory = Path.normalize(rawDirectory);
final absPath = sys.FileSystem.absolutePath(directory);
if (!sys.FileSystem.isDirectory(directory) || directory == "1")
{
final absPath = sys.FileSystem.absolutePath(directory);
abort('FLX_CUSTOM_ASSETS_DIRECTORY must be a path to a directory, got "$rawDirectory"'
+ '\nabsolute path: $absPath', (macro null).pos);
}
define(FLX_CUSTOM_ASSETS_DIRECTORY_ABS, absPath);
}
}
else // define boolean inversion
Expand Down Expand Up @@ -330,9 +333,9 @@ class FlxDefines
return Context.defined(Std.string(define));
}

static inline function define(define:Dynamic)
static inline function define(define:Dynamic, ?value:String)
{
Compiler.define(Std.string(define));
Compiler.define(Std.string(define), value);
}

static function abort(message:String, pos:Position)
Expand Down
17 changes: 17 additions & 0 deletions flixel/util/FlxDirectionFlags.hx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,23 @@ enum abstract FlxDirectionFlags(Int) from Int from FlxDirection to Int
{
return degrees * FlxAngle.TO_RAD;
}

/** Whether this has the `UP` flag **/
public var up(get, never):Bool;
inline function get_up() return has(UP);

/** Whether this has the `DOWN` flag **/
public var down(get, never):Bool;
inline function get_down() return has(DOWN);

/** Whether this has the `LEFT` flag **/
public var left(get, never):Bool;
inline function get_left() return has(LEFT);

/** Whether this has the `RIGHT` flag **/
public var right(get, never):Bool;
inline function get_right() return has(RIGHT);


/**
* Returns true if this contains **all** of the supplied flags.
Expand Down

0 comments on commit 073fa1a

Please sign in to comment.