Class

Console

Console(fgopt, bgopt, cmdopt, cmdColopt)

Constructor

# new Console(fgopt, bgopt, cmdopt, cmdColopt)

create a on-screen text console.

Parameters:
Name Type Attributes Description
fg Color <optional>

default text color

bg Color <optional>

background color.

cmd boolean <optional>

command callback function.

cmdCol Color <optional>

color for command line.

Methods

# Draw(clearopt)

draw the console to the screen.

Parameters:
Name Type Attributes Description
clear boolean <optional>

true to clear the screen before drawing the text.

# GetInput() → {string}

get the contents of the command buffer.

the current command line content.

string

# HandleInput(e)

handle user input. Usually called in Input().

Parameters:
Name Type Description
e Event

the input event as provided by Input().

See:
  • Input()

# Log(txt, colopt)

add a logmessage to the console.

Parameters:
Name Type Attributes Description
txt string

the logmessage.

col Color <optional>

the color for this logmessage

# SetInput(txt)

set the current command buffer.

Parameters:
Name Type Description
txt String

the command line. use "" to clear current command.