A simple debug console integration.
Console can be focused manually through Console.show
and Console.hide
methods
as well as by pressing the key defined by Console.shortKeyChar
.
It's possible to log messages to console via Console.log
method.
By default comes with 2 commands: help
and cls
, which print help message
describing all commands and clears the console logs respectively.
To add custom commands, use Console.add
and Console.addCommand
methods.
Static variables
staticHIDE_LOG_TIMEOUT:Float = 3.
The timeout in seconds before log will automatically hide after the last message.
Constructor
new(font:Font, ?parent:Object)
Create a new Console instance using the provided font and parent.
Parameters:
font | The font to use for console text input and log. |
---|---|
parent | An optional parent |
Variables
shortKeyChar:Int = "/".code
The text character which should be pressed in order to automatically show console input.
Methods
addAlias(name:String, command:String):Void
Add an alias to an existing command.
Parameters:
name | Command alias. |
---|---|
command | Full command name to alias. |
addCommand(name:String, ?help:String, args:Array<ConsoleArgDesc>, callb:Dynamic):Void
Add a new command to console.
Parameters:
name | Command name. |
---|---|
help | Optional command description text. |
args | An array of command arguments. |
callb | The callback method taking the arguments listed in |
log(text:String, ?color:Int):Void
Print to the console log.
Parameters:
text | The text to show in the log message. |
---|---|
color | Optional custom text color. |