Skip to content

Commit 4aaa3ba

Browse files
committed
Modify openfl Assets in macro instead
1 parent 606e98c commit 4aaa3ba

File tree

4 files changed

+23
-1079
lines changed

4 files changed

+23
-1079
lines changed

project.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@
222222
<!--<haxedef name="HXCPP_CPP20"/>-->
223223
<!--<haxedef name="HXCPP_CLANG"/>-->
224224
<haxedef name="HXCPP_MSVC"/>
225+
<!-- This seems to causes more harm, but to be fair, its mostly because of text rendering -->
226+
<!-- This is really important to fix honestly, try to get cairo text rendering not memory leak in the future -->
225227
<haxedef name="HXCPP_GC_BIG_BLOCKS"/>
226228
<!--<haxedef name="HXCPP_GC_GENERATIONAL"/>-->
227229
<haxedef name="HXCPP_GC_DYNAMIC_SIZE"/>

source/funkin/backend/shaders/BlendModeEffect.hx

Lines changed: 0 additions & 36 deletions
This file was deleted.

source/funkin/backend/system/macros/Macros.hx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class Macros {
6060
Compiler.addMetadata('@:build($macroPath.buildLimeAssetLibrary())', 'lime.utils.AssetLibrary');
6161
Compiler.addMetadata('@:build($macroPath.buildLimeApplication())', 'lime.app.Application');
6262
Compiler.addMetadata('@:build($macroPath.buildLimeWindow())', 'lime.ui.Window');
63+
Compiler.addMetadata('@:build($macroPath.buildOpenflAssets())', 'openfl.utils.Assets');
6364

6465
//Adds Compat for #if hscript blocks when you have hscript improved
6566
if (Context.defined("hscript_improved") && !Context.defined("hscript")) {
@@ -106,5 +107,25 @@ class Macros {
106107

107108
return fields;
108109
}
110+
111+
public static function buildOpenflAssets():Array<Field> {
112+
final fields:Array<Field> = Context.getBuildFields(), pos:Position = Context.currentPos();
113+
for (f in fields) switch (f.name) {
114+
case "allowCompressedTextures": fields.remove(f);
115+
default:
116+
}
117+
118+
fields.push({name: 'allowCompressedTextures', access: [APublic, AStatic], pos: pos, kind: FProp("get", "set", macro :Null<Bool>), meta: [{pos: pos, name: ":isVar"}]});
119+
120+
fields.push({name: "get_allowCompressedTextures", access: [APublic, AStatic, AInline], pos: pos, kind: FFun({ret: macro :Bool, args: [], expr: macro {
121+
return allowCompressedTextures != null ? allowCompressedTextures : !funkin.backend.system.Main.forceGPUOnlyBitmapsOff && funkin.options.Options.gpuOnlyBitmaps;
122+
}})});
123+
fields.push({name: "set_allowCompressedTextures", access: [APublic, AStatic, AInline], pos: pos, kind: FFun({ret: macro :Bool, args: [{name: "value", type: macro :Bool}], expr: macro {
124+
allowCompressedTextures = value;
125+
return get_allowCompressedTextures();
126+
}})});
127+
128+
return fields;
129+
}
109130
}
110131
#end

0 commit comments

Comments
 (0)