Libraries update

This commit is contained in:
Ralty
2026-03-29 09:06:15 +07:00
parent cf2c3689c5
commit 8fc068e718
17 changed files with 51 additions and 59 deletions
+2 -2
View File
@@ -314,11 +314,11 @@ class Flags {
if (SUSTAINS_AS_ONE_NOTE == null) SUSTAINS_AS_ONE_NOTE = MOD_API_VERSION >= 2;
if (DEFAULT_GLSL_VERSION == null) {
if (MOD_API_VERSION < 2) {
DEFAULT_GLSL_VERSION = "120";
DEFAULT_GLSL_VERSION = #if (android || mac || web) "100" #else "120" #end;
Logs.warn("Blend Mode Extensions won't work in MOD_API_VERSION below than 2");
}
else {
DEFAULT_GLSL_VERSION = openfl.display.Shader.getDefaultGLVersion();
DEFAULT_GLSL_VERSION = openfl.utils.GLSLSourceAssembler.getDefaultVersion();
}
}
}
+4 -5
View File
@@ -8,13 +8,12 @@ class FunkinGame extends FlxGame {
super.switchState();
// draw once to put all images in gpu then put the last update time to now to prevent lag spikes or whatever
draw();
_total = ticks = getTicks();
ticks = getTicks();
skipNextTickUpdate = true;
}
public override function onEnterFrame(t) {
if (skipNextTickUpdate != (skipNextTickUpdate = false))
_total = ticks = getTicks();
super.onEnterFrame(t);
override function __enterFrame(deltaTime:Float) {
if (skipNextTickUpdate != (skipNextTickUpdate = false)) ticks = getTicks();
super.__enterFrame(deltaTime);
}
}
-6
View File
@@ -97,16 +97,10 @@ class Main extends Sprite
// DEPRECATED
@:dox(hide) public static function execAsync(func:Void->Void) ThreadUtil.execAsync(func);
private static function getTimer():Int {
return time = Lib.getTimer();
}
public static function loadGameSettings() {
WindowUtils.init();
SaveWarning.init();
MemoryUtil.init();
@:privateAccess
FlxG.game.getTimer = getTimer;
FunkinCache.init();
Paths.assetsTree = new AssetsLibraryList();
@@ -1,38 +1,14 @@
package funkin.backend.system;
import lime.graphics.Image;
import lime.graphics.cairo.CairoImageSurface;
import openfl.display.BitmapData;
import openfl.geom.Rectangle;
import openfl.utils.BitmapDataUtil;
@:deprecated("Use openfl.utils.BitmapDataUtil.toHardware instead.")
@:deprecated("Use openfl.display.BitmapData.toHardware instead.")
class OptimizedBitmapData extends BitmapData {
@SuppressWarnings("checkstyle:Dynamic")
@:noCompletion private override function __fromImage(image:#if lime Image #else Dynamic #end):Void
{
#if lime
if (image != null && image.buffer != null)
{
this.image = image;
width = image.width;
height = image.height;
rect = new Rectangle(0, 0, image.width, image.height);
__textureWidth = width;
__textureHeight = height;
#if sys
image.format = BGRA32;
image.premultiplied = true;
#end
__isValid = true;
readable = true;
BitmapDataUtil.toHardware(this);
}
#end
super.__fromImage(image);
toHardware();
}
}
@@ -14,7 +14,7 @@ class AssetTreeInfo extends FramerateCategory {
super("Asset Libraries Tree Info");
}
public override function __enterFrame(t:Int) {
public override function __enterFrame(t:Float) {
if (alpha <= 0.05) return;
if ((lastUpdateTime += FlxG.rawElapsed) < 1)
@@ -5,7 +5,7 @@ class ConductorInfo extends FramerateCategory {
super("Conductor Info");
}
public override function __enterFrame(t:Int) {
public override function __enterFrame(t:Float) {
if (alpha <= 0.05) return;
_text = 'Current Song Position: ${Math.floor(Conductor.songPosition * 1000) / 1000}';
_text += '\n - ${Conductor.curBeat} beats';
@@ -7,7 +7,7 @@ class FlixelInfo extends FramerateCategory {
super("Flixel Info");
}
public override function __enterFrame(t:Int) {
public override function __enterFrame(t:Float) {
if (alpha <= 0.05) return;
@@ -100,7 +100,7 @@ class Framerate extends Sprite {
var debugAlpha:Float = 0;
public override function __enterFrame(t:Int) {
public override function __enterFrame(t:Float) {
alpha = CoolUtil.fpsLerp(alpha, debugMode > 0 ? 1 : 0, 0.5);
debugAlpha = CoolUtil.fpsLerp(debugAlpha, debugMode > 1 ? 1 : 0, 0.5);
@@ -42,7 +42,7 @@ class FramerateCategory extends Sprite {
public function reload() {}
public override function __enterFrame(t:Int) {
public override function __enterFrame(t:Float) {
if (alpha <= 0.05) return;
super.__enterFrame(t);
@@ -38,7 +38,7 @@ class FramerateCounter extends Sprite {
lastUpdateTime = 0;
}
public override function __enterFrame(t:Int) {
public override function __enterFrame(t:Float) {
if (alpha <= 0.05) return;
super.__enterFrame(t);
@@ -32,7 +32,7 @@ class MemoryCounter extends Sprite {
public function reload() {}
public override function __enterFrame(t:Int) {
public override function __enterFrame(t:Float) {
if (alpha <= 0.05) return;
super.__enterFrame(t);
@@ -9,7 +9,7 @@ class StatsInfo extends FramerateCategory {
super("Asset Libraries Tree Info");
}
public override function __enterFrame(t:Int) {
public override function __enterFrame(t:Float) {
if (alpha <= 0.05) return;
_text = "totalDC: " + Context3DStats.totalDrawCalls();
_text += "\nstageDC: " + Context3DStats.contextDrawCalls(DrawCallContext.STAGE);
@@ -169,7 +169,7 @@ class SystemInfo extends FramerateCategory {
super("System Info");
}
public override function __enterFrame(t:Int) {
public override function __enterFrame(t:Float) {
if (alpha <= 0.05) return;
_text = __formattedSysText;
+11
View File
@@ -2,6 +2,9 @@ package funkin.editors;
import haxe.io.Path;
import lime.ui.FileDialog;
#if lime_funkin
import lime.ui.FileDialogFilter;
#end
class SaveSubstate extends MusicBeatSubstate {
public var saveOptions:Map<String, Bool>;
@@ -26,6 +29,13 @@ class SaveSubstate extends MusicBeatSubstate {
public override function create() {
super.create();
#if lime_funkin
FileDialog.saveFile(FlxG.stage.window, "Save File", (fileName:String, activeFilter:FileDialogFilter) -> {
CoolUtil.safeSaveFile(fileName, data);
close();
}, [new FileDialogFilter("Specified File Extension", options.saveExt.getDefault(Path.extension(options.defaultSaveFile)))],
options.defaultSaveFile);
#else
var fileDialog = new FileDialog();
fileDialog.onCancel.add(function() close());
fileDialog.onSelect.add(function(str) {
@@ -33,6 +43,7 @@ class SaveSubstate extends MusicBeatSubstate {
close();
});
fileDialog.browse(SAVE, options.saveExt.getDefault(Path.extension(options.defaultSaveFile)), options.defaultSaveFile);
#end
}
public override function update(elapsed:Float) {
+10 -1
View File
@@ -2,6 +2,9 @@ package funkin.editors.ui;
import haxe.io.Bytes;
import lime.ui.FileDialog;
#if lime_funkin
import lime.ui.FileDialogFilter;
#end
class UIFileExplorer extends UISliceSprite {
public var uploadButton:UIButton;
@@ -24,10 +27,16 @@ class UIFileExplorer extends UISliceSprite {
if (onFile != null) this.onFile = onFile;
uploadButton = new UIButton(x + 8, y+ 8, null, function () {
uploadButton = new UIButton(x + 8, y + 8, null, function () {
#if lime_funkin
FileDialog.openFile(FlxG.stage.window, "Open File", (fileNames:Array<String>, activeFilter:FileDialogFilter) -> {
loadFile(fileNames[0]);
}, this.fileType != null ? [new FileDialogFilter("Specified File Extension", this.fileType)] : null);
#else
var fileDialog = new FileDialog();
fileDialog.onSelect.add(loadFile);
fileDialog.browse(OPEN, this.fileType);
#end
}, bWidth - 16, bHeight - 16);
members.push(uploadButton);