Position arg type in NAT

This commit is contained in:
2022-12-18 05:39:15 +00:00
parent 3c933e8b0d
commit 0ac7156366
4 changed files with 25 additions and 4 deletions

View File

@@ -80,7 +80,12 @@
(when (and textInput !textInput.alive)
(set textInput null))
(when resolvePosition
(when FlxG.mouse.justPressed
(whenLet [rp resolvePosition
(Some pos) (cursorPosition)]
(set resolvePosition null)
(rp pos))))
// Control the UI camera with WASD, and the playground camera with arrow keys:
(var KEYBOARD_SCROLL_SPEED 800)
@@ -214,6 +219,11 @@
(whenLet [sprite (dictGet spriteSystem.sprites e.id)]
(sprite.updateColor))))
(prop &mut :Position->Void resolvePosition)
(method :Void choosePosition [prompt resolve]
(displayMessage prompt)
(set resolvePosition resolve))
(method :Option<Position> cursorPosition []
(let [pos (FlxG.mouse.getWorldPosition FlxG.camera)]
(Some (object x pos.x y pos.y z 0.0))))