Skip to content

Commit

Permalink
add FlxUIDefines, prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
Geokureli committed Mar 10, 2024
1 parent 061d760 commit 4b9926d
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,4 +1,4 @@
2.6.0 (TBD)
2.6.0 (March 10, 2024)
------------------------------

#### New features:
Expand Down
54 changes: 54 additions & 0 deletions flixel/addons/ui/system/macros/FlxUIDefines.hx
@@ -0,0 +1,54 @@
package flixel.addons.ui.system.macros;

#if macro
import haxe.macro.Compiler;
import haxe.macro.Context;
import haxe.macro.Expr.Position;

// private enum UserAddonDefines {}
// private enum HelperAddonDefines {}

/**
* The purpose of these "defines" classes is mainly to properly communicate version compatibility
* among flixel libs, we shouldn't be overly concerned with backwards compatibility, but we do want
* to know when a change breaks compatibility between Flixel-UI and Flixel.
*
* @since 2.6.0
*/
@:allow(flixel.system.macros.FlxDefines)
@:access(flixel.system.macros.FlxDefines)
class FlxUIDefines
{
/**
* Called from `flixel.system.macros.FlxDefines` on versions 5.6.0 or later
*/
public static function run()
{
#if !display
checkCompatibility();
#end
}

static function checkCompatibility()
{
#if (flixel < version("5.3.1"))
FlxDefines.abortVersion("Flixel", "5.3.1 or newer", "flixel", (macro null).pos);
#end
}

static function isValidUserDefine(define:Any)
{
return false;
}

static function abortVersion(dependency:String, supported:String, found:String, pos:Position)
{
abort('Flixel-UI: Unsupported $dependency version! Supported versions are $supported (found ${Context.definedValue(found)}).', pos);
}

static function abort(message:String, pos:Position)
{
Context.fatalError(message, pos);
}
}
#end
4 changes: 2 additions & 2 deletions haxelib.json
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"tags": ["game", "openfl", "flash", "neko", "cpp", "android", "ios", "cross"],
"description": "A UI library for Flixel",
"version": "2.5.0",
"releasenote": "Deprecate haxe 3, Compatibility with flixel 5.0.0.",
"version": "2.6.0",
"releasenote": "Various FlxInputText improvements",
"contributors": ["haxeflixel", "larsiusprime", "Gama11", "GeoKureli"]
}

0 comments on commit 4b9926d

Please sign in to comment.