HabitState use DebugLayer

This commit is contained in:
2022-08-14 21:27:57 +00:00
parent 7774971bad
commit 7aa6e575f2

View File

@@ -29,34 +29,28 @@
(prop &mut :EntryType typeAdding Todo) (prop &mut :EntryType typeAdding Todo)
(prop &mut :FlxInputText entryNameText) (prop &mut :FlxInputText entryNameText)
(prop &mut :FlxSprite cameraBounds null) (prop &mut :DebugLayer debugLayer null)
(prop &mut :Float timer 0)
(prop &mut t 1)
(method &override :Void update [:Float elapsed] (method &override :Void update [:Float elapsed]
(super.update elapsed) (super.update elapsed)
**(#when debug (debugLayer.clear)
(+= timer elapsed) (debugLayer.drawRect 0 0 100 100 FlxColor.TRANSPARENT (object thickness t color FlxColor.LIME))
(when (> timer 0.5) (when FlxG.keys.justPressed.ONE
(set timer 0) (+= t 1))
(unless cameraBounds (when FlxG.keys.justPressed.TWO
(set cameraBounds (new FlxSprite)) (-= t 1))
(set cameraBounds.cameras [pieceCamera])
(add cameraBounds)) (#when debug
(let [b (pieceCamera.getScrollBounds)] (doFor s rewardSprites
(set cameraBounds.x b.x) //(s.drawCircle s.origin.x s.origin.y 5 FlxColor.LIME)
(set cameraBounds.y b.y) //(debugLayer.drawCircle (- s.x cameraBounds.x) (- s.y cameraBounds.y) 5 FlxColor.LIME)
(cameraBounds.makeGraphic (Std.int b.width) (Std.int b.height) FlxColor.TRANSPARENT true) // Uncomment for debugging match zones:
(cameraBounds.drawRect 0 0 b.width b.height FlxColor.TRANSPARENT (object color FlxColor.LIME thickness 5))) (let [matchZones [(matchZoneLeft s) (matchZoneRight s)(matchZoneUp s)(matchZoneDown s)]]
(doFor z matchZones
(doFor s rewardSprites (unless z.isEmpty
//(s.drawCircle s.origin.x s.origin.y 5 FlxColor.LIME) (debugLayer.drawFlxRect z FlxColor.TRANSPARENT (object thickness 1 color FlxColor.RED)))))))
(cameraBounds.drawCircle (- s.x cameraBounds.x) (- s.y cameraBounds.y) 5 FlxColor.LIME)
// Uncomment for debugging match zones:
(let [matchZones [(matchZoneLeft s) (matchZoneRight s)(matchZoneUp s)(matchZoneDown s)]]
(doFor z matchZones
(unless z.isEmpty
(FlxSpriteUtil.drawRect cameraBounds (- z.x cameraBounds.x) (- z.y cameraBounds.y) z.width z.height FlxColor.TRANSPARENT (object thickness 1 color FlxColor.RED))))))))
(pieceCamera.updateScrollWheelZoom elapsed 5) (pieceCamera.updateScrollWheelZoom elapsed 5)
(pieceCamera.updateMouseBorderControl elapsed KEYBOARD_SCROLL_SPEED 0.002 uiCamera) (pieceCamera.updateMouseBorderControl elapsed KEYBOARD_SCROLL_SPEED 0.002 uiCamera)
@@ -368,7 +362,13 @@
(entryWindow.show)) (entryWindow.show))
(when !(= puzzleUnlocked -1) (when !(= puzzleUnlocked -1)
(startPuzzlePackChoice puzzleUnlocked)))) (startPuzzlePackChoice puzzleUnlocked)))
(unless debugLayer
(set debugLayer (new DebugLayer))
(set debugLayer.cameras [pieceCamera]))
(remove debugLayer)
(add debugLayer))
(method refreshModel [&opt m] (method refreshModel [&opt m]
(let [m (or m model)] (let [m (or m model)]