On Friday, 26 October 2012 at 18:05:09 UTC, H. S. Teoh wrote:
If we implement an event loop, I think it should be optional.

I think this is another benefit of capturing the input with a special type and method.

auto input = terminal.captureInput(ConsoleInputFlags.raw | ConsoleInputFlags.mouse);
while(true) {
   InputEvent = input.nextEvent();
   // blah blah blah
}


Then you can loop on it and get all kinds of data, or you can use the more plain read/write functions.

This is more or less how it works on Windows. (Really, the people who say text programming on Windows sucks always confuse me. It's a pretty decent design, lightyears better than the garbage you have to put up with on Linux.)

http://msdn.microsoft.com/en-us/library/windows/desktop/ms684961%28v=vs.85%29.aspx

for the fancier events or

http://msdn.microsoft.com/en-us/library/windows/desktop/ms684958%28v=vs.85%29.aspx

if all you care about is keyboard input.

Reply via email to