haxe warnings since it doesnt work with 4.3.0

This commit is contained in:
Yoshman29
2023-04-17 15:09:18 +02:00
parent 11339cb3cd
commit 33f0bc70eb
4 changed files with 51 additions and 5 deletions
+5 -2
View File
@@ -68,6 +68,8 @@
<!-- ______________________________ Haxedefines _____________________________ -->
<haxeflag name="--macro" value="funkin.system.macros.NewHaxeWarning.warn()" />
<!--Enable the Flixel core recording system-->
<!--<haxedef name="FLX_RECORD" />-->
@@ -156,14 +158,15 @@
<haxedef name="openfl_dpi_aware" if="openfl_dpi_aware" />
<!-- _______________________________ Libraries ______________________________ -->
<haxelib name="flixel" />
<haxelib name="flixel-addons" />
<haxelib name="hxCodec" if="VIDEO_CUTSCENES" />
<haxelib name="away3d" />
<haxelib name="format" />
<haxelib name="flxanimate" />
<haxelib name="flixel" />
<haxelib name="flixel-addons" />
<haxedev set='webgl' />
<haxelib name="hscript-improved" />
+2 -2
View File
@@ -172,8 +172,8 @@ class Paths
* @param library (Additional) library to load the frames from.
*/
public static function getFrames(key:String, assetsPath:Bool = false, ?library:String) {
if (tempFramesCache.exists(key)) {
if (tempFramesCache[key].parent.bitmap.readable)
if (tempFramesCache[key] != null) {
if (tempFramesCache[key].parent != null && tempFramesCache[key].parent.bitmap != null && tempFramesCache[key].parent.bitmap.readable)
return tempFramesCache[key];
else
tempFramesCache[key] = null;
@@ -0,0 +1,16 @@
package funkin.system.macros;
#if macro
class NewHaxeWarning {
public static function warn() {
#if (haxe >= "4.3.0")
Sys.println("====================");
Sys.println("[ WARNING ]");
Sys.println("Compiling with Haxe 4.3.0 or above CAN and WILL end up in compilation errors due to changes in macros.");
Sys.println("We recommend building the project using Haxe 4.2.5.");
Sys.println("You can download it here -> https://haxe.org/download/version/4.2.5/");
Sys.println("====================");
#end
}
}
#end
+28 -1
View File
@@ -1,5 +1,6 @@
import haxe.Json;
import sys.io.File;
import sys.io.Process;
import sys.FileSystem;
class Update {
@@ -26,11 +27,37 @@ class Update {
prettyPrint('Cannot resolve library of type "${lib.type}"');
}
}
var proc = new Process('haxe --version');
proc.exitCode(true);
var haxeVer = proc.stdout.readLine();
if (haxeVer != "4.2.5") {
// check for outdated haxe
var curHaxeVer = [for(v in haxeVer.split(".")) Std.parseInt(v)];
var requiredHaxeVer = [4, 2, 5];
for(i in 0...requiredHaxeVer.length) {
if (curHaxeVer[i] < requiredHaxeVer[i]) {
prettyPrint("!! WARNING !!");
Sys.println("Your current Haxe version is outdated.");
Sys.println('You\'re using ${haxeVer}, while the required version is 4.2.5.');
Sys.println('The engine may not compile with your current version of Haxe.');
Sys.println('We recommend upgrading to 4.2.5');
break;
} else if (curHaxeVer[i] > requiredHaxeVer[i]) {
prettyPrint("!! WARNING !!"
+ "\nHaxeFlixel has incompability issues with the latest version of Haxe, 4.3.0 and above, due to macros."
+ "\nProceeding will cause compilation issues related to macros (ex: cannot access flash package in macro)");
Sys.println('');
Sys.println('We recommend downgrading back to 4.2.5.');
break;
}
}
}
}
public static function prettyPrint(text:String) {
var header = "══════";
for(i in 0...text.length)
for(i in 0...(text.length-(text.lastIndexOf("\n")+1)))
header += "═";
Sys.println("");
Sys.println('╔$header╗');