logSprites take cameras into account for layering
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
(var &mut :FlxActionDigital f1Action null)
|
||||
(var &mut :FlxActionDigital f2Action null)
|
||||
|
||||
(function f1ToRecord [&opt :FlxActionManager _manager]
|
||||
(unless _manager
|
||||
@@ -18,3 +19,20 @@
|
||||
(OBSTools.startObs))))
|
||||
(_manager.removeAction f1Action 0)
|
||||
(_manager.addAction f1Action))
|
||||
|
||||
(function f2ToLogSprites [&opt :FlxActionManager _manager]
|
||||
(unless _manager
|
||||
(set _manager (new FlxActionManager))
|
||||
(set _manager.resetOnStateSwitch NONE))
|
||||
|
||||
(doFor mightByManager (reverse FlxG.inputs.list)
|
||||
(when (Std.isOfType mightByManager FlxActionManager)
|
||||
(FlxG.inputs.remove mightByManager)))
|
||||
(FlxG.inputs.add _manager)
|
||||
(unless f2Action
|
||||
(set f2Action (new FlxActionDigital "Log sprites and groups onscreen"))
|
||||
(f2Action.addKey FlxKey.F2 JUST_PRESSED)
|
||||
(set f2Action.callback
|
||||
->_ (kiss_flixel.SpriteTools.logSprites)))
|
||||
(_manager.removeAction f2Action 0)
|
||||
(_manager.addAction f2Action))
|
@@ -14,6 +14,7 @@ import flash.utils.ByteArray;
|
||||
#if sys
|
||||
import sys.io.File;
|
||||
#end
|
||||
import kiss_flixel.DebugLayer;
|
||||
|
||||
enum RelativeCoordinate {
|
||||
// Negative means to count back from the far edge
|
||||
|
@@ -84,20 +84,39 @@
|
||||
(s.loadGraphic s.graphic false 0 0 true)))
|
||||
|
||||
(var &mut _idx 0)
|
||||
(function :Void logSprites [&opt :FlxGroup group :String tab]
|
||||
(unless group
|
||||
(function :Void logSprites [&opt :flixel.FlxCamera _camera :FlxGroup group :String tab]
|
||||
(unless _camera
|
||||
(print "Logging Sprites")
|
||||
(print "###############")
|
||||
(let [cameras (enumerate (filter FlxG.cameras.list))]
|
||||
(doFor [idx camera] cameras
|
||||
(print "Camera #${idx} (${camera.x}, ${camera.y}, ${camera.width}x${camera.height})")
|
||||
(print "bgColor: ${camera.bgColor}")
|
||||
(print "--------------")
|
||||
(logSprites camera null ""))
|
||||
(return)))
|
||||
(unless group
|
||||
(set _idx 0)
|
||||
(set group FlxG.state)
|
||||
(set tab ""))
|
||||
(group.forEach
|
||||
->:Void obj
|
||||
(cond
|
||||
((let [cameras (or obj.cameras (Reflect.field FlxG.cameras "defaults"))]
|
||||
(cameras.contains _camera))
|
||||
|
||||
(typeCase [obj]
|
||||
([:FlxText text]
|
||||
(print "${tab}${_idx++}. ${text.text}"))
|
||||
([:FlxSprite sprite]
|
||||
(print "${tab}${_idx++}. ${sprite}"))
|
||||
([:DebugLayer innerGroup]
|
||||
(print "${tab}DebugLayer:")
|
||||
(logSprites _camera (cast innerGroup) "${tab}| "))
|
||||
([:FlxTypedGroup<FlxBasic> innerGroup]
|
||||
(logSprites innerGroup "${tab}| "))
|
||||
(logSprites _camera innerGroup "${tab}| "))
|
||||
(otherwise
|
||||
(print "${tab}${_idx++}. Unknown type"))))
|
||||
(true
|
||||
(+= _idx 1))))
|
||||
(print "${tab}---------------"))
|
Reference in New Issue
Block a user