Added IConsoleListener
This commit is contained in:
parent
583f45e2da
commit
776f77a8d4
10 changed files with 104 additions and 5 deletions
|
@ -23,9 +23,11 @@
|
|||
|
||||
|
||||
#include "Console.h"
|
||||
#include "interfaces/IConsoleListener.h"
|
||||
|
||||
|
||||
Console::Console()
|
||||
Console::Console(IConsoleListener *listener)
|
||||
: m_listener(listener)
|
||||
{
|
||||
m_tty.data = this;
|
||||
uv_tty_init(uv_default_loop(), &m_tty, 0, 1);
|
||||
|
@ -50,6 +52,6 @@ void Console::onRead(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf)
|
|||
}
|
||||
|
||||
if (nread == 1) {
|
||||
printf("%c\n", buf->base[0]);
|
||||
static_cast<Console*>(stream->data)->m_listener->onConsoleCommand(buf->base[0]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue