From 85bff686a4f0905f6768910d51285e1cbc19fc26 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 24 Jun 2021 03:15:14 -0400 Subject: [PATCH] WACKY HTML FILE LOADING TESTS?? --- source/ui/animDebugShit/DebugBoundingState.hx | 56 ++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/source/ui/animDebugShit/DebugBoundingState.hx b/source/ui/animDebugShit/DebugBoundingState.hx index 65737212b..ff5ffb582 100644 --- a/source/ui/animDebugShit/DebugBoundingState.hx +++ b/source/ui/animDebugShit/DebugBoundingState.hx @@ -10,20 +10,29 @@ import flixel.graphics.frames.FlxAtlasFrames; import flixel.graphics.frames.FlxFrame; import flixel.group.FlxGroup; import flixel.math.FlxPoint; +import flixel.system.FlxSound; import flixel.text.FlxText; import flixel.util.FlxColor; import flixel.util.FlxSpriteUtil; +import flixel.util.FlxTimer; +import js.html.FileList; import lime.utils.Assets as LimeAssets; import openfl.Assets; import openfl.events.Event; import openfl.events.IOErrorEvent; import openfl.geom.Rectangle; import openfl.net.FileReference; -import sys.io.File; +import openfl.net.URLLoader; +import openfl.net.URLRequest; +import openfl.utils.ByteArray; using StringTools; using flixel.util.FlxSpriteUtil; +#if sys +import sys.io.File; +#end + class DebugBoundingState extends FlxState { /* @@ -106,6 +115,50 @@ class DebugBoundingState extends FlxState FlxG.stage.window.onDropFile.add(function(path:String) { + // WACKY ASS TESTING SHIT FOR WEB FILE LOADING?? + #if web + var swagList:FileList = cast path; + + var objShit = js.html.URL.createObjectURL(swagList.item(0)); + trace(objShit); + + var funnysound = new FlxSound().loadStream('https://cdn.discordapp.com/attachments/767500676166451231/817821618251759666/Flutter.mp3', false, + false, null, function() + { + trace('LOADED SHIT??'); + }); + + funnysound.volume = 1; + funnysound.play(); + + var urlShit = new URLLoader(new URLRequest(objShit)); + + new FlxTimer().start(3, function(tmr:FlxTimer) + { + // music lol! + if (urlShit.dataFormat == BINARY) + { + // var daSwagBytes:ByteArray = urlShit.data; + + // FlxG.sound.playMusic(); + + // trace('is binary!!'); + } + trace(urlShit.dataFormat); + }); + + // remove(bf); + // FlxG.bitmap.removeByKey(Paths.image('characters/temp')); + // Assets.cache.clear(); + + // bf.loadGraphic(objShit); + // add(bf); + + // trace(swagList.item(0).name); + // var urlShit = js.html.URL.createObjectURL(path); + #end + + #if sys trace("DROPPED FILE FROM: " + Std.string(path)); var newPath = "./" + Paths.image('characters/temp'); File.copy(path, newPath); @@ -119,6 +172,7 @@ class DebugBoundingState extends FlxState bf.loadGraphic(Paths.image('characters/temp')); add(bf); + #end }); }