108 lines
3.5 KiB
Plaintext
108 lines
3.5 KiB
Plaintext
(loadFrom "hollywoo" "src/hollywoo/HollywooDSL.kiss")
|
|
|
|
(defMacroVar subclass true)
|
|
(loadFrom "hollywoo" "src/hollywoo/Movie.kiss")
|
|
(loadFrom "hollywoo-flixel" "src/hollywoo_flixel/Aliases.kiss")
|
|
|
|
(method newFlxSet [name assetPath]
|
|
(let [setSprite (new FlxSprite 0 0)]
|
|
(setSprite.loadGraphic assetPath false 0 0 true) // Load uniquely so we can draw on sets for specific scenes
|
|
(newSet name setSprite)))
|
|
|
|
(method newFlxSound [name path &opt :Float volume]
|
|
(set volume (or volume 1))
|
|
(assert (<= 0 volume 1))
|
|
(let [s (FlxG.sound.load path)]
|
|
(set s.volume volume)
|
|
(set s.persist true)
|
|
(newSound name s)))
|
|
|
|
(method newFlxSong [name path]
|
|
(newSong name path))
|
|
|
|
(method newFlxVoiceTrack [name wavPath jsonPath]
|
|
(newVoiceTrack name (FlxG.sound.load wavPath) (openfl.utils.Assets.getText jsonPath)))
|
|
|
|
(method newFlxVoiceTracks [:Array<String> names :Array<String> wavJsonPaths]
|
|
(doFor name names
|
|
(doFor [wavPath jsonPath] (groups wavJsonPaths 2 Throw)
|
|
(newFlxVoiceTrack name wavPath jsonPath))))
|
|
|
|
(method newFlxProp [name path &opt :FlxSprite->Void prepareSprite]
|
|
(let [propSprite (new FlxSprite 0 0)]
|
|
(propSprite.loadGraphic path false 0 0 true) // Load props uniquely because they can be drawn on
|
|
(when prepareSprite
|
|
(prepareSprite propSprite))
|
|
(newProp name propSprite)))
|
|
|
|
(defMacro flxSprite [asset &builder b]
|
|
`(new FlxSprite 0 0 ,(b.field (symbolNameValue asset) (b.symbol "AssetPaths"))))
|
|
|
|
(method :Void update [:Float elapsed]
|
|
(#when debug
|
|
(when FlxG.keys.justPressed.N
|
|
(skipToNextLabel))
|
|
(when FlxG.keys.justPressed.L
|
|
(showLabelSkipButtons))))
|
|
|
|
(method :Void showLabelSkipButtons []
|
|
(let [runners (labelRunners)]
|
|
(localVar &mut buttonY 0)
|
|
(localVar buttonsPerColumn 25)
|
|
(kiss_flixel.SimpleWindow.promptForChoice
|
|
"Skip to scene?"
|
|
(sort (collect (runners.keys)))
|
|
->label ((dictGet runners label))
|
|
FlxColor.BLACK
|
|
FlxColor.WHITE
|
|
0.8
|
|
0.8
|
|
true
|
|
"escape"
|
|
"left"
|
|
"right")))
|
|
|
|
(defAlias &ident flxDirector (cast director FlxDirector))
|
|
|
|
(preload
|
|
(unless uiCamera
|
|
(set uiCamera (new flixel.FlxCamera))
|
|
(set uiCamera.bgColor FlxColor.TRANSPARENT)
|
|
(flixel.FlxG.cameras.add uiCamera)
|
|
(set kiss_flixel.SimpleWindow.defaultCamera uiCamera))
|
|
(unless screenCamera
|
|
(set screenCamera (new flixel.FlxCamera))
|
|
(set screenCamera.bgColor FlxColor.TRANSPARENT)
|
|
(FlxG.cameras.add screenCamera))
|
|
// These are set here so they're defined after FlxG.width and height have been set:
|
|
(set STAGE_LEFT_X 150.0)
|
|
(set STAGE_RIGHT_X (- FlxG.width STAGE_LEFT_X))
|
|
(set ACTOR_Y (- FlxG.height 220.0))
|
|
(set ACTOR_WIDTH 300)
|
|
(set STAGE_BEHIND_DY 250.0)
|
|
(set DIALOG_X ACTOR_WIDTH)
|
|
(set DIALOG_Y (- FlxG.height 220.0))
|
|
(set DIALOG_WIDTH (- FlxG.width ACTOR_WIDTH ACTOR_WIDTH))
|
|
(set DIALOG_HEIGHT (- FlxG.height DIALOG_Y))
|
|
#{
|
|
stagePositions["Left"] = {
|
|
x: STAGE_LEFT_X,
|
|
y: ACTOR_Y,
|
|
z: 0.0
|
|
};
|
|
stagePositions["Right"] = {
|
|
x: STAGE_RIGHT_X,
|
|
y: ACTOR_Y,
|
|
z: 0.0
|
|
};
|
|
stagePositions["Left2"] = {
|
|
x: STAGE_LEFT_X,
|
|
y: ACTOR_Y,
|
|
z: STAGE_BEHIND_DY
|
|
};
|
|
stagePositions["Right2"] = {
|
|
x: STAGE_RIGHT_X,
|
|
y: ACTOR_Y,
|
|
z: STAGE_BEHIND_DY
|
|
};
|
|
}#) |