compiler guards on define scale and define z

This commit is contained in:
2024-08-20 18:26:34 -05:00
parent d71a865362
commit 77bb32554c

View File

@@ -557,43 +557,44 @@
(dictSet v "Percent" kiss_flixel.RelativeCoordinate.Percent) (dictSet v "Percent" kiss_flixel.RelativeCoordinate.Percent)
) )
(let [shortcutHandler (director.shortcutHandler) (#when debug
cc ->(resume)] (let [shortcutHandler (director.shortcutHandler)
(shortcutHandler.registerItem "[d]efine prop [s]cale" cc ->(resume)]
->cc (shortcutHandler.registerItem "[d]efine prop [s]cale"
(unless doingSomething (set doingSomething true) ->cc
(director.chooseString "Which prop?" (withCancel (dictGet propsInScene sceneKey)) (unless doingSomething (set doingSomething true)
(unlessCancel propKey (director.chooseString "Which prop?" (withCancel (dictGet propsInScene sceneKey))
(withFunctions (unlessCancel propKey
[ (withFunctions
(definePropScale [cc] [
(let [lastScale .value (propScales.get propKey)] (definePropScale [cc]
(director.enterString "Redefine $propKey scale from ${lastScale}?" (let [lastScale .value (propScales.get propKey)]
->scaleStr (director.enterString "Redefine $propKey scale from ${lastScale}?"
(let [scale (Std.parseFloat scaleStr)] ->scaleStr
(if (Math.isNaN scale) (let [scale (Std.parseFloat scaleStr)]
(print "Failed to parse ${scaleStr}. leaving value the same") (if (Math.isNaN scale)
(propScales.put propKey (new JsonFloat scale))) (print "Failed to parse ${scaleStr}. leaving value the same")
// Re-scale props immediately (propScales.put propKey (new JsonFloat scale)))
(doFor prop .props (dictGet scenes sceneKey) // Re-scale props immediately
(flxDirector.scaleProp prop.prop)) (doFor prop .props (dictGet scenes sceneKey)
(cc))))) (flxDirector.scaleProp prop.prop))
] (cc)))))
(set lastCommand definePropScale) ]
(definePropScale cc)))))) (set lastCommand definePropScale)
(shortcutHandler.registerItem "[d]efine [z] of a position" (definePropScale cc))))))
->cc (shortcutHandler.registerItem "[d]efine [z] of a position"
(unless doingSomething (set doingSomething true) ->cc
(director.chooseString "Which position?" (withCancel (dictGet positionsInScene sceneKey)) (unless doingSomething (set doingSomething true)
(unlessCancel positionKey (director.chooseString "Which position?" (withCancel (dictGet positionsInScene sceneKey))
(let [position (stagePositions.get positionKey)] (unlessCancel positionKey
(director.enterString "Redefine z from ${position.z}?" (let [position (stagePositions.get positionKey)]
->zStr { (director.enterString "Redefine z from ${position.z}?"
(let [z (Std.parseFloat zStr)] ->zStr {
(if (Math.isNaN z) (let [z (Std.parseFloat zStr)]
(print "Failed to parse ${zStr}. leaving value the same") (if (Math.isNaN z)
(stagePositions.put positionKey (new StagePosition position.x position.y z))) (print "Failed to parse ${zStr}. leaving value the same")
(cc)) })))))))) (stagePositions.put positionKey (new StagePosition position.x position.y z)))
(cc)) })))))))))
(prop &mut :flixel.ui.FlxBar bar null) (prop &mut :flixel.ui.FlxBar bar null)
(prop &mut :Int barProgress 0) (prop &mut :Int barProgress 0)