Hollywoo allow defining positions at runtime
This commit is contained in:
@@ -155,6 +155,11 @@
|
|||||||
})
|
})
|
||||||
(FlxG.state.add screen)))
|
(FlxG.state.add screen)))
|
||||||
|
|
||||||
|
(method :Void defineStagePosition [:StagePosition->Void submit]
|
||||||
|
(defineFlxPoint
|
||||||
|
->point
|
||||||
|
(submit (new StagePosition point.x point.y 0.0))))
|
||||||
|
|
||||||
(method :Void defineLightSource [:FlxLightSource->Void submit]
|
(method :Void defineLightSource [:FlxLightSource->Void submit]
|
||||||
(let [points []]
|
(let [points []]
|
||||||
(withFunctions
|
(withFunctions
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ interface Director<Set:Cloneable<Set>, Actor, Sound, Song, Prop, VoiceTrack, Cam
|
|||||||
|
|
||||||
function chooseString(prompt:String, choices:Array<String>, submit:String->Void):Void;
|
function chooseString(prompt:String, choices:Array<String>, submit:String->Void):Void;
|
||||||
|
|
||||||
|
function defineStagePosition(submit:StagePosition->Void):Void;
|
||||||
function defineLightSource(submit:LightSource->Void):Void;
|
function defineLightSource(submit:LightSource->Void):Void;
|
||||||
|
|
||||||
function showSet(set:Set, time:SceneTime, perspective:ScenePerspective, appearance:Appearance, camera:Camera, cc:Continuation):Void;
|
function showSet(set:Set, time:SceneTime, perspective:ScenePerspective, appearance:Appearance, camera:Camera, cc:Continuation):Void;
|
||||||
|
|||||||
@@ -155,9 +155,13 @@
|
|||||||
(director.resume)
|
(director.resume)
|
||||||
(TimerWithPause.resume)))
|
(TimerWithPause.resume)))
|
||||||
|
|
||||||
|
(prop :Map<String,Array<String>> positionsInScene (new Map))
|
||||||
(method resolvePosition [:Dynamic position]
|
(method resolvePosition [:Dynamic position]
|
||||||
(typeCase [position]
|
(typeCase [position]
|
||||||
([:String positionKey]
|
([:String positionKey]
|
||||||
|
(let [positionsInThisScene (dictGet positionsInScene sceneKey)]
|
||||||
|
(unless (positionsInThisScene.contains positionKey)
|
||||||
|
(positionsInThisScene.push positionKey)))
|
||||||
(stagePositions.get positionKey))
|
(stagePositions.get positionKey))
|
||||||
([:StagePosition position]
|
([:StagePosition position]
|
||||||
position)
|
position)
|
||||||
@@ -203,6 +207,15 @@
|
|||||||
->cc (director.showPauseMenu cc))
|
->cc (director.showPauseMenu cc))
|
||||||
|
|
||||||
(#when debug
|
(#when debug
|
||||||
|
(shortcutHandler.registerItem "[d]efine [p]osition"
|
||||||
|
->cc
|
||||||
|
(director.chooseString "Which position?" (dictGet positionsInScene sceneKey)
|
||||||
|
->positionKey
|
||||||
|
(director.defineStagePosition
|
||||||
|
->[:StagePosition position] {
|
||||||
|
(stagePositions.put positionKey position)
|
||||||
|
(cc)
|
||||||
|
})))
|
||||||
(shortcutHandler.registerItem "[d]efine [l]ight source"
|
(shortcutHandler.registerItem "[d]efine [l]ight source"
|
||||||
->cc
|
->cc
|
||||||
(director.defineLightSource
|
(director.defineLightSource
|
||||||
@@ -319,6 +332,8 @@
|
|||||||
(_hideCurrentScene
|
(_hideCurrentScene
|
||||||
(makeCC
|
(makeCC
|
||||||
(set sceneKey name)
|
(set sceneKey name)
|
||||||
|
(unless (positionsInScene.exists sceneKey)
|
||||||
|
(dictSet positionsInScene sceneKey []))
|
||||||
(_showScene
|
(_showScene
|
||||||
(dictGet scenes name)
|
(dictGet scenes name)
|
||||||
(appearanceFlag shownScenes name)
|
(appearanceFlag shownScenes name)
|
||||||
|
|||||||
Reference in New Issue
Block a user