set of macros in HollywooFlixel for direct FlxSprite manipulation

This commit is contained in:
2022-01-09 18:49:10 -07:00
parent a6f13510be
commit f9fbeef077

View File

@@ -58,4 +58,34 @@
(let [b (new flixel.ui.FlxButton 0 buttonY label ->{(FlxG.state.remove buttons)(runner)})]
(buttons.add b))
(+= buttonY 20))
(FlxG.state.add buttons)))
(FlxG.state.add buttons)))
(defMacro withProp [propKey name &body body]
`(let [,name (dictGet props ,propKey)]
,@body
(cc)))
// like withProp, but you promise to call CC yourself in the body:
(defMacro withPropCC [propKey name &body body]
`(let [,name (dictGet props ,propKey)]
,@body))
(defMacro withActor [actorKey name &body body]
`(let [,name (dictGet actors ,actorKey)]
,@body
(cc)))
// like withActor, but you promise to call CC yourself in the body:
(defMacro withActorCC [actorKey name &body body]
`(let [,name (dictGet actors ,actorKey)]
,@body))
(defMacro withSet [sceneKey name &body body]
`(let [,name .setSprite (cast (dictGet scenes ,sceneKey) SceneFlxState)]
,@body
(cc)))
// like withSet, but you promise to call CC yourself in the body:
(defMacro withSetCC [sceneKey name &body body]
`(let [,name .setSprite (cast (dictGet scenes ,sceneKey) SceneFlxState)]
,@body))