RealTimeConsoleInput

Encapsulates the stream of input events received from the terminal input.

struct RealTimeConsoleInput {
version(Posix)
ubyte[128] hack;
version(Windows)
HANDLE inputHandle;
void delegate(InputEvent) userEventHandler;
version(Posix)
int delegate(char) inputPrefilter;
InputEvent[] inputQueue;
}

Constructors

this
this(Terminal* terminal, ConsoleInputFlags flags)

To capture input, you need to provide a terminal and some flags.

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Postblit

A postblit is present on this object, but not explicitly documented in the source.

Members

Functions

getch
dchar getch(bool nonblocking = false)

Get one key press from the terminal, discarding other events in the process. Returns dchar.init upon receiving end-of-file.

integrateWithSimpleDisplayEventLoop
void integrateWithSimpleDisplayEventLoop(void delegate(InputEvent) userEventHandler)

If you are using arsd.simpledisplay and want terminal interop too, you can call this function to add it to the sdpy event loop and get the callback called on new input.

kbhit
bool kbhit()

Returns true if there iff getch() would not block.

nextEvent
InputEvent nextEvent()

Returns the next event.

timedCheckForInput
bool timedCheckForInput(int milliseconds)

Check for input, waiting no longer than the number of milliseconds

Meta