timed titleCard
This commit is contained in:
@@ -11,11 +11,13 @@ import hollywoo.Movie;
|
||||
import hollywoo.Scene;
|
||||
import hollywoo.Director;
|
||||
import hollywoo_flixel.FlxMovie;
|
||||
import hollywoo_flixel.SpriteTools;
|
||||
import flixel.util.FlxColor;
|
||||
import flixel.text.FlxText;
|
||||
import flixel.system.FlxSound;
|
||||
import flixel.util.FlxTimer;
|
||||
import haxe.Constraints;
|
||||
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class FlxDirector implements Director<String, FlxStagePosition, FlxStageFacing, FlxScreenPosition, ActorFlxSprite, FlxSound, String, FlxSprite, FlxSound> {}
|
||||
|
@@ -64,6 +64,27 @@
|
||||
(method :Void stopWaitForInput []
|
||||
(set nextCC null))
|
||||
|
||||
(var TITLE_Y 240)
|
||||
(var TITLE_SIZE 72)
|
||||
(var TITLE_MARGIN 100)
|
||||
(var SUBTITLES_MARGIN 30)
|
||||
(var SUBTITLES_SIZE 48)
|
||||
(prop &mut :FlxSprite titleCard null)
|
||||
(method :Void showTitleCard [:Array<String> text :Continuation cc]
|
||||
(set titleCard (new FlxSprite))
|
||||
(titleCard.makeGraphic 1280 720 FlxColor.BLACK)
|
||||
(SpriteTools.writeOnSprite (text.shift) TITLE_SIZE titleCard (object x (Percent 0.5) y (Pixels TITLE_Y)))
|
||||
(localVar &mut subtitleY (+ TITLE_Y TITLE_SIZE TITLE_MARGIN))
|
||||
(doFor subtitle text
|
||||
(SpriteTools.writeOnSprite subtitle SUBTITLES_SIZE titleCard (object x (Percent 0.5) y (Pixels subtitleY)))
|
||||
(+= subtitleY SUBTITLES_SIZE SUBTITLES_MARGIN))
|
||||
(currentState.add titleCard)
|
||||
// Allow skipping
|
||||
(startWaitForInput cc))
|
||||
|
||||
(method :Void hideTitleCard []
|
||||
(currentState.remove titleCard))
|
||||
|
||||
(var DIALOG_X 300)
|
||||
(var DIALOG_WIDTH (- 1280 ACTOR_WIDTH ACTOR_WIDTH))
|
||||
(var DIALOG_Y 500)
|
||||
|
@@ -16,13 +16,15 @@ interface Director<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound
|
||||
function hideCharacter(character:Character<StagePosition, StageFacing, Actor>, cc:Continuation):Void;
|
||||
function playSound(sound:Sound, volumeMod:Float, waitForEnd:Bool, cc:Continuation):Void;
|
||||
function playSong(song:Song, volumeMod:Float, loop:Bool, waitForEnd:Bool, cc:Continuation):Void;
|
||||
function stopSong():Void;
|
||||
function playVoiceTrack(track:VoiceTrack, volumeMod:Float, start:Float, end:Float, cc:Continuation):Void;
|
||||
function stopVoiceTrack(track:VoiceTrack):Void;
|
||||
function stopSong():Void;
|
||||
function startWaitForInput(cc:Continuation):Void;
|
||||
function stopWaitForInput():Void;
|
||||
function showDialog(speakerName:String, type:SpeechType<StagePosition, StageFacing, Actor>, wryly:String, dialog:String, cc:Continuation):Void;
|
||||
function hideDialog():Void;
|
||||
function showTitleCard(text:Array<String>, cc:Continuation):Void;
|
||||
function hideTitleCard():Void;
|
||||
function showPropOnScreen(prop:Prop, position:ScreenPosition, cc:Continuation):Void;
|
||||
// TODO showPropOnStage
|
||||
function hideProp(prop:Prop, cc:Continuation):Void;
|
||||
|
@@ -233,6 +233,17 @@
|
||||
(set intercutMap null)
|
||||
(cc))
|
||||
|
||||
(hollywooMethod timedTitleCard true [time :Array<String> lines :Continuation cc]
|
||||
// TODO allow skipping it
|
||||
(let [cc ->{(director.hideTitleCard)(cc)}]
|
||||
(director.showTitleCard lines cc)
|
||||
(delay time cc)))
|
||||
|
||||
// TODO themed titleCard
|
||||
|
||||
// TODO timed superText
|
||||
// TODO themed superText
|
||||
|
||||
(hollywooMethod superText true [text :Continuation cc]
|
||||
(showDialog "" Super "" text cc))
|
||||
|
||||
|
Reference in New Issue
Block a user