scaling, but weirdly positioned hollywoo-flixel props

This commit is contained in:
2021-11-03 12:25:11 -04:00
parent 5e7ba72d6f
commit d3ad508750
4 changed files with 29 additions and 8 deletions

View File

@@ -9,9 +9,9 @@ enum Appearance {
typedef Continuation = Void -> Void; typedef Continuation = Void -> Void;
interface Director<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound, Song> { interface Director<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound, Song, Prop> {
var movie(default, default):Movie<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound, Song>; var movie(default, default):Movie<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound, Song, Prop>;
function showScene(scene:Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor>, appearance:Appearance, cc:Continuation):Void; function showScene(scene:Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor, Prop>, appearance:Appearance, cc:Continuation):Void;
function showCharacter(character:Character<StagePosition, StageFacing, Actor>, appearance:Appearance, cc:Continuation):Void; function showCharacter(character:Character<StagePosition, StageFacing, Actor>, appearance:Appearance, cc:Continuation):Void;
function playSound(sound:Sound, volumeMod:Float, waitForEnd:Bool, 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 playSong(song:Song, volumeMod:Float, loop:Bool, waitForEnd:Bool, cc:Continuation):Void;
@@ -19,4 +19,7 @@ interface Director<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound
function startWaitForInput(cc:Continuation):Void; function startWaitForInput(cc:Continuation):Void;
function stopWaitForInput():Void; function stopWaitForInput():Void;
function showDialog(speakerName:String, type:SpeechType<StagePosition, StageFacing, Actor>, wryly:String, dialog:String, cc:Continuation):Void; function showDialog(speakerName:String, type:SpeechType<StagePosition, StageFacing, Actor>, wryly:String, dialog:String, cc:Continuation):Void;
function showPropOnScreen(prop:Prop, position:ScreenPosition, cc:Continuation):Void;
// TODO showPropOnStage
function hideProp(prop:Prop, cc:Continuation):Void;
} }

View File

@@ -17,8 +17,8 @@ enum DelayHandling {
* Model/controller of a Hollywoo film, and main execution script * Model/controller of a Hollywoo film, and main execution script
*/ */
@:build(kiss.Kiss.build()) @:build(kiss.Kiss.build())
class Movie<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound, Song> extends AsyncEmbeddedScript { class Movie<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound, Song, Prop> extends AsyncEmbeddedScript {
// TODO for some reason this wasn't working when declared in Movie.kiss: // TODO for some reason this wasn't working when declared in Movie.kiss:
// Mutable representation of frames in time: // Mutable representation of frames in time:
var scenes:Map<String, Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor>> = []; var scenes:Map<String, Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor, Prop>> = [];
} }

View File

@@ -3,6 +3,7 @@
(prop :Map<String,Actor> actors (new Map)) (prop :Map<String,Actor> actors (new Map))
(prop :Map<String,Sound> sounds (new Map)) (prop :Map<String,Sound> sounds (new Map))
(prop :Map<String,Song> songs (new Map)) (prop :Map<String,Song> songs (new Map))
(prop :Map<String,Prop> props (new Map))
(prop &mut :DelayHandling delayHandling AutoWithSkip) (prop &mut :DelayHandling delayHandling AutoWithSkip)
@@ -29,7 +30,7 @@
(defNew (defNew
[ [
// "View" in the Model-View-Controller architecture: // "View" in the Model-View-Controller architecture:
&prop :Director<Set,StagePosition,StageFacing,ScreenPosition,Actor,Sound,Song> director &prop :Director<Set,StagePosition,StageFacing,ScreenPosition,Actor,Sound,Song,Prop> director
] ]
(set director.movie this) (set director.movie this)
@@ -73,11 +74,13 @@
(dictGet sets setKey) (dictGet sets setKey)
characters characters
(new Map) (new Map)
propsOnScreen
(new Map)
] ]
time time
perspective))) perspective)))
(method newScene [name :Scene<Set,StagePosition,StageFacing,ScreenPosition,Actor> scene] (method newScene [name :Scene<Set,StagePosition,StageFacing,ScreenPosition,Actor,Prop> scene]
(assert isLoading) (assert isLoading)
(dictSet scenes name scene)) (dictSet scenes name scene))
@@ -140,6 +143,19 @@
// TODO moveCharacter remove them, add them to another scene // TODO moveCharacter remove them, add them to another scene
// TODO moveCharacterAndFollow remove them, add them to another scene, set that the scene // TODO moveCharacterAndFollow remove them, add them to another scene, set that the scene
(method newProp [name :Prop prop]
(assert isLoading)
(dictSet props name prop))
(method addPropToScreen [name :ScreenPosition position :Continuation cc]
(dictSet .propsOnScreen (_currentScene) name (dictGet props name))
(director.showPropOnScreen (dictGet props name) position cc))
(method removePropFromScrene [name :Continuation cc]
(director.hideProp (dictGet props name) cc))
// TODO removeProp
// Dialogue: // Dialogue:
(method superText [text cc] (method superText [text cc]

View File

@@ -28,9 +28,11 @@ enum SpeechType<StagePosition, StageFacing, Actor> {
Custom(type:String, actor:Actor, args:Dynamic); Custom(type:String, actor:Actor, args:Dynamic);
} }
typedef Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor> = { typedef Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor, Prop> = {
set:Set, set:Set,
characters:Map<String, Character<StagePosition, StageFacing, Actor>>, characters:Map<String, Character<StagePosition, StageFacing, Actor>>,
propsOnScreen:Map<String, Prop>,
// TODO props on stage
time:SceneTime, time:SceneTime,
perspective:ScenePerspective perspective:ScenePerspective
}; };