diff --git a/src/hollywoo_flixel/HollywooFlixelDSL.kiss b/src/hollywoo_flixel/HollywooFlixelDSL.kiss index 5c6405d..68925cd 100644 --- a/src/hollywoo_flixel/HollywooFlixelDSL.kiss +++ b/src/hollywoo_flixel/HollywooFlixelDSL.kiss @@ -54,12 +54,17 @@ (let [runners (labelRunners) buttons (new flixel.group.FlxGroup.FlxTypedGroup)] (localVar &mut buttonY 0) - (doFor label (sort (collect (runners.keys))) + (localVar buttonsPerColumn 25) + (doFor [num label] (enumerate (sort (collect (runners.keys)))) (let [runner (dictGet runners label) b (new flixel.ui.FlxButton 0 buttonY label ->{(FlxG.state.remove buttons)(runner)})] + (let [column (Std.int (/ num buttonsPerColumn))] + (set b.x (* b.width column))) (buttons.add b)) - (+= buttonY 20)) - (FlxG.state.add buttons))) + (+= buttonY 20) + (when (= (- buttonsPerColumn 1) (% num buttonsPerColumn)) + (set buttonY 0))) + (.add (cast (_currentScene) SceneFlxState) buttons))) (defMacro withProp [propKey name &body body] `(let [,name (dictGet props ,propKey)]