diff --git a/kiss/src/kiss/AsyncEmbeddedScript.hx b/kiss/src/kiss/AsyncEmbeddedScript.hx index d9ce5aba..bf5dbbc9 100644 --- a/kiss/src/kiss/AsyncEmbeddedScript.hx +++ b/kiss/src/kiss/AsyncEmbeddedScript.hx @@ -42,13 +42,13 @@ class AsyncEmbeddedScript { #if macro public static function build(dslHaxelib:String, dslFile:String, scriptFile:String):Array { + //trace('AsyncEmbeddedScript.build $dslHaxelib $dslFile $scriptFile'); var k = Kiss.defaultKissState(); var classPath = Context.getPosInfos(Context.currentPos()).file; var loadingDirectory = Path.directory(classPath); var classFields = []; // Kiss.build() will already include Context.getBuildFields() - var commandList:Array = []; if (dslHaxelib.length > 0) { @@ -74,10 +74,6 @@ class AsyncEmbeddedScript { return; }); - for (command in commandList) { - Sys.println(command.toString()); - } - classFields = classFields.concat(k.fieldList); classFields.push({ diff --git a/projects/hollywoo-flixel/src/hollywoo_flixel/DSL.kiss b/projects/hollywoo-flixel/src/hollywoo_flixel/DSL.kiss index e69de29b..f1d593ba 100644 --- a/projects/hollywoo-flixel/src/hollywoo_flixel/DSL.kiss +++ b/projects/hollywoo-flixel/src/hollywoo_flixel/DSL.kiss @@ -0,0 +1 @@ +(loadFrom "hollywoo" "src/hollywoo/HollywooDSL.kiss") \ No newline at end of file diff --git a/projects/hollywoo/src/hollywoo/HollywooDSL.kiss b/projects/hollywoo/src/hollywoo/HollywooDSL.kiss index ef932909..3f7ec284 100644 --- a/projects/hollywoo/src/hollywoo/HollywooDSL.kiss +++ b/projects/hollywoo/src/hollywoo/HollywooDSL.kiss @@ -1 +1,8 @@ -(defNew [director] (super director)) \ No newline at end of file +(collectBlocks preload (cc)) + +(defMacro end [] + `(method doPreload [:Void->Void cc] + (set isLoading true) + (collectedBlocks preload) + (set isLoading false) + (cc))) \ No newline at end of file diff --git a/projects/hollywoo/src/hollywoo/Movie.kiss b/projects/hollywoo/src/hollywoo/Movie.kiss index 9a5a819d..88aaf22b 100644 --- a/projects/hollywoo/src/hollywoo/Movie.kiss +++ b/projects/hollywoo/src/hollywoo/Movie.kiss @@ -1,12 +1,17 @@ // Mostly immutable, reusable resources: (prop :Map sets (new Map)) (prop :Map actors (new Map)) +(prop :Map sounds (new Map)) // TODO for some reason this won't work when declared in Kiss syntax: // Mutable representation of frames in time: // var scenes:Map> = []; (prop :Map shownScenes (new Map)) (prop :Map shownCharacters (new Map)) + +// This is set and unset by doPreload defined in HollywooDSL.kiss +(prop &mut isLoading false) + (function :Appearance appearanceFlag [:Map map :String key] (if (dictGet map key) ReAppearance @@ -21,16 +26,17 @@ (defNew [ // "View" in the Model-View-Controller architecture: - &prop :Director director + &prop :Director director ] (super)) -(method newSet [name :Set set :Continuation cc] - (dictSet sets name set) - (cc)) +(method newSet [name :Set set] + (assert isLoading) + (dictSet sets name set)) -(method newSceneFromSet [name :String setKey :SceneTime time :ScenePerspective perspective :Continuation cc] +(method newSceneFromSet [name :String setKey :SceneTime time :ScenePerspective perspective] + (assert isLoading) (dictSet scenes name (objectWith [ set @@ -39,12 +45,11 @@ (new Map) ] time - perspective)) - (cc)) + perspective))) -(method newScene [name :Scene scene :Continuation cc] - (dictSet scenes name scene) - (cc)) +(method newScene [name :Scene scene] + (assert isLoading) + (dictSet scenes name scene)) (method setScene [name :Continuation cc] (set sceneKey name) @@ -53,9 +58,18 @@ (appearanceFlag shownScenes name) cc)) -(method newActor [name :Actor actor :Continuation cc] - (dictSet actors name actor) - (cc)) +(method newSound [name :Sound s] + (assert isLoading) + (dictSet sounds name s)) + +(method playSound [name :Continuation cc &opt :Float volumeMod] + (set volumeMod (or volumeMod 1)) + (assert (<= 0 volumeMod 1)) + (director.playSound (dictGet sounds name) volumeMod cc)) + +(method newActor [name :Actor actor] + (assert isLoading) + (dictSet actors name actor)) (method addCharacter [actorName :StagePosition position :StageFacing facing :Continuation cc] (let [character (object stagePosition position stageFacing facing actor (dictGet actors actorName))] @@ -75,6 +89,8 @@ // TODO moveCharacter remove them, add them to another scene // TODO moveCharacterAndFollow remove them, add them to another scene, set that the scene +// Dialogue: + (method normalSpeech [actorName wryly text cc] (director.showDialog actorName (OnScreen (dictGet .characters (_currentScene) actorName)) wryly text cc))