Fix loopSound

This commit is contained in:
2023-09-14 19:11:59 -06:00
parent 1a2b5b196c
commit 06edab09a4
3 changed files with 27 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
# @install: lix --silent download "gh://github.com/kiss-lang/hollywoo#847f2aea739488f5686e33394e649c6e44e44d8b" into hollywoo/0.0.0/github/847f2aea739488f5686e33394e649c6e44e44d8b
# @run: haxelib run-dir hollywoo "${HAXE_LIBCACHE}/hollywoo/0.0.0/github/847f2aea739488f5686e33394e649c6e44e44d8b"
# @install: lix --silent download "gh://github.com/kiss-lang/hollywoo#9efdacd6d9a1985ba764a2a9477bbefe8b701d2b" into hollywoo/0.0.0/github/9efdacd6d9a1985ba764a2a9477bbefe8b701d2b
# @run: haxelib run-dir hollywoo "${HAXE_LIBCACHE}/hollywoo/0.0.0/github/9efdacd6d9a1985ba764a2a9477bbefe8b701d2b"
-lib kiss
-lib kiss-tools
-cp ${HAXE_LIBCACHE}/hollywoo/0.0.0/github/847f2aea739488f5686e33394e649c6e44e44d8b/src/
-cp ${HAXE_LIBCACHE}/hollywoo/0.0.0/github/9efdacd6d9a1985ba764a2a9477bbefe8b701d2b/src/
-D hollywoo=0.0.0

View File

@@ -43,6 +43,7 @@ import openfl.geom.Point;
import flixel.input.mouse.FlxMouseButton;
import flixel.input.mouse.FlxMouseEventManager;
import flixel.input.gamepad.*;
import hollywoo_flixel.HFlxSound;
@:build(kiss.Kiss.build())
class FlxDirector implements Director<FlxSprite, ActorFlxSprite, FlxSound, FlxSound, FlxSprite, FlxSound, FlxCamera, FlxLightSource> {

View File

@@ -0,0 +1,23 @@
package hollywoo_flixel;
import flixel.sound.FlxSound;
class HFlxSound extends FlxSound {
public function new() {
super();
}
// To accomodate hollywoo's sound looping, onComplete() needs to come AFTER cleanup():
override function stopped(?_) {
if (looped)
{
cleanup(false);
play(false, loopTime, endTime);
}
else
cleanup(autoDestroy);
if (onComplete != null)
onComplete();
}
}