class Interaction
package flixel.system.debug.interaction
extends Window › Sprite › DisplayObjectContainer › InteractiveObject › DisplayObject › EventDispatcher
Adds a new functionality to Flixel debugger that allows any object on the screen to be dragged, moved or deleted while the game is still running.
@gmail.com)
Constructor
Variables
finalmacKeyboard:Bool = false
Whether or not the user is using a mac keyboard, determines whether to use command or ctrl
shouldDrawItemsSelection:Bool = true
Control if an outline should be drawn on selected elements.
Tools can set this property to false
if they want to draw custom
selection marks, for instance.
Methods
addItemsWithinArea(items:Array<FlxObject>, members:Array<FlxBasic>, area:FlxRect):Void
Find all items within an area. In order to improve performance and reduce temporary allocations,
the method has no return, you must pass an array where items will be placed. The method decides
if an item is within the searching area or not by checking if the item's hitbox (obtained from
getHitbox()
) overlaps the area parameter.
Parameters:
items | Array where the method will place all found items. Any previous content in the array will be preserved. |
---|---|
members | Array where the method will recursively search for items. |
area | A rectangle that describes the area where the method should search within. |
5.6.0
.addItemsWithinState(items:Array<FlxObject>, state:FlxState, area:FlxRect):Void
finds all items in the state and substate that are within the given area and adds them to the given list.
Parameters:
items | The list to add the items |
---|---|
state | The state to search |
area | The rectangular area to search |
5.6.0
.addTool(tool:Tool):Void
Add a new tool to the interaction system.
Any tool added to the interaction system must extend the class
flixel.system.debug.interaction.tools.Tool
. The class contains several methods
that can be used to provide new funcionalities to the interaction, or they can be
overridden to alter existing behavior. For instance, tools can draw things on the
screen, they can be activated when the user clicks a button, and so on. Check
the classes in the package flixel.system.debug.interaction.tools
for examples.
Parameters:
tool | instance of a tool that will be added to the interaction system. |
---|
inlinefindItemsWithinArea(items:Array<FlxBasic>, members:Array<FlxBasic>, area:FlxRect):Void
Find all items within an area. In order to improve performance and reduce temporary allocations,
the method has no return, you must pass an array where items will be placed. The method decides
if an item is within the searching area or not by checking if the item's hitbox (obtained from
getHitbox()
) overlaps the area parameter.
Parameters:
items | Array where the method will place all found items. Any previous content in the array will be preserved. |
---|---|
members | Array where the method will recursively search for items. |
area | A rectangle that describes the area where the method should search within. |
inlinefindItemsWithinState(items:Array<FlxBasic>, state:FlxState, area:FlxRect):Void
getItemsWithinState(state:FlxState, area:FlxRect):Array<FlxObject>
Returns a list all items in the state and substate that are within the given area
Parameters:
state | The state to search |
---|---|
area | The rectangular area to search |
5.6.0
.getTool(className:Class<Tool>):Tool
Obtain a reference to a tool that has been added to the interaction system and is available for use. This method can be used to access information provided by any tool in the system, or to change their behavior.
Parameters:
className | name of the class to be fetched, e.g. |
---|
Returns:
Tool reference to the first tool found whose type matches the class name provided. If no tool is found, null
is returned.
getTopItemWithinArea(members:Array<FlxBasic>, area:FlxRect):FlxObject
Searches the members for the top-most object inside the given rectangle
Parameters:
members | The list of FlxObjects or FlxGroups |
---|---|
area | The rectangular area to search |
Returns:
The top-most item
5.6.0
.getTopItemWithinState(state:FlxState, area:FlxRect):FlxObject
Finds and returns top-most item in the state and substate within the given area
Parameters:
state | The state to search |
---|---|
area | The rectangular area to search |
5.6.0
.isInUse():Bool
Informs whether the interactive debug is in use or not. Usage is defined as the interactive debug being visible and one of its tools is selected/active.
Returns:
true
if the interactive debug is visible and one of its tools is selected/active.
removeTool(tool:Tool):Void
Removes the tool, if possible. If the tool has a button, all other buttons will be moved and the containing window will be resized, if needed.
Parameters:
tool | The tool to be removed |
---|
5.4.0
.