use FlxSound for Song instead of String
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# @install: lix --silent download "gh://github.com/kiss-lang/hollywoo#642996a85542eecab45e0c3b81e56e3a2ca6a8a8" into hollywoo/0.0.0/github/642996a85542eecab45e0c3b81e56e3a2ca6a8a8
|
# @install: lix --silent download "gh://github.com/kiss-lang/hollywoo#c2a778da2d98498528715bab2628ccecab495595" into hollywoo/0.0.0/github/c2a778da2d98498528715bab2628ccecab495595
|
||||||
# @run: haxelib run-dir hollywoo "${HAXE_LIBCACHE}/hollywoo/0.0.0/github/642996a85542eecab45e0c3b81e56e3a2ca6a8a8"
|
# @run: haxelib run-dir hollywoo "${HAXE_LIBCACHE}/hollywoo/0.0.0/github/c2a778da2d98498528715bab2628ccecab495595"
|
||||||
-lib kiss
|
-lib kiss
|
||||||
-lib kiss-tools
|
-lib kiss-tools
|
||||||
-cp ${HAXE_LIBCACHE}/hollywoo/0.0.0/github/642996a85542eecab45e0c3b81e56e3a2ca6a8a8/src/
|
-cp ${HAXE_LIBCACHE}/hollywoo/0.0.0/github/c2a778da2d98498528715bab2628ccecab495595/src/
|
||||||
-D hollywoo=0.0.0
|
-D hollywoo=0.0.0
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
# @install: lix --silent download "gh://github.com/kiss-lang/kiss#f41719122067499f60397353bd315c18740f5324" into kiss/0.0.1/github/f41719122067499f60397353bd315c18740f5324
|
# @install: lix --silent download "gh://github.com/kiss-lang/kiss#9e916a482393c4aa45dfce0e63b4c53403d66238" into kiss/0.0.1/github/9e916a482393c4aa45dfce0e63b4c53403d66238
|
||||||
# @run: haxelib run-dir kiss "${HAXE_LIBCACHE}/kiss/0.0.1/github/f41719122067499f60397353bd315c18740f5324"
|
# @run: haxelib run-dir kiss "${HAXE_LIBCACHE}/kiss/0.0.1/github/9e916a482393c4aa45dfce0e63b4c53403d66238"
|
||||||
-lib haxe-strings
|
-lib haxe-strings
|
||||||
-lib hscript
|
-lib hscript
|
||||||
-lib tink_json
|
-lib tink_json
|
||||||
-lib tink_macro
|
-lib tink_macro
|
||||||
-lib tink_syntaxhub
|
-lib tink_syntaxhub
|
||||||
-lib uuid
|
-lib uuid
|
||||||
-cp ${HAXE_LIBCACHE}/kiss/0.0.1/github/f41719122067499f60397353bd315c18740f5324/src
|
-cp ${HAXE_LIBCACHE}/kiss/0.0.1/github/9e916a482393c4aa45dfce0e63b4c53403d66238/src
|
||||||
-D kiss=0.0.1
|
-D kiss=0.0.1
|
||||||
-w -WUnusedPattern
|
-w -WUnusedPattern
|
||||||
--macro kiss.KissFrontend.use()
|
--macro kiss.KissFrontend.use()
|
||||||
@@ -38,7 +38,7 @@ import openfl.geom.Point;
|
|||||||
import flixel.input.mouse.FlxMouseEventManager;
|
import flixel.input.mouse.FlxMouseEventManager;
|
||||||
|
|
||||||
@:build(kiss.Kiss.build())
|
@:build(kiss.Kiss.build())
|
||||||
class FlxDirector implements Director<FlxSprite, ActorFlxSprite, FlxSound, String, FlxSprite, FlxSound, FlxCamera, FlxLightSource> {
|
class FlxDirector implements Director<FlxSprite, ActorFlxSprite, FlxSound, FlxSound, FlxSprite, FlxSound, FlxCamera, FlxLightSource> {
|
||||||
public static function blackAlphaMaskFlxSprite(sprite:FlxSprite, mask:FlxSprite, output:FlxSprite):FlxSprite
|
public static function blackAlphaMaskFlxSprite(sprite:FlxSprite, mask:FlxSprite, output:FlxSprite):FlxSprite
|
||||||
{
|
{
|
||||||
sprite.drawFrame();
|
sprite.drawFrame();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
(prop :FlxActionDigital continueAction)
|
(prop :FlxActionDigital continueAction)
|
||||||
(prop :FlxActionDigital fastForwardAction)
|
(prop :FlxActionDigital fastForwardAction)
|
||||||
(prop actionManager (new FlxActionManager))
|
(prop actionManager (new FlxActionManager))
|
||||||
(prop &mut :Movie<FlxSprite,ActorFlxSprite,FlxSound,String,FlxSprite,FlxSound,FlxCamera,FlxLightSource> movie)
|
(prop &mut :Movie<FlxSprite,ActorFlxSprite,FlxSound,FlxSound,FlxSprite,FlxSound,FlxCamera,FlxLightSource> movie)
|
||||||
(defAlias &ident flxMovie (cast movie FlxMovie))
|
(defAlias &ident flxMovie (cast movie FlxMovie))
|
||||||
(loadFrom "hollywoo-flixel" "src/hollywoo_flixel/Aliases.kiss")
|
(loadFrom "hollywoo-flixel" "src/hollywoo_flixel/Aliases.kiss")
|
||||||
|
|
||||||
@@ -539,11 +539,8 @@
|
|||||||
(method :Float getSoundLength [:FlxSound sound]
|
(method :Float getSoundLength [:FlxSound sound]
|
||||||
sound.length)
|
sound.length)
|
||||||
|
|
||||||
(method :Float getSongLength [:String song]
|
(method :Float getSongLength [:FlxSound song]
|
||||||
(let [sound (FlxG.sound.play song)
|
(/ song.length 1000))
|
||||||
length sound.length]
|
|
||||||
(sound.stop)
|
|
||||||
length))
|
|
||||||
|
|
||||||
(savedVar :Float voiceVolume 1.0)
|
(savedVar :Float voiceVolume 1.0)
|
||||||
|
|
||||||
@@ -574,13 +571,13 @@
|
|||||||
(prop MUSIC_FADE_STEPS 10)
|
(prop MUSIC_FADE_STEPS 10)
|
||||||
(savedVar :Float musicVolume 1.0)
|
(savedVar :Float musicVolume 1.0)
|
||||||
|
|
||||||
(method :Void playSong [:String song :Float volumeMod :Bool loop :Bool waitForEnd :Continuation cc]
|
(method :Void playSong [:FlxSound song :Float volumeMod :Bool loop :Bool waitForEnd :Continuation cc]
|
||||||
(let [onFinish ->{
|
(let [onFinish ->{
|
||||||
(currentSoundVolumes.remove music)
|
(currentSoundVolumes.remove music)
|
||||||
(set music null)
|
(set music null)
|
||||||
(when waitForEnd (cc))
|
(when waitForEnd (cc))
|
||||||
}]
|
}]
|
||||||
(set music (FlxG.sound.play song 0 loop null true onFinish))
|
(set music (FlxG.sound.play (Reflect.field song "_sound") 0 loop null true onFinish))
|
||||||
(dictSet currentSoundVolumes music [0 volumeMod])
|
(dictSet currentSoundVolumes music [0 volumeMod])
|
||||||
(.start (new FlxTimer)
|
(.start (new FlxTimer)
|
||||||
(/ MUSIC_FADE_SEC MUSIC_FADE_STEPS)
|
(/ MUSIC_FADE_SEC MUSIC_FADE_STEPS)
|
||||||
@@ -665,7 +662,7 @@
|
|||||||
(layer.remove prop true))
|
(layer.remove prop true))
|
||||||
(cc))
|
(cc))
|
||||||
|
|
||||||
(prop :Array<FlxText> creditsText [])
|
(prop :kiss.List<FlxText> creditsText [])
|
||||||
(method _ctext [:String text :Int size]
|
(method _ctext [:String text :Int size]
|
||||||
(let [t (new FlxText 0 0 0 text size)]
|
(let [t (new FlxText 0 0 0 text size)]
|
||||||
(creditsText.push t)
|
(creditsText.push t)
|
||||||
@@ -680,8 +677,10 @@
|
|||||||
(method :Void hideBlackScreen []
|
(method :Void hideBlackScreen []
|
||||||
(FlxG.state.remove blackBG true))
|
(FlxG.state.remove blackBG true))
|
||||||
|
|
||||||
|
(var IDEAL_SCROLL_SPEED 200)
|
||||||
|
|
||||||
// TODO currently the bg will cover whatever the final scene was - making after credits scenes impossible
|
// TODO currently the bg will cover whatever the final scene was - making after credits scenes impossible
|
||||||
(method :Void rollCredits [:Array<CreditsLine> credits cc]
|
(method :Void rollCredits [:Array<CreditsLine> credits cc &opt :Float timeLimit]
|
||||||
(localVar bg (new FlxSprite))
|
(localVar bg (new FlxSprite))
|
||||||
(bg.makeGraphic FlxG.width FlxG.height FlxColor.BLACK true)
|
(bg.makeGraphic FlxG.width FlxG.height FlxColor.BLACK true)
|
||||||
(set bg.cameras [flxMovie.uiCamera])
|
(set bg.cameras [flxMovie.uiCamera])
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import flixel.tweens.FlxTween;
|
|||||||
/**
|
/**
|
||||||
* Model/controller of a Hollywoo-Flixel film, and main execution script
|
* Model/controller of a Hollywoo-Flixel film, and main execution script
|
||||||
*/
|
*/
|
||||||
class FlxMovie extends Movie<FlxSprite, ActorFlxSprite, FlxSound, String, FlxSprite, FlxSound, FlxCamera, FlxLightSource> {
|
class FlxMovie extends Movie<FlxSprite, ActorFlxSprite, FlxSound, FlxSound, FlxSprite, FlxSound, FlxCamera, FlxLightSource> {
|
||||||
// Think of HollywooFlixelDSL.kiss as the corresponding Kiss file for this class!
|
// Think of HollywooFlixelDSL.kiss as the corresponding Kiss file for this class!
|
||||||
|
|
||||||
public function new(director:FlxDirector, lightSourceJsonFile:String, positionsJson:String, delayLengthsJson:String, voiceLineMatchesJson:String, propScalesJson:String) {
|
public function new(director:FlxDirector, lightSourceJsonFile:String, positionsJson:String, delayLengthsJson:String, voiceLineMatchesJson:String, propScalesJson:String) {
|
||||||
|
|||||||
@@ -98,7 +98,9 @@
|
|||||||
(newSound name s description)))
|
(newSound name s description)))
|
||||||
|
|
||||||
(method newFlxSong [name path]
|
(method newFlxSong [name path]
|
||||||
(newSong name path))
|
(let [song (FlxG.sound.load path)]
|
||||||
|
(assert !(= 0 song.length) "song $name from $path has 0 length! avoid mp3s for this reason")
|
||||||
|
(newSong name song)))
|
||||||
|
|
||||||
(method newFlxVoiceTrack [name wavPath jsonPath]
|
(method newFlxVoiceTrack [name wavPath jsonPath]
|
||||||
(newVoiceTrack name (FlxG.sound.load wavPath) (openfl.utils.Assets.getText jsonPath)))
|
(newVoiceTrack name (FlxG.sound.load wavPath) (openfl.utils.Assets.getText jsonPath)))
|
||||||
|
|||||||
Reference in New Issue
Block a user