dshun123456 2017-02-25 04:34
浏览 9
已采纳

检查键盘状态

I can't seem to find a cross-platform library with Go that supports checking the state of the keyboard.

I'd rather not use something so heavy as Qt as it makes it quite hard to cross-compile and the GUI elements are very simple. If anybody could point me in the right direction, that would be amazing.

Thanks a ton.

Stuff I've tried:

https://mattn.github.io/go-gtk/

https://github.com/gotk3/gotk3

https://github.com/andlabs/ui (My favorite thus far, very lightweight.) If there is something I could use alongside this, that would be great as well.

EDIT:

Hey guys, a few months later just wanted to give an update. I ended up going the Qt route. Therecipe's bindings are pretty solid, aside from a few bugs. Getting proper keyboard input to put it short was nothing more than a pain in the ass.

  • 写回答

1条回答 默认 最新

  • dongshao4207 2017-02-25 05:20
    关注

    I found GLFW to be pretty straightforward to get set up. https://github.com/go-gl/glfw

    If you want something even more cross platform, try out https://github.com/goxjs/glfw

    It has conditional compilation which lets you compile on desktop platforms normally, but also to gopherjs so you can run the same code in a browser canvas.

    Here a keyboard handler package I made with it: https://github.com/Omustardo/gome/blob/master/input/keyboard/keyboard.go

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改