HTML5 stuff
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
package funkin;
|
||||
|
||||
@:dox(hide)
|
||||
typedef SingleOrFloat = #if (java || hl || cpp) Single #else Float #end;
|
||||
@@ -29,8 +29,13 @@ class AudioAnalyzer {
|
||||
|
||||
var maxByte:Int = 0;
|
||||
for(i in 0...Math.floor((bytesEndPos - bytesStartPos) / buffer.bitsPerSample)) {
|
||||
#if js
|
||||
var byte:Int = buffer.data[bytesStartPos + (i * buffer.bitsPerSample)]
|
||||
| (buffer.data[bytesStartPos + (i * buffer.bitsPerSample) + 1] << 8);
|
||||
#else
|
||||
var byte:Int = buffer.data.buffer.get(bytesStartPos + (i * buffer.bitsPerSample))
|
||||
| (buffer.data.buffer.get(bytesStartPos + (i * buffer.bitsPerSample) + 1) << 8);
|
||||
#end
|
||||
if (byte > 256 * 128) byte -= 256 * 256;
|
||||
if (maxByte < byte) maxByte = byte;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ class CoolUtil
|
||||
if(result.isNothing) Logs.trace('The file where it has been tried to get the attributes from, might be corrupted or inexistent (code: ${result.getValue()})', WARNING);
|
||||
return result;
|
||||
#else
|
||||
return 0;
|
||||
return new FileAttributeWrapper(0);
|
||||
#end
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class SaveWarning {
|
||||
if (closingWindow) WindowUtils.resetClosing();
|
||||
} else {
|
||||
WindowUtils.preventClosing = false; WindowUtils.resetClosing();
|
||||
Sys.exit(0);
|
||||
openfl.system.System.exit(0);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -51,7 +51,7 @@ class SaveWarning {
|
||||
if (closingWindow) WindowUtils.resetClosing();
|
||||
} else {
|
||||
WindowUtils.preventClosing = false; WindowUtils.resetClosing();
|
||||
Sys.exit(0);
|
||||
openfl.system.System.exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,16 +34,20 @@ class CharterSelection extends EditorTreeMenu {
|
||||
FlxG.switchState(new Charter(s.name, d));
|
||||
})
|
||||
];
|
||||
#if sys
|
||||
list.push(new NewOption("New Difficulty", "New Difficulty", function() {
|
||||
FlxG.state.openSubState(new ChartCreationScreen(saveChart));
|
||||
}));
|
||||
#end
|
||||
optionsTree.add(new OptionsScreen(s.name, "Select a difficulty to continue.", list));
|
||||
}, s.parsedColor.getDefault(0xFFFFFFFF))
|
||||
];
|
||||
|
||||
#if sys
|
||||
list.insert(0, new NewOption("New Song", "New Song", function() {
|
||||
FlxG.state.openSubState(new SongCreationScreen(saveSong));
|
||||
}));
|
||||
#end
|
||||
|
||||
main = new OptionsScreen("Chart Editor", "Select a song to modify the charts from.", list);
|
||||
|
||||
@@ -88,6 +92,7 @@ class CharterSelection extends EditorTreeMenu {
|
||||
}
|
||||
}
|
||||
|
||||
#if sys
|
||||
public function saveSong(creation:SongCreationData) {
|
||||
var songAlreadyExists:Bool = [for (s in freeplayList.songs) s.name.toLowerCase()].contains(creation.meta.name.toLowerCase());
|
||||
|
||||
@@ -163,4 +168,5 @@ class CharterSelection extends EditorTreeMenu {
|
||||
CoolUtil.safeSaveFile('$songFolder/meta.json', Json.stringify(meta));
|
||||
}
|
||||
}
|
||||
#end
|
||||
}
|
||||
@@ -191,7 +191,7 @@ class Note extends FlxSprite
|
||||
}
|
||||
|
||||
public var lastScrollSpeed:Null<Float> = null;
|
||||
public var gapFix:Single = 0;
|
||||
public var gapFix:SingleOrFloat = 0;
|
||||
public var useAntialiasingFix(get, set):Bool;
|
||||
inline function set_useAntialiasingFix(v:Bool) {
|
||||
if(v != useAntialiasingFix) {
|
||||
|
||||
@@ -1224,7 +1224,7 @@ class PlayState extends MusicBeatState
|
||||
if (SaveWarning.selectionClass != null) FlxG.switchState(Type.createInstance(SaveWarning.selectionClass, []));
|
||||
} else {
|
||||
WindowUtils.preventClosing = false; WindowUtils.resetClosing();
|
||||
Sys.exit(0);
|
||||
openfl.system.System.exit(0);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1237,7 +1237,7 @@ class PlayState extends MusicBeatState
|
||||
if (SaveWarning.selectionClass != null) FlxG.switchState(Type.createInstance(SaveWarning.selectionClass, []));
|
||||
} else {
|
||||
WindowUtils.preventClosing = false; WindowUtils.resetClosing();
|
||||
Sys.exit(0);
|
||||
openfl.system.System.exit(0);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -23,6 +23,7 @@ import flixel.tweens.FlxEase;
|
||||
import flixel.util.FlxDestroyUtil;
|
||||
|
||||
import funkin.backend.system.Flags;
|
||||
import funkin.Types;
|
||||
|
||||
import funkin.menus.ui.Alphabet;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
|
||||
@@ -52,7 +52,9 @@ class Alphabet extends FlxSpriteGroup
|
||||
public function refreshAlphabetXML(path:String) {
|
||||
AlphaCharacter.__alphaPath = Paths.getAssetsRoot() + path;
|
||||
try {
|
||||
var xml = new Access(Xml.parse(Assets.getText(path)).firstElement());
|
||||
var file = Assets.getText(path);
|
||||
if(file == null) return;
|
||||
var xml = new Access(Xml.parse(file).firstElement());
|
||||
AlphaCharacter.boldAnims = [];
|
||||
AlphaCharacter.letterAnims = [];
|
||||
AlphaCharacter.boldAlphabetPath = AlphaCharacter.letterAlphabetPath = 'ui/alphabet';
|
||||
|
||||
@@ -49,7 +49,21 @@ class GithubUserIcon extends FlxSprite
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
#if target.threaded
|
||||
final mutex = new sys.thread.Mutex();
|
||||
#end
|
||||
|
||||
inline function acquireMutex() {
|
||||
#if target.threaded
|
||||
mutex.acquire();
|
||||
#end
|
||||
}
|
||||
inline function releaseMutex() {
|
||||
#if target.threaded
|
||||
mutex.release();
|
||||
#end
|
||||
}
|
||||
|
||||
override function drawComplex(camera:FlxCamera):Void { // Making the image download only if the player actually sees it on the screen - Nex
|
||||
if(waitUntilLoad <= 0) {
|
||||
waitUntilLoad = null;
|
||||
@@ -82,19 +96,19 @@ class GithubUserIcon extends FlxSprite
|
||||
}
|
||||
|
||||
if(bmap != null) try {
|
||||
mutex.acquire(); // Avoiding critical section - Nex
|
||||
acquireMutex(); // Avoiding critical section - Nex
|
||||
var leGraphic:FlxGraphic = FlxG.bitmap.add(bmap, false, key);
|
||||
leGraphic.persist = true;
|
||||
updateDaFunni(leGraphic);
|
||||
bmap = null;
|
||||
mutex.release();
|
||||
releaseMutex();
|
||||
} catch(e) {
|
||||
Logs.traceColored([Logs.logText('Failed to update the pfp for ${user.login}: ${e.message}', RED)], ERROR);
|
||||
}
|
||||
} else {
|
||||
mutex.acquire();
|
||||
acquireMutex();
|
||||
updateDaFunni(bmap);
|
||||
mutex.release();
|
||||
releaseMutex();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user