[swift-users] how to detect key pressed on linux console app?
Saagar Jha
saagar at saagarjha.com
Tue Apr 11 21:20:11 CDT 2017
AFAIK there isn’t a way to do this in Swift; you’ll have to drop down to C and use something like getchar or a library like ncurses. If I recall there was some discussion a while back about better command-line APIs for Swift but it appears that it fizzled out with the Swift 3 deadline and all.
Saagar Jha
> On Apr 10, 2017, at 22:04, Mr Bee via swift-users <swift-users at swift.org> wrote:
>
> Hi all,
>
> I'd like to know how to detect key pressed event on Linux console app using Swift. Not just waiting input like what readLine() is doing, but more like detecting arrow keys, left/right shift key, F1-10 keys, etc simultaneously while the program keep running. You know, something like game input.
>
> Thank you.
>
> Regards,
>
> –Mr Bee
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170411/f5d2ade4/attachment.html>
More information about the swift-users
mailing list