diff --git a/Project.xml b/Project.xml index 0a9c0559..1810d380 100644 --- a/Project.xml +++ b/Project.xml @@ -143,8 +143,7 @@ - - + diff --git a/source/flx3d/Flx3DCamera.hx b/source/flx3d/Flx3DCamera.hx index 77741aed..2ecfbf85 100644 --- a/source/flx3d/Flx3DCamera.hx +++ b/source/flx3d/Flx3DCamera.hx @@ -77,7 +77,7 @@ class Flx3DCamera extends FlxCamera { var material:TextureMaterial = null; if (texturePath != null) - material = new TextureMaterial(Cast.bitmapTexture(texturePath), smoothTexture); + material = new TextureMaterial(Cast.bitmapTexture(Assets.getBitmapData(texturePath, true, false)), smoothTexture); return loadData(model, context, switch(Path.extension(assetPath).toLowerCase()) { case "dae": new DAEParser(); diff --git a/source/flx3d/Flx3DView.hx b/source/flx3d/Flx3DView.hx index f1befa7f..1a24ce42 100644 --- a/source/flx3d/Flx3DView.hx +++ b/source/flx3d/Flx3DView.hx @@ -52,7 +52,7 @@ class Flx3DView extends FlxView3D { var material:TextureMaterial = null; if (texturePath != null) - material = new TextureMaterial(Cast.bitmapTexture(texturePath), smoothTexture); + material = new TextureMaterial(Cast.bitmapTexture(Assets.getBitmapData(texturePath, true, false)), smoothTexture); return loadData(model, context, switch(Path.extension(assetPath).toLowerCase()) { case "dae": new DAEParser(); diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 70dd9b67..86d950dc 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1044,7 +1044,7 @@ class PlayState extends MusicBeatState // accuracyTxt.addFormat(accFormat, accuracyTxt.text.length - rating.rating.length, accuracyTxt.text.length); - if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause) + if (controls.PAUSE && startedCountdown && canPause) pauseGame(); if (canAccessDebugMenus) { diff --git a/source/funkin/macros/StdDeprecationsRemover.hx b/source/funkin/macros/StdDeprecationsRemover.hx deleted file mode 100644 index f2ed753e..00000000 --- a/source/funkin/macros/StdDeprecationsRemover.hx +++ /dev/null @@ -1,31 +0,0 @@ -package funkin.macros; - -#if macro -import haxe.macro.Expr; -import haxe.macro.Context; -import haxe.macro.Compiler; - -/** - * Removes all deprecations errors related to `Std.is` - * Written by Yoshman29 to keep you sane. - * Feel free to use this macro on your mod. - * - * Line to add in project.xml: - * `` - */ -class StdDeprecationsRemover { - public static function init() { - Compiler.addGlobalMetadata('Std', '@:build(funkin.macros.StdDeprecationsRemover.build())'); - } - - public static function build():Array { - var fields:Array = Context.getBuildFields(); - - for(f in fields) - if (f.name == "is") - f.meta = [for(e in f.meta) if (e.name != ":deprecated") e]; - - return fields; - } -} -#end \ No newline at end of file diff --git a/source/funkin/mods/ModsFolder.hx b/source/funkin/mods/ModsFolder.hx index be212b94..b9da810e 100644 --- a/source/funkin/mods/ModsFolder.hx +++ b/source/funkin/mods/ModsFolder.hx @@ -10,6 +10,9 @@ import openfl.utils.AssetLibrary; import flixel.graphics.FlxGraphic; import flixel.util.FlxSignal.FlxTypedSignal; +import lime.text.Font; +import openfl.text.Font as OpenFLFont; + #if MOD_SUPPORT import sys.FileSystem; #end @@ -91,6 +94,14 @@ class ModsFolder { return AssetLibrary.fromManifest(assets); } + public static function registerFont(font:Font) { + var openflFont = new OpenFLFont(); + @:privateAccess + openflFont.__fromLimeFont(font); + OpenFLFont.registerFont(openflFont); + return font; + } + public static function prepareModLibrary(libName:String, lib:ModsAssetLibrary, force:Bool = false) { var openLib = prepareLibrary(libName, force); lib.prefix = 'assets/'; diff --git a/source/funkin/mods/ModsFolderLibrary.hx b/source/funkin/mods/ModsFolderLibrary.hx index 977b97ab..843afb65 100644 --- a/source/funkin/mods/ModsFolderLibrary.hx +++ b/source/funkin/mods/ModsFolderLibrary.hx @@ -60,8 +60,7 @@ class ModsFolderLibrary extends AssetLibrary implements ModsAssetLibrary { return null; var path = getAssetPath(); editedTimes[id] = FileSystem.stat(path).mtime.getTime(); - var e = Font.fromFile(path); - return e; + return ModsFolder.registerFont(Font.fromFile(path)); } public override function getImage(id:String):Image { diff --git a/source/funkin/mods/ZipFolderLibrary.hx b/source/funkin/mods/ZipFolderLibrary.hx index 79413515..ffef98cc 100644 --- a/source/funkin/mods/ZipFolderLibrary.hx +++ b/source/funkin/mods/ZipFolderLibrary.hx @@ -58,14 +58,7 @@ class ZipFolderLibrary extends AssetLibrary implements ModsAssetLibrary { } public override function getFont(id:String):Font { __parseAsset(id); - var font = Font.fromBytes(unzip(assets[_parsedAsset])); - - var openflFont = new OpenFLFont(); - @:privateAccess - openflFont.__fromLimeFont(font); - OpenFLFont.registerFont(openflFont); - - return font; + return ModsFolder.registerFont(Font.fromBytes(unzip(assets[_parsedAsset]))); } public override function getImage(id:String):Image { __parseAsset(id); diff --git a/source/openfl/utils/Assets.hx b/source/openfl/utils/Assets.hx index 328cb4c1..a44c816f 100644 --- a/source/openfl/utils/Assets.hx +++ b/source/openfl/utils/Assets.hx @@ -88,16 +88,17 @@ class Assets @usage var bitmap = new Bitmap (Assets.getBitmapData ("image.png")); @param id The ID or asset path for the bitmap @param useCache (Optional) Whether to allow use of the asset cache (Default: true) + @param useCache Whenever the image should be immediately pushed to GPU. @return A new BitmapData object **/ - public static function getBitmapData(id:String, useCache:Bool = true):BitmapData + public static function getBitmapData(id:String, useCache:Bool = true, pushToGPU:Bool = true):BitmapData { #if (lime && tools && !display) if (useCache && cache.enabled && cache.hasBitmapData(id)) { var bitmapData = cache.getBitmapData(id); - if (isValidBitmapData(bitmapData)) + if (isValidBitmapData(bitmapData) && (pushToGPU || bitmapData.readable)) { return bitmapData; } @@ -111,7 +112,7 @@ class Assets var bitmapData = image.src; #else var bitmapData:BitmapData = null; - if (!Main.forceGPUOnlyBitmapsOff && Options.gpuOnlyBitmaps) { + if (pushToGPU && !Main.forceGPUOnlyBitmapsOff && Options.gpuOnlyBitmaps) { bitmapData = new OptimizedBitmapData(0, 0, true, 0); bitmapData.__fromImage(image); } else {