homemade flixel tracker button

This commit is contained in:
Cameron Taylor
2024-04-27 01:17:15 -04:00
parent 85350013d7
commit 46dcd4c8ea
4 changed files with 52 additions and 17 deletions
+3
View File
@@ -113,6 +113,8 @@ class Main extends Sprite
addChild(game);
game.debugger.interaction.addTool(new funkin.util.TrackerToolButtonUtil());
addChild(fpsCounter);
#if hxcpp_debug_server
@@ -129,6 +131,7 @@ class Main extends Sprite
// - It scans the class path and registers any HaxeUI components.
Toolkit.init();
Toolkit.theme = 'dark'; // don't be cringe
// Toolkit.theme = 'light'; // embrace cringe
Toolkit.autoScale = false;
// Don't focus on UI elements when they first appear.
haxe.ui.focus.FocusManager.instance.autoFocus = false;
@@ -0,0 +1,31 @@
package funkin.util;
import flixel.system.debug.interaction.tools.Pointer.GraphicCursorCross;
import flixel.system.debug.interaction.Interaction;
import flixel.system.debug.interaction.tools.Tool;
/**
* the name is a bit of a mouthful, but this adds a button to the
* FlxDebugger Interaction window, which when pressed will open a
* tracking window corresponding to whatever currently selected objects are
*/
class TrackerToolButtonUtil extends Tool
{
override function init(brain:Interaction):Tool
{
super.init(brain);
_name = "Add Tracker";
setButton(GraphicCursorCross);
button.upHandler = function() {
brain.selectedItems.forEach(function(item) {
FlxG.debugger.track(item);
});
};
button.toggleMode = false;
return this;
}
}