Modify openfl Assets in macro instead
This commit is contained in:
@@ -222,6 +222,8 @@
|
||||
<!--<haxedef name="HXCPP_CPP20"/>-->
|
||||
<!--<haxedef name="HXCPP_CLANG"/>-->
|
||||
<haxedef name="HXCPP_MSVC"/>
|
||||
<!-- This seems to causes more harm, but to be fair, its mostly because of text rendering -->
|
||||
<!-- This is really important to fix honestly, try to get cairo text rendering not memory leak in the future -->
|
||||
<haxedef name="HXCPP_GC_BIG_BLOCKS"/>
|
||||
<!--<haxedef name="HXCPP_GC_GENERATIONAL"/>-->
|
||||
<haxedef name="HXCPP_GC_DYNAMIC_SIZE"/>
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
package funkin.backend.shaders;
|
||||
|
||||
import flixel.util.FlxColor;
|
||||
import openfl.display.ShaderParameter;
|
||||
|
||||
@:dox(hide)
|
||||
typedef BlendModeShader =
|
||||
{
|
||||
var uBlendColor:ShaderParameter<Float>;
|
||||
}
|
||||
|
||||
@:dox(hide)
|
||||
class BlendModeEffect
|
||||
{
|
||||
public var shader(default, null):BlendModeShader;
|
||||
|
||||
@:isVar
|
||||
public var color(default, set):FlxColor;
|
||||
|
||||
public function new(shader:BlendModeShader, color:FlxColor):Void
|
||||
{
|
||||
shader.uBlendColor.value = [];
|
||||
this.shader = shader;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
function set_color(color:FlxColor):FlxColor
|
||||
{
|
||||
shader.uBlendColor.value[0] = color.redFloat;
|
||||
shader.uBlendColor.value[1] = color.greenFloat;
|
||||
shader.uBlendColor.value[2] = color.blueFloat;
|
||||
shader.uBlendColor.value[3] = color.alphaFloat;
|
||||
|
||||
return this.color = color;
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,7 @@ class Macros {
|
||||
Compiler.addMetadata('@:build($macroPath.buildLimeAssetLibrary())', 'lime.utils.AssetLibrary');
|
||||
Compiler.addMetadata('@:build($macroPath.buildLimeApplication())', 'lime.app.Application');
|
||||
Compiler.addMetadata('@:build($macroPath.buildLimeWindow())', 'lime.ui.Window');
|
||||
Compiler.addMetadata('@:build($macroPath.buildOpenflAssets())', 'openfl.utils.Assets');
|
||||
|
||||
//Adds Compat for #if hscript blocks when you have hscript improved
|
||||
if (Context.defined("hscript_improved") && !Context.defined("hscript")) {
|
||||
@@ -106,5 +107,25 @@ class Macros {
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
public static function buildOpenflAssets():Array<Field> {
|
||||
final fields:Array<Field> = Context.getBuildFields(), pos:Position = Context.currentPos();
|
||||
for (f in fields) switch (f.name) {
|
||||
case "allowCompressedTextures": fields.remove(f);
|
||||
default:
|
||||
}
|
||||
|
||||
fields.push({name: 'allowCompressedTextures', access: [APublic, AStatic], pos: pos, kind: FProp("get", "set", macro :Null<Bool>), meta: [{pos: pos, name: ":isVar"}]});
|
||||
|
||||
fields.push({name: "get_allowCompressedTextures", access: [APublic, AStatic, AInline], pos: pos, kind: FFun({ret: macro :Bool, args: [], expr: macro {
|
||||
return allowCompressedTextures != null ? allowCompressedTextures : !funkin.backend.system.Main.forceGPUOnlyBitmapsOff && funkin.options.Options.gpuOnlyBitmaps;
|
||||
}})});
|
||||
fields.push({name: "set_allowCompressedTextures", access: [APublic, AStatic, AInline], pos: pos, kind: FFun({ret: macro :Bool, args: [{name: "value", type: macro :Bool}], expr: macro {
|
||||
allowCompressedTextures = value;
|
||||
return get_allowCompressedTextures();
|
||||
}})});
|
||||
|
||||
return fields;
|
||||
}
|
||||
}
|
||||
#end
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user