Haxe 4.3.x now works!!!
This commit is contained in:
@@ -64,8 +64,7 @@ class Update {
|
||||
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)");
|
||||
+ "\nUsing Haxe 4.3.0 and above is currently not recommended due to lack of testing.");
|
||||
Sys.println('');
|
||||
Sys.println('We recommend downgrading back to 4.2.5.');
|
||||
break;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,127 @@
|
||||
package away3d.materials.methods;
|
||||
|
||||
import away3d.core.managers.Stage3DProxy;
|
||||
import away3d.materials.compilation.ShaderRegisterCache;
|
||||
import away3d.materials.compilation.ShaderRegisterElement;
|
||||
import away3d.textures.Texture2DBase;
|
||||
|
||||
import openfl.display.BlendMode;
|
||||
import openfl.errors.Error;
|
||||
|
||||
/**
|
||||
* LightMapMethod provides a method that allows applying a light map texture to the calculated pixel colour.
|
||||
* It is different from LightMapDiffuseMethod in that the latter only modulates the diffuse shading value rather
|
||||
* than the whole pixel colour.
|
||||
*/
|
||||
class LightMapMethod extends EffectMethodBase
|
||||
{
|
||||
public var blendMode(get, set):BlendMode;
|
||||
public var texture(get, set):Texture2DBase;
|
||||
|
||||
/**
|
||||
* Indicates the light map should be multiplied with the calculated shading result.
|
||||
*/
|
||||
public static inline var MULTIPLY:BlendMode = BlendMode.MULTIPLY;
|
||||
|
||||
/**
|
||||
* Indicates the light map should be added into the calculated shading result.
|
||||
*/
|
||||
public static var ADD:BlendMode = BlendMode.ADD;
|
||||
|
||||
private var _texture:Texture2DBase;
|
||||
|
||||
private var _blendMode:BlendMode;
|
||||
private var _useSecondaryUV:Bool;
|
||||
|
||||
/**
|
||||
* Creates a new LightMapMethod object.
|
||||
* @param texture The texture containing the light map.
|
||||
* @param blendMode The blend mode with which the light map should be applied to the lighting result.
|
||||
* @param useSecondaryUV Indicates whether the secondary UV set should be used to map the light map.
|
||||
*/
|
||||
public function new(texture:Texture2DBase, blendMode:BlendMode = MULTIPLY, useSecondaryUV:Bool = false)
|
||||
{
|
||||
super();
|
||||
_useSecondaryUV = useSecondaryUV;
|
||||
_texture = texture;
|
||||
this.blendMode = blendMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
override private function initVO(vo:MethodVO):Void
|
||||
{
|
||||
vo.needsUV = !_useSecondaryUV;
|
||||
vo.needsSecondaryUV = _useSecondaryUV;
|
||||
}
|
||||
|
||||
/**
|
||||
* The blend mode with which the light map should be applied to the lighting result.
|
||||
*
|
||||
* @see LightMapMethod.ADD
|
||||
* @see LightMapMethod.MULTIPLY
|
||||
*/
|
||||
private function get_blendMode():BlendMode
|
||||
{
|
||||
return _blendMode;
|
||||
}
|
||||
|
||||
private function set_blendMode(value:BlendMode):BlendMode
|
||||
{
|
||||
if (value != ADD && value != MULTIPLY)
|
||||
throw new Error("Unknown blendmode!");
|
||||
if (_blendMode == value)
|
||||
return value;
|
||||
_blendMode = value;
|
||||
invalidateShaderProgram();
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The texture containing the light map.
|
||||
*/
|
||||
private function get_texture():Texture2DBase
|
||||
{
|
||||
return _texture;
|
||||
}
|
||||
|
||||
private function set_texture(value:Texture2DBase):Texture2DBase
|
||||
{
|
||||
if (value.hasMipMaps != _texture.hasMipMaps || value.format != _texture.format)
|
||||
invalidateShaderProgram();
|
||||
_texture = value;
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
override private function activate(vo:MethodVO, stage3DProxy:Stage3DProxy):Void
|
||||
{
|
||||
stage3DProxy._context3D.setTextureAt(vo.texturesIndex, _texture.getTextureForStage3D(stage3DProxy));
|
||||
super.activate(vo, stage3DProxy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
override private function getFragmentCode(vo:MethodVO, regCache:ShaderRegisterCache, targetReg:ShaderRegisterElement):String
|
||||
{
|
||||
var code:String;
|
||||
var lightMapReg:ShaderRegisterElement = regCache.getFreeTextureReg();
|
||||
var temp:ShaderRegisterElement = regCache.getFreeFragmentVectorTemp();
|
||||
vo.texturesIndex = lightMapReg.index;
|
||||
|
||||
code = getTex2DSampleCode(vo, temp, lightMapReg, _texture, _useSecondaryUV? _sharedRegisters.secondaryUVVarying : _sharedRegisters.uvVarying);
|
||||
|
||||
switch (_blendMode) {
|
||||
case BlendMode.MULTIPLY:
|
||||
code += "mul " + targetReg + ", " + targetReg + ", " + temp + "\n";
|
||||
case BlendMode.ADD:
|
||||
code += "add " + targetReg + ", " + targetReg + ", " + temp + "\n";
|
||||
default:
|
||||
}
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ class ModdableAssetsFolder extends ModsFolderLibrary {
|
||||
return super.exists(id, type);
|
||||
}
|
||||
|
||||
public override function getAsset(id:String, type:String) {
|
||||
public override function getAsset(id:String, type:String):Dynamic {
|
||||
if (!id.startsWith("assets/")) {
|
||||
var possibleReplacement = getAsset('assets/$id', type);
|
||||
if (possibleReplacement != null)
|
||||
|
||||
@@ -6,7 +6,7 @@ class NewHaxeWarning {
|
||||
#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("Compiling with Haxe 4.3.0 isnt fully recommended yet, but it does work.");
|
||||
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("====================");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package funkin.backend.utils.native;
|
||||
|
||||
import funkin.backend.utils.NativeAPI.MessageBoxIcon;
|
||||
#if windows
|
||||
import funkin.backend.utils.NativeAPI.MessageBoxIcon;
|
||||
@:buildXml('
|
||||
<target id="haxe">
|
||||
<lib name="dwmapi.lib" if="windows" />
|
||||
@@ -12,7 +12,7 @@ import funkin.backend.utils.NativeAPI.MessageBoxIcon;
|
||||
</target>
|
||||
')
|
||||
|
||||
// majority is taken from microsofts doc
|
||||
// majority is taken from microsofts doc
|
||||
@:cppFileCode('
|
||||
#include "mmdeviceapi.h"
|
||||
#include "combaseapi.h"
|
||||
@@ -36,7 +36,7 @@ static long lastDefId = 0;
|
||||
class AudioFixClient : public IMMNotificationClient {
|
||||
LONG _cRef;
|
||||
IMMDeviceEnumerator *_pEnumerator;
|
||||
|
||||
|
||||
public:
|
||||
AudioFixClient() :
|
||||
_cRef(1),
|
||||
@@ -153,9 +153,9 @@ class Windows {
|
||||
public static function allocConsole() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@:functionCode('
|
||||
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
SetConsoleTextAttribute(console, color);
|
||||
')
|
||||
public static function setConsoleColors(color:Int) {
|
||||
@@ -175,7 +175,7 @@ class Windows {
|
||||
MessageBox(GetActiveWindow(), message, caption, icon | MB_SETFOREGROUND);
|
||||
')
|
||||
public static function showMessageBox(caption:String, message:String, icon:MessageBoxIcon = MSG_WARNING) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
|
||||
@@ -108,7 +108,7 @@ class NativeWindow
|
||||
#if (!macro && lime_cffi)
|
||||
handle = NativeCFFI.lime_window_create(parent.application.__backend.handle, width, height, flags, title);
|
||||
|
||||
#if DARK_MODE_WINDOW
|
||||
#if (DARK_MODE_WINDOW && !macro)
|
||||
funkin.backend.utils.NativeAPI.setDarkMode(title, true);
|
||||
#end
|
||||
|
||||
|
||||
@@ -533,7 +533,7 @@ class System
|
||||
@:noCompletion private static function __registerEntryPoint(projectName:String, entryPoint:Function):Void
|
||||
{
|
||||
// executes first!!
|
||||
#if sys
|
||||
#if (sys && !macro)
|
||||
funkin.backend.utils.NativeAPI.registerAsDPICompatible();
|
||||
funkin.backend.system.CommandLineHandler.parseCommandLine(Sys.args());
|
||||
#end
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package lime.utils;
|
||||
|
||||
import haxe.PosInfos;
|
||||
#if !macro
|
||||
import funkin.backend.system.Logs as FunkinLogs;
|
||||
#end
|
||||
|
||||
#if !lime_debug
|
||||
@:fileXml('tags="haxe,release"')
|
||||
@@ -30,14 +32,23 @@ class Log
|
||||
{
|
||||
var message = '[${info.className}] $message';
|
||||
|
||||
#if !macro
|
||||
FunkinLogs.trace(message, ERROR, RED);
|
||||
#else
|
||||
trace(message);
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
public static function info(message:Dynamic, ?info:PosInfos):Void
|
||||
{
|
||||
if (level >= LogLevel.INFO)
|
||||
if (level >= LogLevel.INFO) {
|
||||
#if !macro
|
||||
FunkinLogs.trace('[${info.className}] $message', INFO, RED);
|
||||
#else
|
||||
trace('[${info.className}] $message');
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
public static inline function print(message:Dynamic):Void
|
||||
@@ -68,15 +79,24 @@ class Log
|
||||
|
||||
public static function verbose(message:Dynamic, ?info:PosInfos):Void
|
||||
{
|
||||
if (level >= LogLevel.VERBOSE)
|
||||
if (level >= LogLevel.VERBOSE) {
|
||||
#if !macro
|
||||
FunkinLogs.trace('[${info.className}] $message', VERBOSE);
|
||||
#else
|
||||
trace('[${info.className}] $message');
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
public static function warn(message:Dynamic, ?info:PosInfos):Void
|
||||
{
|
||||
if (level >= LogLevel.WARN)
|
||||
{
|
||||
#if !macro
|
||||
FunkinLogs.trace('[${info.className}] $message', WARNING, YELLOW);
|
||||
#else
|
||||
trace('[${info.className}] $message');
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -636,10 +636,12 @@ class Sound extends EventDispatcher
|
||||
return null;
|
||||
}
|
||||
|
||||
#if !macro
|
||||
if (changeID < funkin.backend.system.Main.changeID) {
|
||||
changeID = funkin.backend.system.Main.changeID;
|
||||
regen();
|
||||
}
|
||||
#end
|
||||
|
||||
if (sndTransform == null)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package openfl.utils;
|
||||
|
||||
#if !macro
|
||||
import funkin.backend.system.Main;
|
||||
import funkin.options.Options;
|
||||
import funkin.backend.system.OptimizedBitmapData;
|
||||
#end
|
||||
import openfl.utils._internal.Log;
|
||||
import openfl.display.BitmapData;
|
||||
import openfl.display.MovieClip;
|
||||
@@ -113,10 +115,10 @@ class Assets
|
||||
var bitmapData = image.src;
|
||||
#else
|
||||
var bitmapData:BitmapData = null;
|
||||
if (pushToGPU && !Main.forceGPUOnlyBitmapsOff && Options.gpuOnlyBitmaps) {
|
||||
#if !macro if (pushToGPU && !Main.forceGPUOnlyBitmapsOff && Options.gpuOnlyBitmaps) {
|
||||
bitmapData = new OptimizedBitmapData(0, 0, true, 0);
|
||||
bitmapData.__fromImage(image);
|
||||
} else {
|
||||
} else #end {
|
||||
bitmapData = BitmapData.fromImage(image);
|
||||
}
|
||||
#end
|
||||
@@ -497,10 +499,10 @@ class Assets
|
||||
var bitmapData = image.src;
|
||||
#else
|
||||
var bitmapData:BitmapData = null;
|
||||
if (!Main.forceGPUOnlyBitmapsOff && Options.gpuOnlyBitmaps) {
|
||||
#if !macro if (!Main.forceGPUOnlyBitmapsOff && Options.gpuOnlyBitmaps) {
|
||||
bitmapData = new OptimizedBitmapData(0, 0, true, 0);
|
||||
bitmapData.__fromImage(image);
|
||||
} else {
|
||||
} else #end {
|
||||
bitmapData = BitmapData.fromImage(image);
|
||||
}
|
||||
#end
|
||||
|
||||
Reference in New Issue
Block a user