logSprites take cameras into account for layering
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
(var &mut :FlxActionDigital f1Action null)
|
(var &mut :FlxActionDigital f1Action null)
|
||||||
|
(var &mut :FlxActionDigital f2Action null)
|
||||||
|
|
||||||
(function f1ToRecord [&opt :FlxActionManager _manager]
|
(function f1ToRecord [&opt :FlxActionManager _manager]
|
||||||
(unless _manager
|
(unless _manager
|
||||||
@@ -17,4 +18,21 @@
|
|||||||
(OBSTools.stopObs)
|
(OBSTools.stopObs)
|
||||||
(OBSTools.startObs))))
|
(OBSTools.startObs))))
|
||||||
(_manager.removeAction f1Action 0)
|
(_manager.removeAction f1Action 0)
|
||||||
(_manager.addAction f1Action))
|
(_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
|
#if sys
|
||||||
import sys.io.File;
|
import sys.io.File;
|
||||||
#end
|
#end
|
||||||
|
import kiss_flixel.DebugLayer;
|
||||||
|
|
||||||
enum RelativeCoordinate {
|
enum RelativeCoordinate {
|
||||||
// Negative means to count back from the far edge
|
// Negative means to count back from the far edge
|
||||||
|
@@ -84,20 +84,39 @@
|
|||||||
(s.loadGraphic s.graphic false 0 0 true)))
|
(s.loadGraphic s.graphic false 0 0 true)))
|
||||||
|
|
||||||
(var &mut _idx 0)
|
(var &mut _idx 0)
|
||||||
(function :Void logSprites [&opt :FlxGroup group :String tab]
|
(function :Void logSprites [&opt :flixel.FlxCamera _camera :FlxGroup group :String tab]
|
||||||
(unless group
|
(unless _camera
|
||||||
(print "Logging Sprites")
|
(print "Logging Sprites")
|
||||||
(print "###############")
|
(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 _idx 0)
|
||||||
(set group FlxG.state)
|
(set group FlxG.state)
|
||||||
(set tab ""))
|
(set tab ""))
|
||||||
(group.forEach
|
(group.forEach
|
||||||
->:Void obj
|
->:Void obj
|
||||||
(typeCase [obj]
|
(cond
|
||||||
([:FlxSprite sprite]
|
((let [cameras (or obj.cameras (Reflect.field FlxG.cameras "defaults"))]
|
||||||
(print "${tab}${_idx++}. ${sprite}"))
|
(cameras.contains _camera))
|
||||||
([:FlxTypedGroup<FlxBasic> innerGroup]
|
|
||||||
(logSprites innerGroup "${tab}| "))
|
(typeCase [obj]
|
||||||
(otherwise
|
([:FlxText text]
|
||||||
(print "${tab}${_idx++}. Unknown type"))))
|
(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 _camera innerGroup "${tab}| "))
|
||||||
|
(otherwise
|
||||||
|
(print "${tab}${_idx++}. Unknown type"))))
|
||||||
|
(true
|
||||||
|
(+= _idx 1))))
|
||||||
(print "${tab}---------------"))
|
(print "${tab}---------------"))
|
Reference in New Issue
Block a user