File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ class ConsoleCommands
64
64
console .registerClass (FlxCamera );
65
65
66
66
console .registerObject (" FlxDebuggerLayout" , FlxDebuggerLayout );
67
+ console .registerObject (" selection" , null );
67
68
}
68
69
69
70
private function help (? Alias : String ): String
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ class Pointer extends Tool
104
104
_selectionCancelled = false ;
105
105
_selectionStartPoint .set (_brain .flixelPointer .x , _brain .flixelPointer .y );
106
106
_itemsInSelectionArea .clearArray ();
107
+ updateConsoleSelection ();
107
108
}
108
109
109
110
/**
@@ -134,12 +135,28 @@ class Pointer extends Tool
134
135
calculateSelectionArea ();
135
136
136
137
if (findItems )
138
+ {
137
139
_brain .findItemsWithinState (_itemsInSelectionArea , FlxG .state , _selectionArea );
140
+ updateConsoleSelection ();
141
+ }
138
142
139
143
// Clear everything
140
144
_selectionHappening = false ;
141
145
_selectionArea .set (0 , 0 , 0 , 0 );
142
146
}
147
+
148
+ /**
149
+ * We register the current selection to the console for easy interaction.
150
+ */
151
+ private function updateConsoleSelection ()
152
+ {
153
+ FlxG .console .registerObject (" selection" , switch (_itemsInSelectionArea .length )
154
+ {
155
+ case 0 : null ;
156
+ case 1 : _itemsInSelectionArea [0 ];
157
+ case _ : _itemsInSelectionArea ;
158
+ });
159
+ }
143
160
144
161
private function handleItemAddition (itemsInSelectionArea : Array <FlxBasic >): Void
145
162
{
You can’t perform that action at this time.
0 commit comments