From 6fddff22ae7f43905aa9984ffed560dfb0ca8fc9 Mon Sep 17 00:00:00 2001 From: Yanrishatum Date: Mon, 22 Apr 2024 09:11:49 +0300 Subject: [PATCH] Add heaps_disable_res_completion compilation flag --- hxd/Res.hx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hxd/Res.hx b/hxd/Res.hx index 486bdd9a9..80d5d7bdf 100644 --- a/hxd/Res.hx +++ b/hxd/Res.hx @@ -1,6 +1,6 @@ package hxd; -#if !macro +#if (!macro && !heaps_disable_res_completion) @:build(hxd.res.FileTree.build()) #end class Res { @@ -9,6 +9,19 @@ class Res { public static function load(name:String) { return loader.load(name); } + + #if heaps_disable_res_completion + public static var loader( get, set ): hxd.res.Loader; + static function get_loader() { + var l = hxd.res.Loader.currentInstance; + if( l == null ) throw "Resource loader not initialized: call to hxd.Res.initXXX() required"; + return l; + } + static function set_loader(l) { + return hxd.res.Loader.currentInstance = l; + } + #end + #end public static macro function initEmbed(?options:haxe.macro.Expr.ExprOf) {